Skip to content

New lint: using #[macro_use] instead of a use statement #5179

@Aaron1011

Description

@Aaron1011

In the Rust 2018 edition, you can directly import exported macros via a normal use statement, instead of using the blanket #[macro_use] attribute. This makes it clear exactly which items you are importing, and avoids the need to use extern crate.

As far as I know, there are no cases where #[macro_use] works but use some_crate::some_macro doesn't.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintArea: New lintsE-hardCall for participation: This a hard problem and requires more experience or effort to work onL-suggestionLint: Improving, adding or fixing lint suggestionsT-macrosType: Issues with macros and macro expansiongood first issueThese issues are a good way to get started with Clippy

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions