Skip to content

Commit 32674b3

Browse files
committed
Avoid false positive unused import warnings.
1 parent 86995dc commit 32674b3

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/librustc_resolve/lib.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1276,16 +1276,17 @@ impl<'a> Resolver<'a> {
12761276
self.used_crates.insert(krate);
12771277
}
12781278

1279-
if let NameBindingKind::Import { directive, .. } = binding.kind {
1280-
self.used_imports.insert((directive.id, ns));
1281-
self.add_to_glob_map(directive.id, name);
1282-
}
1283-
12841279
if binding.ambiguity().is_some() {
12851280
self.ambiguity_errors.push((span, name, binding));
12861281
return true;
12871282
}
12881283

1284+
if let NameBindingKind::Import { directive, binding } = binding.kind {
1285+
self.used_imports.insert((directive.id, ns));
1286+
self.add_to_glob_map(directive.id, name);
1287+
self.record_use(name, ns, binding, span);
1288+
}
1289+
12891290
false
12901291
}
12911292

0 commit comments

Comments
 (0)