From af4d183c7e3e5cb511628a7fbca529cac3e3fae7 Mon Sep 17 00:00:00 2001 From: Martin von Zweigbergk Date: Sun, 9 Oct 2022 10:08:12 -0700 Subject: [PATCH] cleanup: automated fixes by new Clippy version --- lib/src/index.rs | 6 +++--- lib/src/local_backend.rs | 2 +- lib/src/stacked_table.rs | 2 +- lib/src/working_copy.rs | 2 +- tests/test_init_command.rs | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/src/index.rs b/lib/src/index.rs index 2f326186a..3b0994c52 100644 --- a/lib/src/index.rs +++ b/lib/src/index.rs @@ -553,7 +553,7 @@ impl MutableIndex { let buf = self.maybe_squash_with_ancestors().serialize(); let mut hasher = Blake2b512::new(); hasher.update(&buf); - let index_file_id_hex = hex::encode(&hasher.finalize()); + let index_file_id_hex = hex::encode(hasher.finalize()); let index_file_path = dir.join(&index_file_id_hex); let mut temp_file = NamedTempFile::new_in(&dir)?; @@ -744,7 +744,7 @@ impl<'a> CompositeIndex<'a> { pub fn entry_by_id(&self, commit_id: &CommitId) -> Option> { self.commit_id_to_pos(commit_id) - .map(&|pos| self.entry_by_pos(pos)) + .map(|pos| self.entry_by_pos(pos)) } pub fn has_id(&self, commit_id: &CommitId) -> bool { @@ -1085,7 +1085,7 @@ impl IndexSegment for ReadonlyIndex { None => PrefixResolution::NoMatch, Some(lookup_pos) => { let mut first_match = None; - for i in lookup_pos.0..self.num_local_commits as u32 { + for i in lookup_pos.0..self.num_local_commits { let entry = self.lookup_entry(i); let id = entry.commit_id(); if !id.as_bytes().starts_with(bytes_prefix.as_bytes()) { diff --git a/lib/src/local_backend.rs b/lib/src/local_backend.rs index 711d734b1..53e55fe98 100644 --- a/lib/src/local_backend.rs +++ b/lib/src/local_backend.rs @@ -165,7 +165,7 @@ impl Backend for LocalBackend { let mut temp_file = NamedTempFile::new_in(&self.path)?; temp_file.write_all(target.as_bytes())?; let mut hasher = Blake2b512::new(); - hasher.update(&target.as_bytes()); + hasher.update(target.as_bytes()); let id = SymlinkId::new(hasher.finalize().to_vec()); persist_content_addressed_temp_file(temp_file, self.symlink_path(&id))?; diff --git a/lib/src/stacked_table.rs b/lib/src/stacked_table.rs index cf38b8be8..eb55f380b 100644 --- a/lib/src/stacked_table.rs +++ b/lib/src/stacked_table.rs @@ -329,7 +329,7 @@ impl MutableTable { let buf = self.maybe_squash_with_ancestors().serialize(); let mut hasher = Blake2b512::new(); hasher.update(&buf); - let file_id_hex = hex::encode(&hasher.finalize()); + let file_id_hex = hex::encode(hasher.finalize()); let file_path = store.dir.join(&file_id_hex); let mut temp_file = NamedTempFile::new_in(&store.dir)?; diff --git a/lib/src/working_copy.rs b/lib/src/working_copy.rs index 20f842cdd..77ab76fc5 100644 --- a/lib/src/working_copy.rs +++ b/lib/src/working_copy.rs @@ -841,7 +841,7 @@ impl TreeState { fs::remove_file(&disk_path).ok(); let mut parent_dir = disk_path.parent().unwrap(); loop { - if fs::remove_dir(&parent_dir).is_err() { + if fs::remove_dir(parent_dir).is_err() { break; } parent_dir = parent_dir.parent().unwrap(); diff --git a/tests/test_init_command.rs b/tests/test_init_command.rs index 1f668b657..5fe88e276 100644 --- a/tests/test_init_command.rs +++ b/tests/test_init_command.rs @@ -19,7 +19,7 @@ use crate::common::TestEnvironment; pub mod common; fn init_git_repo(git_repo_path: &PathBuf) { - let git_repo = git2::Repository::init(&git_repo_path).unwrap(); + let git_repo = git2::Repository::init(git_repo_path).unwrap(); let git_blob_oid = git_repo.blob(b"some content").unwrap(); let mut git_tree_builder = git_repo.treebuilder(None).unwrap(); git_tree_builder