fix: clippy warning of rust 1.8.4 (#14984)

# Description

I'm on rust toolchain 1.8.4, and I can see clippy warnings that can't be
caught by the ci workflow, primarily related to lifetime params.

I think it doesn't hurt to fix those in advance.

# User-Facing Changes

# Tests + Formatting

# After Submitting
This commit is contained in:
zc he
2025-02-02 21:56:54 +08:00
committed by GitHub
parent 5291f978c2
commit 339c5b7c83
16 changed files with 54 additions and 56 deletions

View File

@ -294,7 +294,6 @@ pub fn glob_with(pattern: &str, options: MatchOptions) -> Result<Paths, PatternE
/// This is provided primarily for testability, so multithreaded test runners can
/// test pattern matches in different test directories at the same time without
/// having to append the parent to the pattern under test.
pub fn glob_with_parent(
pattern: &str,
options: MatchOptions,
@ -790,7 +789,7 @@ impl Pattern {
/// `Pattern` using the default match options (i.e. `MatchOptions::default()`).
pub fn matches_path(&self, path: &Path) -> bool {
// FIXME (#9639): This needs to handle non-utf8 paths
path.to_str().map_or(false, |s| self.matches(s))
path.to_str().is_some_and(|s| self.matches(s))
}
/// Return if the given `str` matches this `Pattern` using the specified
@ -803,8 +802,7 @@ impl Pattern {
/// `Pattern` using the specified match options.
pub fn matches_path_with(&self, path: &Path, options: MatchOptions) -> bool {
// FIXME (#9639): This needs to handle non-utf8 paths
path.to_str()
.map_or(false, |s| self.matches_with(s, options))
path.to_str().is_some_and(|s| self.matches_with(s, options))
}
/// Access the original glob pattern.
@ -1069,7 +1067,7 @@ fn chars_eq(a: char, b: char, case_sensitive: bool) -> bool {
true
} else if !case_sensitive && a.is_ascii() && b.is_ascii() {
// FIXME: work with non-ascii chars properly (issue #9084)
a.to_ascii_lowercase() == b.to_ascii_lowercase()
a.eq_ignore_ascii_case(&b)
} else {
a == b
}