From e9b840e485cfc0a6bc2b80ff44e7250a6dc6670a Mon Sep 17 00:00:00 2001 From: Vincent Lafeychine <vincent.lafeychine@proton.me> Date: Sat, 27 Apr 2024 02:43:35 +0200 Subject: [PATCH] clippy: Fix unwrap_or_default --- rr_frontend/.cargo/config.toml | 1 - rr_frontend/translation/src/environment/loops.rs | 2 +- rr_frontend/translation/src/environment/polonius_info.rs | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/rr_frontend/.cargo/config.toml b/rr_frontend/.cargo/config.toml index c4f408c2..90f3c3d6 100644 --- a/rr_frontend/.cargo/config.toml +++ b/rr_frontend/.cargo/config.toml @@ -81,7 +81,6 @@ rustflags = [ # clippy::style "-Aclippy::new_without_default", - "-Aclippy::unwrap_or_default", "-Aclippy::write_with_newline", # clippy::suspicious diff --git a/rr_frontend/translation/src/environment/loops.rs b/rr_frontend/translation/src/environment/loops.rs index 75654faf..19c44213 100644 --- a/rr_frontend/translation/src/environment/loops.rs +++ b/rr_frontend/translation/src/environment/loops.rs @@ -250,7 +250,7 @@ impl ProcedureLoops { let mut enclosing_loop_heads_set: HashMap<BasicBlockIndex, HashSet<BasicBlockIndex>> = HashMap::new(); for (&loop_head, loop_body) in &loop_bodies { for &block in loop_body { - let heads_set = enclosing_loop_heads_set.entry(block).or_insert_with(HashSet::new); + let heads_set = enclosing_loop_heads_set.entry(block).or_default(); heads_set.insert(loop_head); } } diff --git a/rr_frontend/translation/src/environment/polonius_info.rs b/rr_frontend/translation/src/environment/polonius_info.rs index b2c6cc97..76e936ed 100644 --- a/rr_frontend/translation/src/environment/polonius_info.rs +++ b/rr_frontend/translation/src/environment/polonius_info.rs @@ -795,7 +795,7 @@ impl<'a, 'tcx: 'a> PoloniusInfo<'a, 'tcx> { let mut new_map: BTreeMap<facts::Region, BTreeSet<facts::Region>> = BTreeMap::new(); for (&r1, set) in map { for &r2 in set { - new_map.entry(r2).or_insert_with(BTreeSet::new); + new_map.entry(r2).or_default(); let new_set = new_map.get_mut(&r2).unwrap(); new_set.insert(r1); -- GitLab