Fix clippy::cloned_instead_of_copied.

This commit is contained in:
David Campbell 2024-09-19 19:45:57 -04:00
parent d0e30b2745
commit 392344c93a
No known key found for this signature in database
GPG key ID: C2E99A0CF863A603
4 changed files with 5 additions and 5 deletions

View file

@ -96,7 +96,7 @@ fn create_algorithm_from_flags(matches: &ArgMatches) -> UResult<HashAlgorithm> {
set_or_err(detect_algo("b3sum", None)?)?; set_or_err(detect_algo("b3sum", None)?)?;
} }
if matches.get_flag("sha3") { if matches.get_flag("sha3") {
let bits = matches.get_one::<usize>("bits").cloned(); let bits = matches.get_one::<usize>("bits").copied();
set_or_err(create_sha3(bits)?)?; set_or_err(create_sha3(bits)?)?;
} }
if matches.get_flag("sha3-224") { if matches.get_flag("sha3-224") {

View file

@ -129,7 +129,7 @@ impl WordFilter {
HashSet::new() // really only chars found in file HashSet::new() // really only chars found in file
} else { } else {
// GNU off means at least these are considered // GNU off means at least these are considered
[' ', '\t', '\n'].iter().cloned().collect() [' ', '\t', '\n'].iter().copied().collect()
}; };
hs.extend(chars); hs.extend(chars);
Some(hs) Some(hs)

View file

@ -112,7 +112,7 @@ impl Sequence {
Self::Class(class) => match class { Self::Class(class) => match class {
Class::Alnum => Box::new((b'0'..=b'9').chain(b'A'..=b'Z').chain(b'a'..=b'z')), Class::Alnum => Box::new((b'0'..=b'9').chain(b'A'..=b'Z').chain(b'a'..=b'z')),
Class::Alpha => Box::new((b'A'..=b'Z').chain(b'a'..=b'z')), Class::Alpha => Box::new((b'A'..=b'Z').chain(b'a'..=b'z')),
Class::Blank => Box::new(unicode_table::BLANK.iter().cloned()), Class::Blank => Box::new(unicode_table::BLANK.iter().copied()),
Class::Control => Box::new((0..=31).chain(std::iter::once(127))), Class::Control => Box::new((0..=31).chain(std::iter::once(127))),
Class::Digit => Box::new(b'0'..=b'9'), Class::Digit => Box::new(b'0'..=b'9'),
Class::Graph => Box::new( Class::Graph => Box::new(
@ -137,7 +137,7 @@ impl Sequence {
.chain(123..=126), .chain(123..=126),
), ),
Class::Punct => Box::new((33..=47).chain(58..=64).chain(91..=96).chain(123..=126)), Class::Punct => Box::new((33..=47).chain(58..=64).chain(91..=96).chain(123..=126)),
Class::Space => Box::new(unicode_table::SPACES.iter().cloned()), Class::Space => Box::new(unicode_table::SPACES.iter().copied()),
Class::Xdigit => Box::new((b'0'..=b'9').chain(b'A'..=b'F').chain(b'a'..=b'f')), Class::Xdigit => Box::new((b'0'..=b'9').chain(b'A'..=b'F').chain(b'a'..=b'f')),
Class::Lower => Box::new(b'a'..=b'z'), Class::Lower => Box::new(b'a'..=b'z'),
Class::Upper => Box::new(b'A'..=b'Z'), Class::Upper => Box::new(b'A'..=b'Z'),

View file

@ -231,7 +231,7 @@ pub enum ResolveMode {
/// replace this once that lands /// replace this once that lands
pub fn normalize_path(path: &Path) -> PathBuf { pub fn normalize_path(path: &Path) -> PathBuf {
let mut components = path.components().peekable(); let mut components = path.components().peekable();
let mut ret = if let Some(c @ Component::Prefix(..)) = components.peek().cloned() { let mut ret = if let Some(c @ Component::Prefix(..)) = components.peek().copied() {
components.next(); components.next();
PathBuf::from(c.as_os_str()) PathBuf::from(c.as_os_str())
} else { } else {