Skip to content

Commit

Permalink
refactor: format & specific compilation condition scope
Browse files Browse the repository at this point in the history
  • Loading branch information
ethe committed Nov 14, 2024
1 parent 8038993 commit d7abd2e
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 4 deletions.
1 change: 1 addition & 0 deletions examples/opfs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions fusio/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ readme = "../README.md"
repository.workspace = true
version = "0.3.3"

[package.metadata.docs.rs]
all-features = true

[features]
aws = [
"base64",
Expand Down Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions fusio/src/impls/remotes/aws/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ impl AmazonS3Builder {
};

AmazonS3 {
#[allow(clippy::arc_with_non_send_sync)]
inner: Arc::new(AmazonS3Inner {
options: S3Options {
endpoint,
Expand Down
1 change: 1 addition & 0 deletions fusio/src/impls/remotes/aws/s3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ impl Write for S3File {
async fn write_all<B: IoBuf>(&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(),
Expand Down
13 changes: 9 additions & 4 deletions fusio/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<T: Sync> MaybeSync for T {}
Expand Down Expand Up @@ -208,7 +213,6 @@ impl<W: Write> Write for &mut W {
}

#[cfg(test)]
#[cfg(not(target_arch = "wasm32"))]
mod tests {
use super::{Read, Write};
use crate::{buf::IoBufMut, Error, IoBuf};
Expand Down Expand Up @@ -322,6 +326,7 @@ mod tests {
}

#[allow(unused)]
#[cfg(not(target_arch = "wasm32"))]
async fn test_local_fs<S>(fs: S) -> Result<(), Error>
where
S: crate::fs::Fs,
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit d7abd2e

Please sign in to comment.