From 9d8f308a4d1dd13db9fdd4244dc66f55277d81e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Ml=C3=A1dek?= Date: Sun, 25 Oct 2020 15:56:03 +0100 Subject: [PATCH] cargo clippy fixes --- src/main.rs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/main.rs b/src/main.rs index 2f10140..5997693 100644 --- a/src/main.rs +++ b/src/main.rs @@ -239,7 +239,7 @@ fn update_garden>( garden_path: P, current: GardenCache, ) -> anyhow::Result { - let garden_path = garden_path.as_ref().clone(); + let garden_path = garden_path.as_ref(); let mut files: Vec = fs::read_dir(&garden_path)? .filter_map(|entry| { @@ -247,7 +247,7 @@ fn update_garden>( let path = entry.path(); if path.is_file() { let stripped_path = path.strip_prefix(&garden_path).unwrap().to_path_buf(); - if !stripped_path.to_str().unwrap().starts_with(".") { + if !stripped_path.to_str().unwrap().starts_with('.') { return Some(stripped_path); } } @@ -261,7 +261,7 @@ fn update_garden>( return Err(anyhow!("Garden is empty.")); } - let mut pages = current.pages.clone(); + let mut pages = current.pages; let markdown_paths = files .iter() @@ -271,13 +271,10 @@ fn update_garden>( trace!("Loading {} into cache...", path.display()); let mtime = path.metadata().unwrap().modified().ok(); if let Some(page) = pages.get(&path) { - match (mtime, page.timestamp) { - (Some(fs_time), Some(last_time)) => { - if fs_time == last_time { - continue; - } + if let (Some(fs_time), Some(last_time)) = (mtime, page.timestamp) { + if fs_time == last_time { + continue; } - _ => {} } }