From d7abd2e65e9808843674b1397934df4771c246ba Mon Sep 17 00:00:00 2001 From: Gwo Tzu-Hsing Date: Thu, 14 Nov 2024 15:16:54 +0800 Subject: [PATCH] refactor: format & specific compilation condition scope --- examples/opfs/src/lib.rs | 1 + fusio/Cargo.toml | 4 ++++ fusio/src/impls/remotes/aws/fs.rs | 1 + fusio/src/impls/remotes/aws/s3.rs | 1 + fusio/src/lib.rs | 13 +++++++++---- 5 files changed, 16 insertions(+), 4 deletions(-) diff --git a/examples/opfs/src/lib.rs b/examples/opfs/src/lib.rs index e537434..81cba91 100644 --- a/examples/opfs/src/lib.rs +++ b/examples/opfs/src/lib.rs @@ -88,6 +88,7 @@ pub async fn async_reader() { assert_eq!(expected, read); web_sys::console::log_1(&format!("read data: {:?} from parquet", read).into()); } + #[wasm_bindgen] pub async fn remove_all_dir() { let fs_options = FsOptions::Local; diff --git a/fusio/Cargo.toml b/fusio/Cargo.toml index 6dff917..bdc47de 100644 --- a/fusio/Cargo.toml +++ b/fusio/Cargo.toml @@ -7,6 +7,9 @@ readme = "../README.md" repository.workspace = true version = "0.3.3" +[package.metadata.docs.rs] +all-features = true + [features] aws = [ "base64", @@ -49,6 +52,7 @@ opfs = [ tokio = ["async-stream", "dep:tokio"] tokio-http = ["dep:reqwest", "http"] tokio-uring = ["async-stream", "completion-based", "dep:tokio-uring", "no-send"] + [[bench]] harness = false name = "tokio" diff --git a/fusio/src/impls/remotes/aws/fs.rs b/fusio/src/impls/remotes/aws/fs.rs index 022a968..0546aea 100644 --- a/fusio/src/impls/remotes/aws/fs.rs +++ b/fusio/src/impls/remotes/aws/fs.rs @@ -91,6 +91,7 @@ impl AmazonS3Builder { }; AmazonS3 { + #[allow(clippy::arc_with_non_send_sync)] inner: Arc::new(AmazonS3Inner { options: S3Options { endpoint, diff --git a/fusio/src/impls/remotes/aws/s3.rs b/fusio/src/impls/remotes/aws/s3.rs index 3c7aa70..79636b6 100644 --- a/fusio/src/impls/remotes/aws/s3.rs +++ b/fusio/src/impls/remotes/aws/s3.rs @@ -227,6 +227,7 @@ impl Write for S3File { async fn write_all(&mut self, buf: B) -> (Result<(), Error>, B) { self.writer .get_or_insert_with(|| { + #[allow(clippy::arc_with_non_send_sync)] S3Writer::new(Arc::new(MultipartUpload::new( self.fs.clone(), self.path.clone(), diff --git a/fusio/src/lib.rs b/fusio/src/lib.rs index a53450a..47863d2 100644 --- a/fusio/src/lib.rs +++ b/fusio/src/lib.rs @@ -95,7 +95,12 @@ pub unsafe trait MaybeSync: Sync { } #[cfg(feature = "no-send")] -pub unsafe trait MaybeSync {} +pub unsafe trait MaybeSync { + //! Same as [`MaybeSend`], but for [`std::marker::Sync`]. + //! + //! # Safety + //! Do not implement it directly. +} #[cfg(not(feature = "no-send"))] unsafe impl MaybeSync for T {} @@ -208,7 +213,6 @@ impl Write for &mut W { } #[cfg(test)] -#[cfg(not(target_arch = "wasm32"))] mod tests { use super::{Read, Write}; use crate::{buf::IoBufMut, Error, IoBuf}; @@ -322,6 +326,7 @@ mod tests { } #[allow(unused)] + #[cfg(not(target_arch = "wasm32"))] async fn test_local_fs(fs: S) -> Result<(), Error> where S: crate::fs::Fs, @@ -395,7 +400,7 @@ mod tests { write_and_read(File::from_std(write), File::from_std(read)).await; } - #[cfg(feature = "tokio")] + #[cfg(all(feature = "tokio", not(target_arch = "wasm32")))] #[tokio::test] async fn test_tokio_fs() { use crate::disk::TokioFs; @@ -422,7 +427,7 @@ mod tests { } } - #[cfg(feature = "monoio")] + #[cfg(all(feature = "monoio", not(target_arch = "wasm32")))] #[monoio::test] async fn test_monoio() { use monoio::fs::File;