cargo clippy fixes

This commit is contained in:
Tomáš Mládek 2020-10-25 15:56:03 +01:00
parent 38e560aa51
commit 9d8f308a4d

View file

@ -239,7 +239,7 @@ fn update_garden<P: AsRef<Path>>(
garden_path: P,
current: GardenCache,
) -> anyhow::Result<GardenCache> {
let garden_path = garden_path.as_ref().clone();
let garden_path = garden_path.as_ref();
let mut files: Vec<PathBuf> = fs::read_dir(&garden_path)?
.filter_map(|entry| {
@ -247,7 +247,7 @@ fn update_garden<P: AsRef<Path>>(
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<P: AsRef<Path>>(
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<P: AsRef<Path>>(
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;
}
_ => {}
}
}