Skip to content

Commit 6f09dea

Browse files
committed
Fix suggestions
1 parent 3d9db59 commit 6f09dea

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/librustc_resolve/resolve_imports.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -537,8 +537,14 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
537537
match (&value_result, &type_result) {
538538
(&Indeterminate, _) | (_, &Indeterminate) => return Indeterminate,
539539
(&Failed(_), &Failed(_)) => {
540-
let children = target_module.resolutions.borrow();
541-
let names = children.keys().map(|&(ref name, _)| name);
540+
let resolutions = target_module.resolutions.borrow();
541+
let names = resolutions.iter().filter_map(|(&(ref name, _), resolution)| {
542+
match *resolution.borrow() {
543+
NameResolution { binding: Some(_), .. } => Some(name),
544+
NameResolution { single_imports: SingleImports::None, .. } => None,
545+
_ => Some(name),
546+
}
547+
});
542548
let lev_suggestion = match find_best_match_for_name(names, &source.as_str(), None) {
543549
Some(name) => format!(". Did you mean to use `{}`?", name),
544550
None => "".to_owned(),

0 commit comments

Comments
 (0)