changeset 52295:f90796d33aa0

rust: fix clippy lints These were highlighted by the latest version of clippy (1.82.0).
author Raphaël Gomès <rgomes@octobus.net>
date Tue, 29 Oct 2024 11:35:01 +0100
parents a3fa37bdb7ec
children 4361d787e6cf
files rust/hg-core/src/ancestors.rs rust/hg-core/src/revlog/filelog.rs rust/hg-core/src/revlog/inner_revlog.rs rust/hg-cpython/src/ref_sharing.rs
diffstat 4 files changed, 5 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/rust/hg-core/src/ancestors.rs	Tue Oct 29 11:00:04 2024 +0100
+++ b/rust/hg-core/src/ancestors.rs	Tue Oct 29 11:35:01 2024 +0100
@@ -206,11 +206,10 @@
             new_bases
                 .into_iter()
                 .filter(|&rev| rev != NULL_REVISION)
-                .map(|r| {
+                .inspect(|&r| {
                     if r > max_base {
                         max_base = r;
                     }
-                    r
                 }),
         );
         self.max_base = max_base;
--- a/rust/hg-core/src/revlog/filelog.rs	Tue Oct 29 11:00:04 2024 +0100
+++ b/rust/hg-core/src/revlog/filelog.rs	Tue Oct 29 11:35:01 2024 +0100
@@ -217,7 +217,7 @@
 impl FilelogRevisionData {
     /// Split into metadata and data
     pub fn split(&self) -> Result<(Option<&[u8]>, &[u8]), HgError> {
-        const DELIMITER: &[u8; 2] = &[b'\x01', b'\n'];
+        const DELIMITER: &[u8; 2] = b"\x01\n";
 
         if let Some(rest) = self.0.drop_prefix(DELIMITER) {
             if let Some((metadata, data)) = rest.split_2_by_slice(DELIMITER) {
--- a/rust/hg-core/src/revlog/inner_revlog.rs	Tue Oct 29 11:00:04 2024 +0100
+++ b/rust/hg-core/src/revlog/inner_revlog.rs	Tue Oct 29 11:35:01 2024 +0100
@@ -802,9 +802,8 @@
             return Ok(func());
         }
         self.enter_writing_context(data_end, transaction)
-            .map_err(|e| {
+            .inspect_err(|_| {
                 self.exit_writing_context();
-                e
             })?;
         let res = func();
         self.exit_writing_context();
--- a/rust/hg-cpython/src/ref_sharing.rs	Tue Oct 29 11:00:04 2024 +0100
+++ b/rust/hg-cpython/src/ref_sharing.rs	Tue Oct 29 11:35:01 2024 +0100
@@ -31,10 +31,10 @@
 ///
 /// * `$name` is the identifier to give to the resulting Rust struct.
 /// * `$leaked` corresponds to `UnsafePyLeaked` in the matching `@shared data`
-/// declaration.
+///   declaration.
 /// * `$iterator_type` is the type of the Rust iterator.
 /// * `$success_func` is a function for processing the Rust `(key, value)`
-/// tuple on iteration success, turning it into something Python understands.
+///   tuple on iteration success, turning it into something Python understands.
 /// * `$success_func` is the return type of `$success_func`
 ///
 /// # Safety