-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Closed
Copy link
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Description
Right now, the allow/warn/deny/forbid attributes can only be applied to entire modules.
It would be nice to be able to apply the attributes to individual use
declarations, to be able to say, e.g., "I know that this particular import is not currently used in the module, and I do not want to be warned about it; but I do not want to turn off warnings for other imports in the module."
Concrete example:
mod a { pub static x: int = 3; pub static y: int = 4; }
mod b {
use a::x; // I want to be warned about this one ...
#[allow(unused_imports)]
use a::y; // ... but not about this one.
}
mod c {
#[allow(unused_imports)];
use a::x; // Insufficient because I get no warning about `x` here.
use a::y;
}
fn main() {}
(Also, the fact that the syntax is currently accepted when applied to individual use
declarations, as above, but seems to be a no-op, is probably also suboptimal. But of course, I would fix the problem by making it have an effect, as described by this ticket.)
Metadata
Metadata
Assignees
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.