diff rust/hg-core/src/matchers.rs @ 51117:532e74ad3ff6

rust: run a clippy pass with the latest stable version Our current version of clippy is older than the latest stable. The newest version has new lints that are moslty good advice, so let's apply them ahead of time. This has the added benefit of reducing the noise for developpers like myself that use clippy as an IDE helper, as well as being more prepared for a future clippy upgrade.
author Rapha?l Gom?s <rgomes@octobus.net>
date Mon, 06 Nov 2023 11:06:08 +0100
parents 687e192dae16
children bec6e9c108fd
line wrap: on
line diff
--- a/rust/hg-core/src/matchers.rs	Mon Nov 06 11:02:18 2023 +0100
+++ b/rust/hg-core/src/matchers.rs	Mon Nov 06 11:06:08 2023 +0100
@@ -28,7 +28,6 @@
 use crate::filepatterns::normalize_path_bytes;
 use std::collections::HashSet;
 use std::fmt::{Display, Error, Formatter};
-use std::ops::Deref;
 use std::path::{Path, PathBuf};
 use std::{borrow::ToOwned, collections::BTreeSet};
 
@@ -183,7 +182,7 @@
     pub fn new(files: Vec<HgPathBuf>) -> Result<Self, HgPathError> {
         let dirs = DirsMultiset::from_manifest(&files)?;
         Ok(Self {
-            files: HashSet::from_iter(files.into_iter()),
+            files: HashSet::from_iter(files),
             dirs,
             sorted_visitchildrenset_candidates: OnceCell::new(),
         })
@@ -316,7 +315,7 @@
     pub fn new(ignore_patterns: Vec<IgnorePattern>) -> PatternResult<Self> {
         let (files, _) = roots_and_dirs(&ignore_patterns);
         let dirs = DirsMultiset::from_manifest(&files)?;
-        let files: HashSet<HgPathBuf> = HashSet::from_iter(files.into_iter());
+        let files: HashSet<HgPathBuf> = HashSet::from_iter(files);
 
         let prefix = ignore_patterns.iter().all(|k| {
             matches!(k.syntax, PatternSyntax::Path | PatternSyntax::RelPath)
@@ -773,10 +772,10 @@
 
 /// Returns the regex pattern and a function that matches an `HgPath` against
 /// said regex formed by the given ignore patterns.
-fn build_regex_match<'a, 'b>(
-    ignore_patterns: &'a [IgnorePattern],
+fn build_regex_match<'a>(
+    ignore_patterns: &[IgnorePattern],
     glob_suffix: &[u8],
-) -> PatternResult<(Vec<u8>, IgnoreFnType<'b>)> {
+) -> PatternResult<(Vec<u8>, IgnoreFnType<'a>)> {
     let mut regexps = vec![];
     let mut exact_set = HashSet::new();
 
@@ -958,7 +957,7 @@
                 } else {
                     b"."
                 };
-                dirs.contains(dir.deref())
+                dirs.contains(dir)
             };
             match_funcs.push(Box::new(match_func));