# HG changeset patch # User Raphaël Gomès # Date 2024-10-29 10:35:01 # Node ID f90796d33aa055dacd0d3ed185ad0caa21d07232 # Parent a3fa37bdb7ecbad4cf31bc6e87545fd42058a93b rust: fix clippy lints These were highlighted by the latest version of clippy (1.82.0). diff --git a/rust/hg-core/src/ancestors.rs b/rust/hg-core/src/ancestors.rs --- a/rust/hg-core/src/ancestors.rs +++ b/rust/hg-core/src/ancestors.rs @@ -206,11 +206,10 @@ impl MissingAncestors { 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; diff --git a/rust/hg-core/src/revlog/filelog.rs b/rust/hg-core/src/revlog/filelog.rs --- a/rust/hg-core/src/revlog/filelog.rs +++ b/rust/hg-core/src/revlog/filelog.rs @@ -217,7 +217,7 @@ pub struct FilelogRevisionData(Vec); 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) { diff --git a/rust/hg-core/src/revlog/inner_revlog.rs b/rust/hg-core/src/revlog/inner_revlog.rs --- a/rust/hg-core/src/revlog/inner_revlog.rs +++ b/rust/hg-core/src/revlog/inner_revlog.rs @@ -802,9 +802,8 @@ impl InnerRevlog { 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(); diff --git a/rust/hg-cpython/src/ref_sharing.rs b/rust/hg-cpython/src/ref_sharing.rs --- a/rust/hg-cpython/src/ref_sharing.rs +++ b/rust/hg-cpython/src/ref_sharing.rs @@ -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