Skip to content

Commit

Permalink
Tweak a resolutions loop.
Browse files Browse the repository at this point in the history
In this case field access is more concise and easier to read than
destructuring, and it matches how other similar loops are done
elsewhere.
  • Loading branch information
nnethercote committed Nov 14, 2024
1 parent 93f2258 commit d1d8be1
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions compiler/rustc_resolve/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1809,12 +1809,11 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
assoc_item: Option<(Symbol, Namespace)>,
) -> bool {
match (trait_module, assoc_item) {
(Some(trait_module), Some((name, ns))) => {
self.resolutions(trait_module).borrow().iter().any(|resolution| {
let (&BindingKey { ident: assoc_ident, ns: assoc_ns, .. }, _) = resolution;
assoc_ns == ns && assoc_ident.name == name
})
}
(Some(trait_module), Some((name, ns))) => self
.resolutions(trait_module)
.borrow()
.iter()
.any(|(key, _name_resolution)| key.ns == ns && key.ident.name == name),
_ => true,
}
}
Expand Down

0 comments on commit d1d8be1

Please sign in to comment.