-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Clippy attributes have no effect on struct fields #60681
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
A-attributes
Area: Attributes (`#[…]`, `#![…]`)
A-lints
Area: Lints (warnings about flaws in source code) such as unused_mut.
C-bug
Category: This is a bug.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Comments
cc @oli-obk |
This is not a clippy issue: struct MyTest {
a: &'static [u64],
}
fn main() -> Result<(), ()> {
let b = MyTest {
#[allow(const_err)]
a: &[0 - 1],
};
Ok(())
} |
Ran into this with #![deny(warnings)]
struct Foo {
#[deprecated]
deprecated: usize,
}
fn main() {
let foo = Foo {
#[allow(deprecated)]
deprecated: 1,
};
println!("{}", foo.deprecated)
}
Notably putting the |
This issue is still present. How things currently work: #![deny(warnings)]
struct Foo {
#[deprecated]
deprecated: usize,
}
fn main() {
#[allow(deprecated)]
let foo = Foo {deprecated: 1};
#[allow(deprecated)]
let tmp = foo.deprecated;
println!("{}", tmp);
} How we would like things to work: #![deny(warnings)]
struct Foo {
#[deprecated]
deprecated: usize,
}
fn main() {
let foo = Foo {
#[allow(deprecated)]
deprecated: 1
};
#[allow(deprecated)]
let tmp = foo.deprecated;
println!("{}", tmp);
} |
Stil a problem today: struct Test {
#[allow(non_snake_case)] // <-- this does nothing
#[allow(dead_code)] // <-- while this works
aB: u128,
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-attributes
Area: Attributes (`#[…]`, `#![…]`)
A-lints
Area: Lints (warnings about flaws in source code) such as unused_mut.
C-bug
Category: This is a bug.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Example:
The #[allow] directive must be placed on the variable assignment to have an effect - where it is now does not seem to cover the field value.
Searched a little bit, but wasn't sure if this goes with any existing issues (not sure if this would be #53012 since I don't think clippy attributes are procedural)
The text was updated successfully, but these errors were encountered: