Use or_default in lieu of or_insert

This commit is contained in:
Charlie Marsh 2022-10-07 14:56:56 -04:00
parent 4645788205
commit 25e476639f
2 changed files with 3 additions and 5 deletions

View File

@ -1698,7 +1698,7 @@ impl<'a> Checker<'a> {
context.defined_by,
context.defined_in,
))
.or_insert(vec![]);
.or_default();
full_names.push(full_name);
}
BindingKind::Importation(full_name, context)
@ -1709,7 +1709,7 @@ impl<'a> Checker<'a> {
context.defined_by,
context.defined_in,
))
.or_insert(vec![]);
.or_default();
full_names.push(full_name);
}
_ => {}

View File

@ -104,9 +104,7 @@ fn add_noqa_inner(
.unwrap_or(lineno);
if !codes.is_empty() {
let matches = matches_by_line
.entry(noqa_lineno)
.or_insert_with(BTreeSet::new);
let matches = matches_by_line.entry(noqa_lineno).or_default();
matches.append(&mut codes);
}
}