From c45bf34eb259e2535908c5d377092177da3adc0b Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Sat, 24 Oct 2020 14:03:21 +0530 Subject: [PATCH] src: fix clippy warnings Signed-off-by: Harsh Shandilya --- src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index a96d4b0..9254e4a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -66,7 +66,7 @@ fn main() -> anyhow::Result<()> { fn freeze_repos(dir: &str) -> anyhow::Result<()> { let mut repos: HashMap = HashMap::new(); - for entry in WalkDir::new(dir.clone()).into_iter().filter_map(|e| e.ok()) { + for entry in WalkDir::new(dir).into_iter().filter_map(|e| e.ok()) { if entry.file_type().is_dir() { let path = format!("{}/.git", entry.path().display()); let git_dir = Path::new(&path); @@ -114,7 +114,7 @@ fn freeze_repos(dir: &str) -> anyhow::Result<()> { fn thaw_repos(dir: &str, lockfile: &str) -> anyhow::Result<()> { let lockfile = - fs::read_to_string(lockfile).expect(&format!("unable to read lockfile from {}", lockfile)); + fs::read_to_string(lockfile).unwrap_or_else(|_| panic!("unable to read lockfile from {}", lockfile)); let repos: HashMap = toml::from_str(&lockfile)?; for (name, repo) in repos {