-
Notifications
You must be signed in to change notification settings - Fork 375
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
anti pattern: #![deny(warnings)] #46
Comments
@llogiq: Hear me Rust bard, I can't help but be very criticial of this guideline. Let me explain why.
Rust's stability is rather mythical at this point. Only the syntax and standard library API are stable, and only on a best effort basis. There have been numerous breaking changes. That can be good, as Rust is still a young project. In the future, the Rust epochs system will be the principled solution to managing backward compatibility. At present, if there is any reason to not forbid all warnings during a build given
This grace period is a courtesy from those responsible for the change to the affected. It is not an obligation of the affected themselves to adhere to that grace period. With this guideline, you imply that those affected by breaking changes to lint checking should not enforce the changed lint checking logic. But they normally want to. There's a reason they started out with The proper way to prevent broken builds due to dependencies with strict linting is to apply
That should be elaborated. Moreover, the downsides of the alternative solutions need to be pointed out as well. Changing command line parameters to opt in to strict lint checking doesn't really solve the problem of forward compatibility. After all, when and where should these command line parameters be set then? If during CI, then the build will break still after a breaking change to lint checks. Explicitly listing numerous lints in the source code is not scalable across many crates. Furthermore, it results in another kind of forward incompatibility risk, other than breakage: risk of not keeping current with new lints. Lints are added for a reason, they address real world quality issues. Grace periods are only a compromise in the interest of keeping things going without maintenance, but it is certainly preferable to aggressively perform all lint checks available and address the results head-on. |
In my rust2018 post, I propose using Epochs on warnings groups. I'm going to be posting on the epoch issue to find out the right venue for discussion. |
from: https://github.com/rust-unofficial/patterns/blob/master/anti_patterns/deny-warnings.md#drawbacks Is that still true? it doesn't seem to be, or I don't know what they meant, but I've only tested this example: #![deny(clippy::pedantic, clippy::all, clippy::correctness, clippy::nursery)]
//^ no effect on: unreachable_patterns
#![deny(warnings)]
//^ this works!
fn main() {
let num = Some(4);
match num {
Some(x) if x < 5 => println!("less than five: {}", x),
Some(x) => println!("{}", x),
None => (),
}
match num {
Some(x) => println!("{}", x),
Some(x) if x < 5 => println!("less than five: {}", x), // warning: unreachable pattern
None => (),
}
} |
I think the "additional lints" refer to the possibility of the new lints breaking compilation. WRT whether it is an anti-pattern… Being an ex-packager and seeing all the packages broken due to a well-intentioned |
Through my work with clippy, I've probably had more exposure to the negative consequences than others, so I'm going to write up something in the next few days.
The text was updated successfully, but these errors were encountered: