mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +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,
|
filter_fn: &impl Fn(Res) -> bool,
|
||||||
ctxt: Option<SyntaxContext>,
|
ctxt: Option<SyntaxContext>,
|
||||||
) {
|
) {
|
||||||
for (key, resolution) in self.resolutions(module).borrow().iter() {
|
module.for_each_child(self, |_this, ident, _ns, binding| {
|
||||||
if let Some(binding) = resolution.borrow().binding {
|
let res = binding.res();
|
||||||
let res = binding.res();
|
if filter_fn(res) && ctxt.map_or(true, |ctxt| ctxt == ident.span.ctxt()) {
|
||||||
if filter_fn(res) && ctxt.map_or(true, |ctxt| ctxt == key.ident.span.ctxt()) {
|
names.push(TypoSuggestion::typo_from_ident(ident, res));
|
||||||
names.push(TypoSuggestion::typo_from_ident(key.ident, res));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Combines an error with provided span and emits it.
|
/// Combines an error with provided span and emits it.
|
||||||
|
Loading…
Reference in New Issue
Block a user