rust-unofficial / patterns

A catalogue of Rust design patterns, anti-patterns and idioms
https://rust-unofficial.github.io/patterns/
Mozilla Public License 2.0
8.11k stars 375 forks source link

More clear list of what lint warning are future/dependent safe to deny and which are not #72

Closed behnam closed 6 years ago

behnam commented 6 years ago

Looks like we have to main source for lint attributes and warnings/errors:

In neither of these resources there's coverage for which of this these lint rules can get triggered depending on a compiler version, and which ones don't.

For example, unsafe-code cannot suddenly get triggered by a compiler update.

But, missing-docs, on the other hand, can get triggered whenever compiler supports docs for new language items.

I think not distinguishing these two types of lints is a common cause for denying/forbidding risky lints on the code.

Maybe there could be a Lint Group for these? Or some other way to tell them apart?

FraGag commented 6 years ago

Classifying each lint can be difficult and error-prone, because there's always the possibility that a lint is buggy and doesn't catch all the cases it's supposed to catch. For example, consider the unused_mut lint. How would you classify this lint? One could reasonably classify it as "cannot suddenly get triggered by a compiler update", because updates to the language shouldn't cause a mutable variable to suddenly become not mutated, right?

Now, if I told you that in Rust 1.21, there was a fix to the lint that made it report mut variables that were &mut references but weren't mutated themselves, does your classification still hold? (I had a case in my own code where I got an unused_mut lint warning for this reason after updating the compiler.)

behnam commented 6 years ago

Yeah, agreed that no lint warning can promised to not be triggered in some future. I guess we can close this issue now. Please feel free to re-open if there's any way to apply a classification.