From 92714b09ab818d000255aae8cbe617e268387b26 Mon Sep 17 00:00:00 2001 From: Lukas Lueg Date: Mon, 9 Jan 2023 21:48:54 +0100 Subject: [PATCH] Clippy fixes --- src/lib.rs | 4 ++-- src/util.rs | 2 +- tests/testbox_tests.rs | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 4e486374f..8a04615f9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1072,7 +1072,7 @@ mod tests { let commit_oid_short = binding.as_str().unwrap(); let commit_hash = format!("{}", commit_oid); - let commit_hash_short = format!("{}", commit_oid_short); + let commit_hash_short = commit_oid_short.to_string(); assert!(commit_hash.starts_with(&commit_hash_short)); @@ -1156,7 +1156,7 @@ mod tests { let commit_oid_short = binding.as_str().unwrap(); let commit_hash = format!("{}", commit_oid); - let commit_hash_short = format!("{}", commit_oid_short); + let commit_hash_short = commit_oid_short.to_string(); assert!(commit_hash.starts_with(&commit_hash_short)); diff --git a/src/util.rs b/src/util.rs index ca60d32a5..61b05064f 100644 --- a/src/util.rs +++ b/src/util.rs @@ -128,7 +128,7 @@ pub fn get_repo_head( Ok(Some(( branch.map(ToString::to_string), format!("{}", commit), - format!("{}", commit_short.as_str().unwrap_or_default()), + commit_short.as_str().unwrap_or_default().to_string(), ))) } Err(ref e) diff --git a/tests/testbox_tests.rs b/tests/testbox_tests.rs index 93214e647..b5a5b0d38 100644 --- a/tests/testbox_tests.rs +++ b/tests/testbox_tests.rs @@ -63,11 +63,11 @@ fn main() { /// Hold on to the tempdir, it will be removed when dropped! fn create(self) -> io::Result { fs::DirBuilder::new() - .create(&self.root.path().join("src")) + .create(self.root.path().join("src")) .unwrap(); for (name, content) in self.files { let fname = self.root.path().join(name); - let mut file = fs::File::create(&fname)?; + let mut file = fs::File::create(fname)?; file.write_all(&content)?; } Ok(self.root) @@ -274,7 +274,7 @@ fn main() { let mut f = std::fs::OpenOptions::new() .write(true) .truncate(true) - .open(&root.path().join("src/main.rs")) + .open(root.path().join("src/main.rs")) .unwrap(); f.write_all( r#"