Use Option::get_or_default

This commit is contained in:
Cameron Steffen 2021-03-06 16:40:45 -06:00
parent 7e3ebe76ee
commit 1cc8c4de6a
2 changed files with 2 additions and 4 deletions

View File

@ -25,6 +25,7 @@
#![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)]

View File

@ -392,10 +392,7 @@ pub fn set_edge_counter_from(
}
}
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: \