Skip to content

Commit 1cc8c4d

Browse files
committed
Use Option::get_or_default
1 parent 7e3ebe7 commit 1cc8c4d

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

compiler/rustc_mir/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Rust MIR: a lowered representation of Rust.
2525
#![feature(stmt_expr_attributes)]
2626
#![feature(trait_alias)]
2727
#![feature(option_expect_none)]
28+
#![feature(option_get_or_default)]
2829
#![feature(or_patterns)]
2930
#![feature(once_cell)]
3031
#![feature(control_flow_enum)]

compiler/rustc_mir/src/transform/coverage/graph.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -392,10 +392,7 @@ impl BasicCoverageBlockData {
392392
}
393393
}
394394
let operand = counter_kind.as_operand_id();
395-
if let Some(replaced) = self
396-
.edge_from_bcbs
397-
.get_or_insert_with(FxHashMap::default)
398-
.insert(from_bcb, counter_kind)
395+
if let Some(replaced) = self.edge_from_bcbs.get_or_default().insert(from_bcb, counter_kind)
399396
{
400397
Error::from_string(format!(
401398
"attempt to set an edge counter more than once; from_bcb: \

0 commit comments

Comments
 (0)