mirror of https://github.com/astral-sh/ruff
Use or_default in lieu of or_insert
This commit is contained in:
parent
4645788205
commit
25e476639f
|
|
@ -1698,7 +1698,7 @@ impl<'a> Checker<'a> {
|
||||||
context.defined_by,
|
context.defined_by,
|
||||||
context.defined_in,
|
context.defined_in,
|
||||||
))
|
))
|
||||||
.or_insert(vec![]);
|
.or_default();
|
||||||
full_names.push(full_name);
|
full_names.push(full_name);
|
||||||
}
|
}
|
||||||
BindingKind::Importation(full_name, context)
|
BindingKind::Importation(full_name, context)
|
||||||
|
|
@ -1709,7 +1709,7 @@ impl<'a> Checker<'a> {
|
||||||
context.defined_by,
|
context.defined_by,
|
||||||
context.defined_in,
|
context.defined_in,
|
||||||
))
|
))
|
||||||
.or_insert(vec![]);
|
.or_default();
|
||||||
full_names.push(full_name);
|
full_names.push(full_name);
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
|
|
|
||||||
|
|
@ -104,9 +104,7 @@ fn add_noqa_inner(
|
||||||
.unwrap_or(lineno);
|
.unwrap_or(lineno);
|
||||||
|
|
||||||
if !codes.is_empty() {
|
if !codes.is_empty() {
|
||||||
let matches = matches_by_line
|
let matches = matches_by_line.entry(noqa_lineno).or_default();
|
||||||
.entry(noqa_lineno)
|
|
||||||
.or_insert_with(BTreeSet::new);
|
|
||||||
matches.append(&mut codes);
|
matches.append(&mut codes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue