Skip to content

Commit 1a5faff

Browse files
committed
feat: simplify summary initialization by removing Mutex and using into_arc_mutex
Signed-off-by: simonsan <14062932+simonsan@users.noreply.github.com>
1 parent 688f349 commit 1a5faff

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

crates/core/src/commands/check.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::{
44
fmt::Debug,
55
num::ParseIntError,
66
str::FromStr,
7-
sync::{Arc, Mutex},
7+
sync::Arc,
88
};
99

1010
use bytes::Bytes;
@@ -242,7 +242,7 @@ pub(crate) fn check_repository<P: ProgressBars, S: Open>(
242242
opts: CheckOptions,
243243
trees: Vec<TreeId>,
244244
) -> RusticResult<Summary> {
245-
let summary = Arc::new(Mutex::new(Summary::new("check")));
245+
let summary = Summary::new("check").into_arc_mutex();
246246
let be = repo.dbe();
247247
let cache = repo.cache();
248248
let hot_be = &repo.be_hot;
@@ -459,7 +459,7 @@ fn check_cache_files(
459459
file_type: FileType,
460460
p: &impl Progress,
461461
) -> RusticResult<Option<Summary>> {
462-
let summary = Arc::new(Mutex::new(Summary::new("cache files").enable_log()));
462+
let summary = Summary::new("cache files").enable_log().into_arc_mutex();
463463
let files = cache.list_with_size(file_type)?;
464464

465465
if files.is_empty() {
@@ -744,7 +744,7 @@ fn check_trees(
744744
snap_trees: Vec<TreeId>,
745745
pb: &impl ProgressBars,
746746
) -> RusticResult<(BTreeSet<PackId>, Summary)> {
747-
let mut summary = Box::new(Summary::new("trees").enable_log());
747+
let mut summary = Summary::new("trees").enable_log().into_boxed();
748748
let mut packs = BTreeSet::new();
749749
let p = pb.progress_counter("checking trees...");
750750
let mut tree_streamer = TreeStreamerOnce::new(be, index, snap_trees, p)?;

0 commit comments

Comments
 (0)