mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 06:44:35 +00:00
Use for_each_child
in a suitable place.
`for_each_child` exists for this exact pattern.
This commit is contained in:
parent
d1d8be1d13
commit
d34f2823fd
@ -535,14 +535,12 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
|
||||
filter_fn: &impl Fn(Res) -> bool,
|
||||
ctxt: Option<SyntaxContext>,
|
||||
) {
|
||||
for (key, resolution) in self.resolutions(module).borrow().iter() {
|
||||
if let Some(binding) = resolution.borrow().binding {
|
||||
let res = binding.res();
|
||||
if filter_fn(res) && ctxt.map_or(true, |ctxt| ctxt == key.ident.span.ctxt()) {
|
||||
names.push(TypoSuggestion::typo_from_ident(key.ident, res));
|
||||
}
|
||||
module.for_each_child(self, |_this, ident, _ns, binding| {
|
||||
let res = binding.res();
|
||||
if filter_fn(res) && ctxt.map_or(true, |ctxt| ctxt == ident.span.ctxt()) {
|
||||
names.push(TypoSuggestion::typo_from_ident(ident, res));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// Combines an error with provided span and emits it.
|
||||
|
Loading…
Reference in New Issue
Block a user