From 5c98d370984d83408142f2642788f3a3026589b6 Mon Sep 17 00:00:00 2001 From: meteorgan Date: Sun, 19 Jan 2025 18:43:58 +0800 Subject: [PATCH] fix cargo clippy --- core/src/layers/dtrace.rs | 4 ++-- core/tests/behavior/async_write.rs | 4 ++++ integrations/fuse3/src/file_system.rs | 2 +- integrations/parquet/src/async_writer.rs | 1 + 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/core/src/layers/dtrace.rs b/core/src/layers/dtrace.rs index b3c181ce1e04..9ebcf1b56189 100644 --- a/core/src/layers/dtrace.rs +++ b/core/src/layers/dtrace.rs @@ -382,7 +382,7 @@ impl oio::Write for DtraceLayerWrapper { }) } - async fn close(&mut self) -> Result<()> { + async fn close(&mut self) -> Result { let c_path = CString::new(self.path.clone()).unwrap(); probe_lazy!(opendal, writer_close_start, c_path.as_ptr()); self.inner @@ -413,7 +413,7 @@ impl oio::BlockingWrite for DtraceLayerWrapper { }) } - fn close(&mut self) -> Result<()> { + fn close(&mut self) -> Result { let c_path = CString::new(self.path.clone()).unwrap(); probe_lazy!(opendal, blocking_writer_close_start, c_path.as_ptr()); self.inner diff --git a/core/tests/behavior/async_write.rs b/core/tests/behavior/async_write.rs index 100f54b80e69..07c75c988634 100644 --- a/core/tests/behavior/async_write.rs +++ b/core/tests/behavior/async_write.rs @@ -589,6 +589,10 @@ pub async fn test_writer_futures_copy_with_concurrent(op: Operator) -> Result<() } pub async fn test_writer_return_metadata(op: Operator) -> Result<()> { + if !op.info().full_capability().write_can_multi { + return Ok(()); + } + let path = TEST_FIXTURE.new_file_path(); let size = 5 * 1024 * 1024; // write file with 5 MiB let content_a = gen_fixed_bytes(size); diff --git a/integrations/fuse3/src/file_system.rs b/integrations/fuse3/src/file_system.rs index 2811149b2177..d49803669af0 100644 --- a/integrations/fuse3/src/file_system.rs +++ b/integrations/fuse3/src/file_system.rs @@ -557,7 +557,7 @@ impl PathFilesystem for Filesystem { if let Some(inner_writer) = file.inner_writer { let mut lock = inner_writer.lock().await; let res = lock.writer.close().await.map_err(opendal_error2errno); - return res; + return res.map(|_| ()); } if matches!(path, Some(ref p) if p != &file.path) { diff --git a/integrations/parquet/src/async_writer.rs b/integrations/parquet/src/async_writer.rs index 7f4ab16e5c3d..7f92fd6b69b4 100644 --- a/integrations/parquet/src/async_writer.rs +++ b/integrations/parquet/src/async_writer.rs @@ -97,6 +97,7 @@ impl AsyncFileWriter for AsyncWriter { self.inner .close() .await + .map(|_| ()) .map_err(|err| ParquetError::External(Box::new(err))) }) }