You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by xu...@apache.org on 2026/04/17 00:04:45 UTC

(opendal) branch main updated: fix: address clippy lints on Rust 1.95 (#7395)

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

xuanwo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/opendal.git


The following commit(s) were added to refs/heads/main by this push:
     new 8332367dd fix: address clippy lints on Rust 1.95 (#7395)
8332367dd is described below

commit 8332367dd7629bebc7759a11a5bbbd941dd060e9
Author: Xuanwo <gi...@xuanwo.io>
AuthorDate: Fri Apr 17 08:04:40 2026 +0800

    fix: address clippy lints on Rust 1.95 (#7395)
    
    * fix: address clippy lints on Rust 1.95
    
    * fix(odev): satisfy Rust 1.95 clippy
---
 core/core/src/types/read/reader.rs     |  2 +-
 core/services/webdav/src/core.rs       | 44 +++++++++++++++-------------------
 dev/src/generate/python.rs             |  8 +++----
 integrations/object_store/src/store.rs |  2 +-
 4 files changed, 24 insertions(+), 32 deletions(-)

diff --git a/core/core/src/types/read/reader.rs b/core/core/src/types/read/reader.rs
index 576a0390b..a2af93390 100644
--- a/core/core/src/types/read/reader.rs
+++ b/core/core/src/types/read/reader.rs
@@ -194,7 +194,7 @@ impl Reader {
         let gap = self.ctx.options().gap().unwrap_or(1024 * 1024) as u64;
         // We don't care about the order of range with same start, they
         // will be merged in the next step.
-        ranges.sort_unstable_by(|a, b| a.start.cmp(&b.start));
+        ranges.sort_unstable_by_key(|a| a.start);
 
         // We know that this vector will have at most element
         let mut merged = Vec::with_capacity(ranges.len());
diff --git a/core/services/webdav/src/core.rs b/core/services/webdav/src/core.rs
index 57a52dcba..c3d66209d 100644
--- a/core/services/webdav/src/core.rs
+++ b/core/services/webdav/src/core.rs
@@ -609,27 +609,23 @@ pub fn parse_user_metadata_from_xml(xml: &str, namespace_uri: &str) -> HashMap<S
                     }
                 }
             }
-            Ok(Event::Text(ref e)) => {
-                if current_prop_key.is_some() {
-                    // Text content - add directly (no escaping needed)
-                    let text_str = String::from_utf8_lossy(e.as_ref());
-                    current_prop_value.push_str(&text_str);
-                }
+            Ok(Event::Text(ref e)) if current_prop_key.is_some() => {
+                // Text content - add directly (no escaping needed)
+                let text_str = String::from_utf8_lossy(e.as_ref());
+                current_prop_value.push_str(&text_str);
             }
-            Ok(Event::GeneralRef(ref e)) => {
-                if current_prop_key.is_some() {
-                    // Handle XML entity references (e.g., &lt; &gt; &amp; &quot; &apos;)
-                    let entity_name = String::from_utf8_lossy(e.as_ref());
-                    let decoded = match entity_name.as_ref() {
-                        "lt" => "<",
-                        "gt" => ">",
-                        "amp" => "&",
-                        "quot" => "\"",
-                        "apos" => "'",
-                        _ => "", // Unknown entity, skip
-                    };
-                    current_prop_value.push_str(decoded);
-                }
+            Ok(Event::GeneralRef(ref e)) if current_prop_key.is_some() => {
+                // Handle XML entity references (e.g., &lt; &gt; &amp; &quot; &apos;)
+                let entity_name = String::from_utf8_lossy(e.as_ref());
+                let decoded = match entity_name.as_ref() {
+                    "lt" => "<",
+                    "gt" => ">",
+                    "amp" => "&",
+                    "quot" => "\"",
+                    "apos" => "'",
+                    _ => "", // Unknown entity, skip
+                };
+                current_prop_value.push_str(decoded);
             }
             Ok(Event::End(ref e)) => {
                 let name = String::from_utf8_lossy(e.name().as_ref()).to_string();
@@ -682,11 +678,9 @@ pub fn check_proppatch_response(xml: &str) -> Result<()> {
                     status_text.clear();
                 }
             }
-            Ok(Event::Text(ref e)) => {
-                if in_status {
-                    let text_str = String::from_utf8_lossy(e.as_ref());
-                    status_text.push_str(&text_str);
-                }
+            Ok(Event::Text(ref e)) if in_status => {
+                let text_str = String::from_utf8_lossy(e.as_ref());
+                status_text.push_str(&text_str);
             }
             Ok(Event::End(ref e)) => {
                 let name = String::from_utf8_lossy(e.name().as_ref()).to_lowercase();
diff --git a/dev/src/generate/python.rs b/dev/src/generate/python.rs
index b0248cbc1..d4bd7a047 100644
--- a/dev/src/generate/python.rs
+++ b/dev/src/generate/python.rs
@@ -121,12 +121,10 @@ pub fn format_text(text: &str, indent: usize, max_line_length: usize) -> String
 
     for (i, &ch) in chars.iter().enumerate() {
         match ch {
-            '.' | '!' | '?' => {
+            '.' | '!' | '?' if i + 1 < chars.len() && chars[i + 1].is_whitespace() => {
                 // Sentence end
-                if i + 1 < chars.len() && chars[i + 1].is_whitespace() {
-                    segments.push(&text[start..=i]);
-                    start = i + 1;
-                }
+                segments.push(&text[start..=i]);
+                start = i + 1;
             }
             '\n' => {
                 if i > start {
diff --git a/integrations/object_store/src/store.rs b/integrations/object_store/src/store.rs
index 269e9cb3f..e9a5bbf77 100644
--- a/integrations/object_store/src/store.rs
+++ b/integrations/object_store/src/store.rs
@@ -662,7 +662,7 @@ impl MultipartUpload for OpendalMultipartUpload {
 
             let mut writer = writer.lock().await;
             let result = writer
-                .write(Buffer::from_iter(data.into_iter()))
+                .write(Buffer::from_iter(data))
                 .await
                 .map_err(|err| format_object_store_error(err, location.as_ref()));