From 7ac6770f934b7304460d43b14daab9ba473cd266 Mon Sep 17 00:00:00 2001 From: Jordan Doyle Date: Mon, 18 Jul 2022 00:31:13 +0100 Subject: [PATCH] cargo fmt --- src/git.rs | 4 +++- src/database/indexer.rs | 10 ++++++++++ src/database/schema/commit.rs | 17 ++++++++++------- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/src/git.rs b/src/git.rs index 2c462c2..401d1ce 100644 --- a/src/git.rs +++ a/src/git.rs @@ -211,7 +211,9 @@ } } - built_refs.branch.sort_unstable_by(|one, two| one.commit.committer.time.cmp(&two.commit.committer.time)); + built_refs.branch.sort_unstable_by(|one, two| { + one.commit.committer.time.cmp(&two.commit.committer.time) + }); built_refs.tag.sort_unstable_by(|one, two| { let one_tagger = one.tagger.as_ref().map(|v| v.time); let two_tagger = two.tagger.as_ref().map(|v| v.time); diff --git a/src/database/indexer.rs b/src/database/indexer.rs index fa7417b..2363a6d 100644 --- a/src/database/indexer.rs +++ a/src/database/indexer.rs @@ -51,14 +51,20 @@ continue; } - let span = info_span!("index_update", reference = reference_name.as_ref(), repository = relative_path); + let span = info_span!( + "index_update", + reference = reference_name.as_ref(), + repository = relative_path + ); let _entered = span.enter(); info!("Refreshing indexes"); let commit_tree = db_repository.get().commit_tree(db, &reference_name); - if let (Some(latest_indexed), Ok(latest_commit)) = (commit_tree.fetch_latest_one(), reference.peel_to_commit()) { + if let (Some(latest_indexed), Ok(latest_commit)) = + (commit_tree.fetch_latest_one(), reference.peel_to_commit()) + { if latest_commit.id().as_bytes() == &*latest_indexed.get().hash { info!("No commits since last index"); continue; diff --git a/src/database/schema/commit.rs b/src/database/schema/commit.rs index b76f41e..5dfb258 100644 --- a/src/database/schema/commit.rs +++ a/src/database/schema/commit.rs @@ -121,17 +121,14 @@ } pub fn fetch_latest_one(&self) -> Option { - self.last() - .unwrap() - .map(|(_, value)| { - // internally value is an Arc so it should already be stablederef but because - // of reasons unbeknownst to me, sled has its own Arc implementation so we need - // to box the value as well to get a stablederef... - let value = Box::new(value); + self.last().unwrap().map(|(_, value)| { + // internally value is an Arc so it should already be stablederef but because + // of reasons unbeknownst to me, sled has its own Arc implementation so we need + // to box the value as well to get a stablederef... + let value = Box::new(value); - Yoke::try_attach_to_cart(value, |data: &IVec| bincode::deserialize(&data)) - .unwrap() - }) + Yoke::try_attach_to_cart(value, |data: &IVec| bincode::deserialize(&data)).unwrap() + }) } pub async fn fetch_latest(&self, amount: usize, offset: usize) -> Vec { -- rgit 0.1.3