-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Open
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.C-bugCategory: This is a bug.Category: This is a bug.I-needs-decisionIssue: In need of a decision.Issue: In need of a decision.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
A constant with #[allow(non_upper_case_globals)] applied still generates a warning when used in a pattern, unless the match also has the allow attribute. For example:
#[allow(non_upper_case_globals)]
mod keywords {
pub const If: u32 = 0;
pub const While: u32 = 1;
}
fn main() {
use keywords::*;
// the warning goes away with this attribute:
// #[allow(non_upper_case_globals)]
match 0 {
keywords::If => println!("if"),
While => println!("while"),
_ => println!("<unknown>"),
}
}valpackett, DonRyuDragoni, vpzomtrrfrt, dcsommer, LastLightSith and 14 more
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.C-bugCategory: This is a bug.Category: This is a bug.I-needs-decisionIssue: In need of a decision.Issue: In need of a decision.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.