-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Labels
A-lintArea: New lintsArea: New lintsT-macrosType: Issues with macros and macro expansionType: Issues with macros and macro expansion
Description
What it does
Lint any instances of paths to items or use statements which do not use $crate
or global paths (such as ::std::vec::Vec
)
Lint Name
macro_use_path
Category
correctness
Advantage
- Since imports and paths in macros are unhygienic, you should use
$crate
or global paths. - This will make macros used by other crates less likely to fail to compile.
Drawbacks
- Internal macros may wish to avoid this requirement
Example
pub trait Delegate {}
#[macro_export]
macro_rules! impl_delegate {
($ty: ty) => {
impl Delegate for $ty {}
}
}
Could be written as:
pub trait Delegate {}
#[macro_export]
macro_rules! impl_delegate {
impl $crate::Delegate for $ty {}
}
Metadata
Metadata
Assignees
Labels
A-lintArea: New lintsArea: New lintsT-macrosType: Issues with macros and macro expansionType: Issues with macros and macro expansion