Static rustc_ap_rustc_lint_defs::builtin::UNUSED_EXTERN_CRATES [−][src]
pub static UNUSED_EXTERN_CRATES: &Lint
Expand description
The unused_extern_crates
lint guards against extern crate
items
that are never used.
Example
#![deny(unused_extern_crates)] extern crate proc_macro;
{{produces}}
Explanation
extern crate
items that are unused have no effect and should be
removed. Note that there are some cases where specifying an extern crate
is desired for the side effect of ensuring the given crate is
linked, even though it is not otherwise directly referenced. The lint
can be silenced by aliasing the crate to an underscore, such as
extern crate foo as _
. Also note that it is no longer idiomatic to
use extern crate
in the 2018 edition, as extern crates are now
automatically added in scope.
This lint is “allow” by default because it can be noisy, and produce
false-positives. If a dependency is being removed from a project, it
is recommended to remove it from the build configuration (such as
Cargo.toml
) to ensure stale build entries aren’t left behind.