std_wildcard_imports
to lint against use std::mod::*
#13961
Labels
A-lint
Area: New lints
E-help-wanted
Call for participation: Help is requested to fix this issue.
good first issue
These issues are a good way to get started with Clippy
Uh oh!
There was an error while loading. Please reload this page.
What it does
This is a version of
wildcard_imports
that affects only imports from the standard cratesstd
,core
,proc_macro
,alloc
, andtest
.Advantage
wildcard_imports
is in pedantic, which seems reasonable for most crates. However, using glob imports from the standard library means that upgrading Rust version can break the build. Recent examples:proc_macro_totokens
rust#134707Entry
is ambiguous rust#134714Sign
is ambiguous rust#135672I am proposing
std_wildcard_imports
as a separate lint fromwildcard_imports
so it can get enabled by default, likely inclippy::style
(or possibly uplifted rust-lang/rust#135672 (comment))Drawbacks
Confusion between
wildcard_imports
andstd_wildcard_imports
, noise on existing code, sometimesuse proc_macro::*
or similar is fine for testing.Example
Lint on glob imports:
However, using glob imports from prelude modules should not raise this warning:
Non-
std
crates don't raise this lintThe text was updated successfully, but these errors were encountered: