cleanup: address unnecessary_borrow lints reported by Clippy 1.66

Interestingly, the nightly release doesn't complain about this. One
instance in `test_working_copy.rs` is a bug in Clippy.
This commit is contained in:
Martin von Zweigbergk 2022-12-15 11:59:10 -08:00 committed by Martin von Zweigbergk
parent af32f0d3c3
commit fb396e6b45
3 changed files with 5 additions and 3 deletions

View File

@ -60,7 +60,7 @@ fn upgrade_from_thrift(store_path: &Path) -> std::io::Result<()> {
// Find the current operation head(s) of the operation log
let op_heads_store_path = repo_path.join("op_heads");
let mut old_op_heads = HashSet::new();
for entry in fs::read_dir(&op_heads_store_path)? {
for entry in fs::read_dir(op_heads_store_path)? {
let basename = entry?.file_name();
let op_id_str = basename.to_str().unwrap();
if let Ok(op_id_bytes) = hex::decode(op_id_str) {

View File

@ -45,7 +45,7 @@ fn merge_directories(left: &Path, base: &Path, right: &Path, output: &Path) {
if child_left.is_dir() {
sub_dirs.push(base_name.to_os_string());
} else {
std::fs::copy(&child_left, &child_output).unwrap();
std::fs::copy(&child_left, child_output).unwrap();
}
}
// Walk the base and find files removed in the right side, then remove them in
@ -75,7 +75,7 @@ fn merge_directories(left: &Path, base: &Path, right: &Path, output: &Path) {
} else if !child_base.exists() {
// This overwrites the left side if that's been written. That's fine, since the
// point of the test is that it should be okay for either side to win.
std::fs::copy(&child_right, &child_output).unwrap();
std::fs::copy(&child_right, child_output).unwrap();
}
}
// Do the merge in subdirectories

View File

@ -401,6 +401,8 @@ fn test_snapshot_racy_timestamps(use_git: bool) {
let wc = test_workspace.workspace.working_copy_mut();
for i in 0..100 {
{
// https://github.com/rust-lang/rust-clippy/issues/9778
#[allow(clippy::needless_borrow)]
let mut file = OpenOptions::new()
.create(true)
.write(true)