From 1cc8c4de6aa0549a3d7d1da23ba48d34d0efd7bf Mon Sep 17 00:00:00 2001 From: Cameron Steffen Date: Sat, 6 Mar 2021 16:40:45 -0600 Subject: [PATCH] Use Option::get_or_default --- compiler/rustc_mir/src/lib.rs | 1 + compiler/rustc_mir/src/transform/coverage/graph.rs | 5 +---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/compiler/rustc_mir/src/lib.rs b/compiler/rustc_mir/src/lib.rs index 508510a81e1fb..bbfcec5a76a43 100644 --- a/compiler/rustc_mir/src/lib.rs +++ b/compiler/rustc_mir/src/lib.rs @@ -25,6 +25,7 @@ Rust MIR: a lowered representation of Rust. #![feature(stmt_expr_attributes)] #![feature(trait_alias)] #![feature(option_expect_none)] +#![feature(option_get_or_default)] #![feature(or_patterns)] #![feature(once_cell)] #![feature(control_flow_enum)] diff --git a/compiler/rustc_mir/src/transform/coverage/graph.rs b/compiler/rustc_mir/src/transform/coverage/graph.rs index e58b915f1264c..8ad0d133b17e1 100644 --- a/compiler/rustc_mir/src/transform/coverage/graph.rs +++ b/compiler/rustc_mir/src/transform/coverage/graph.rs @@ -392,10 +392,7 @@ impl BasicCoverageBlockData { } } let operand = counter_kind.as_operand_id(); - if let Some(replaced) = self - .edge_from_bcbs - .get_or_insert_with(FxHashMap::default) - .insert(from_bcb, counter_kind) + if let Some(replaced) = self.edge_from_bcbs.get_or_default().insert(from_bcb, counter_kind) { Error::from_string(format!( "attempt to set an edge counter more than once; from_bcb: \