mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
Filter prelude glob imports
This commit is contained in:
parent
06a6189376
commit
f4f781d5cf
@ -76,6 +76,8 @@ impl LateLintPass<'_, '_> for WildcardImports {
|
||||
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 {
|
||||
|
Loading…
Reference in New Issue
Block a user