pub static MACRO_USE_EXTERN_CRATE: &'static Lint
Expand description

The macro_use_extern_crate lint detects the use of the macro_use attribute.



extern crate serde_json;

fn main() {
    let _ = json!{{}};

This will produce:

error: deprecated `#[macro_use]` attribute used to import macros should be replaced at use sites with a `use` item to import the macro instead
 --> src/
3 | #[macro_use]
  | ^^^^^^^^^^^^
note: the lint level is defined here
 --> src/
1 | #![deny(macro_use_extern_crate)]
  |         ^^^^^^^^^^^^^^^^^^^^^^


The macro_use attribute on an [extern crate] item causes macros in that external crate to be brought into the prelude of the crate, making the macros in scope everywhere. As part of the efforts to simplify handling of dependencies in the [2018 edition], the use of extern crate is being phased out. To bring macros from extern crates into scope, it is recommended to use a use import.

This lint is “allow” by default because this is a stylistic choice that has not been settled, see issue #52043 for more information.