Filter prelude glob imports

This commit is contained in:
flip1995 2020-02-09 12:23:13 +01:00
parent 06a6189376
commit f4f781d5cf
No known key found for this signature in database
GPG Key ID: 693086869D506637

View File

@ -76,6 +76,8 @@ fn check_item(&mut self, cx: &LateContext<'_, '_>, item: &Item<'_>) {
if_chain! {
if !in_macro(item.span);
if let ItemKind::Use(use_path, UseKind::Glob) = &item.kind;
// don't lint prelude glob imports
if !use_path.segments.iter().last().map_or(false, |ps| ps.ident.as_str() == "prelude");
let used_imports = cx.tcx.names_imported_by_glob_use(item.hir_id.owner_def_id());
if !used_imports.is_empty(); // Already handled by `unused_imports`
then {