This is an automated email from the ASF dual-hosted git repository.

junouyang pushed a commit to branch feat/blockong-operator-range-read
in repository https://gitbox.apache.org/repos/asf/incubator-opendal.git

commit fb84ba3c97dfed9b513df6497da06c6b2c2b55df
Author: owl <[email protected]>
AuthorDate: Wed Aug 23 18:00:00 2023 +0800

    feat(types): fix code
---
 core/src/types/operator/blocking_operator.rs | 25 ++++++++++++-------------
 core/tests/behavior/blocking_write.rs        | 10 ++++++++--
 2 files changed, 20 insertions(+), 15 deletions(-)

diff --git a/core/src/types/operator/blocking_operator.rs 
b/core/src/types/operator/blocking_operator.rs
index 255c92107..6d4b102f2 100644
--- a/core/src/types/operator/blocking_operator.rs
+++ b/core/src/types/operator/blocking_operator.rs
@@ -238,7 +238,7 @@ impl BlockingOperator {
     /// reading data lazily, please use [`BlockingOperator::reader`]
     ///
     /// # Examples
-    /// 
+    ///
     /// ```no_run
     /// # use anyhow::Result;
     /// use opendal::BlockingOperator;
@@ -262,31 +262,30 @@ impl BlockingOperator {
                         Error::new(ErrorKind::IsADirectory, "read path is a 
directory")
                             .with_operation("BlockingOperator::read_with")
                             .with_context("service", 
inner.info().scheme().into_static())
-                            .with_context("path", &path)
+                            .with_context("path", &path),
                     );
                 }
 
                 let (rp, mut s) = inner.blocking_read(&path, args)?;
                 let mut buffer = 
Vec::with_capacity(rp.into_metadata().content_length() as usize);
-                
+
                 match s.read_to_end(&mut buffer) {
                     Ok(n) => {
                         buffer.truncate(n);
                         Ok(buffer)
-                    },
+                    }
                     Err(err) => Err(
                         Error::new(ErrorKind::Unexpected, "blocking read_with 
failed")
-                        .with_operation("BlockingOperator::read_with")
-                        .with_context("service", 
inner.info().scheme().into_static())
-                        .with_context("path", &path)
-                        .set_source(err)
+                            .with_operation("BlockingOperator::read_with")
+                            .with_context("service", 
inner.info().scheme().into_static())
+                            .with_context("path", &path)
+                            .set_source(err),
                     ),
                 }
             },
         ))
     }
 
-
     /// Create a new reader which can read the whole path.
     ///
     /// # Examples
@@ -307,7 +306,7 @@ impl BlockingOperator {
     /// Create a new reader with extra options
     ///
     /// # Examples
-    /// 
+    ///
     /// ```no_run
     /// # use anyhow::Result;
     /// use opendal::BlockingOperator;
@@ -331,12 +330,12 @@ impl BlockingOperator {
                         Error::new(ErrorKind::IsADirectory, "reader path is a 
directory")
                             .with_operation("BlockingOperator::reader_with")
                             .with_context("service", 
inner.info().scheme().into_static())
-                            .with_context("path", &path)
+                            .with_context("path", &path),
                     );
                 }
 
                 BlockingReader::create(inner.clone(), &path, args)
-            }
+            },
         ))
     }
 
@@ -1049,4 +1048,4 @@ impl BlockingOperator {
             },
         ))
     }
-}
\ No newline at end of file
+}
diff --git a/core/tests/behavior/blocking_write.rs 
b/core/tests/behavior/blocking_write.rs
index 3445762d7..eb6932342 100644
--- a/core/tests/behavior/blocking_write.rs
+++ b/core/tests/behavior/blocking_write.rs
@@ -298,7 +298,10 @@ pub fn test_blocking_fuzz_range_reader(op: 
BlockingOperator) -> Result<()> {
         .expect("write must succeed");
 
     let mut fuzzer = ObjectReaderFuzzer::new(&path, content.clone(), 0, 
content.len());
-    let mut o = op.reader_with(&path).range(0..content.len() as u64).call()?;
+    let mut o = op
+        .reader_with(&path)
+        .range(0..content.len() as u64)
+        .call()?;
 
     for _ in 0..100 {
         match fuzzer.fuzz() {
@@ -373,7 +376,10 @@ pub fn test_blocking_fuzz_part_reader(op: 
BlockingOperator) -> Result<()> {
         .expect("write must succeed");
 
     let mut fuzzer = ObjectReaderFuzzer::new(&path, content, offset as usize, 
length as usize);
-    let mut o = op.reader_with(&path).range(offset..offset + length).call()?;
+    let mut o = op
+        .reader_with(&path)
+        .range(offset..offset + length)
+        .call()?;
 
     for _ in 0..100 {
         match fuzzer.fuzz() {

Reply via email to