From 5889c1298dd062a94482451bd3c989f1aec67db6 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Mon, 30 Aug 2021 12:16:44 +0200 Subject: Fix clippy: Use or_insert_with() for less runtime cost Signed-off-by: Matthias Beyer --- src/repository/fs/representation.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/repository/fs/representation.rs b/src/repository/fs/representation.rs index 991d791..6a57a38 100644 --- a/src/repository/fs/representation.rs +++ b/src/repository/fs/representation.rs @@ -87,7 +87,7 @@ impl FileSystemRepresentation { }, dir @ PathComponent::DirName(_) => { curr_hm.entry(dir.clone()) - .or_insert(Element::Dir(HashMap::new())); + .or_insert_with(|| Element::Dir(HashMap::new())); curr_hm = curr_hm.get_mut(&dir) .unwrap() // safe, because we just inserted it -- cgit v1.2.3