Mercurial > hg
diff rust/hg-core/src/utils/files.rs @ 51120: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 | e98fd81bb151 |
children | 529a655874fb |
line wrap: on
line diff
--- a/rust/hg-core/src/utils/files.rs Mon Nov 06 11:02:18 2023 +0100 +++ b/rust/hg-core/src/utils/files.rs Mon Nov 06 11:06:08 2023 +0100 @@ -192,13 +192,13 @@ let name = name.as_ref(); let name = if !name.is_absolute() { - root.join(&cwd).join(&name) + root.join(cwd).join(name) } else { name.to_owned() }; - let auditor = PathAuditor::new(&root); - if name != root && name.starts_with(&root) { - let name = name.strip_prefix(&root).unwrap(); + let auditor = PathAuditor::new(root); + if name != root && name.starts_with(root) { + let name = name.strip_prefix(root).unwrap(); auditor.audit_path(path_to_hg_path_buf(name)?)?; Ok(name.to_owned()) } else if name == root { @@ -210,7 +210,7 @@ let mut name = name.deref(); let original_name = name.to_owned(); loop { - let same = is_same_file(&name, &root).unwrap_or(false); + let same = is_same_file(name, root).unwrap_or(false); if same { if name == original_name { // `name` was actually the same as root (maybe a symlink) @@ -218,8 +218,8 @@ } // `name` is a symlink to root, so `original_name` is under // root - let rel_path = original_name.strip_prefix(&name).unwrap(); - auditor.audit_path(path_to_hg_path_buf(&rel_path)?)?; + let rel_path = original_name.strip_prefix(name).unwrap(); + auditor.audit_path(path_to_hg_path_buf(rel_path)?)?; return Ok(rel_path.to_owned()); } name = match name.parent() { @@ -429,7 +429,7 @@ }) ); assert_eq!( - canonical_path(&root, Path::new(""), &under_repo_symlink), + canonical_path(&root, Path::new(""), under_repo_symlink), Ok(PathBuf::from("d")) ); }