From 9f3c2813abf8e43c8fc549348b139cb7b8a3d92e Mon Sep 17 00:00:00 2001 From: Valentin Brandl Date: Tue, 13 Jun 2023 10:26:25 +0200 Subject: [PATCH] Apply cargo fmt --- src/cache.rs | 13 +++++-------- src/lib.rs | 4 +--- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/cache.rs b/src/cache.rs index 716f8ec..b8fc803 100644 --- a/src/cache.rs +++ b/src/cache.rs @@ -36,13 +36,10 @@ impl<'a> CacheState<'a> { trace!("Reading cache"); if path.as_ref().exists() { let cache: Cache = serde_json::from_reader(BufReader::new(File::open(path)?))?; - Ok(cache - .entries - .get(branch) - .map_or_else( + Ok(cache.entries.get(branch).map_or_else( // TODO: get rid of clone -|| CacheState::NoneForBranch(cache.clone()), - |c| { + || CacheState::NoneForBranch(cache.clone()), + |c| { if c.head == head { trace!("Cache is up to date"); CacheState::Current { @@ -59,8 +56,8 @@ impl<'a> CacheState<'a> { cache: cache.clone(), } } - }) - ) + }, + )) } else { Ok(CacheState::No) } diff --git a/src/lib.rs b/src/lib.rs index efb230f..0884d6e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -501,9 +501,7 @@ async fn static_file( .content_type(data.mime.clone()) .body(data.content) }) - .map_or_else( - || p404(&repo_count), - Result::Ok) + .map_or_else(|| p404(&repo_count), Result::Ok) } #[get("/favicon.ico")]