4 ms·
> Through it should be noted, that all "important" lints are in rustc, clippy just provides more useful ones. This is expressed pretty nicely, thank you. I was
by Manishearth 10y ago
> Through it should be noted, that all "important" lints are in rustc, clippy just provides more useful ones.
This is expressed pretty nicely, thank you. I was struggling to express this in my other comment. rustc has all the lints which:
- Everyone mostly agrees upon
- Have rare false positives
- Are of the kind you'd expect from a good compiler
It doesn't have 150 lints because 150 lints would be annoying, and would drown out the "important" lints. I work on clippy, and I find this distinction very useful. When rustc tells you to fix something, you fix it. Clippy lints help /inform/, and you may ignore them often. But you don't always need to listen to clippy. If I wrote a bot that fixed all rustc warnings I'm sure people would be fine with just blindly running it. I cannot say the same about clippy (not because of bugs), and that's a good thing.
- cpeterso 10y agoHave any lints prototyped in clippy been adopted by rustc?
- Manishearth 10y agoThis was initially the goal of clippy; but rustc has a policy of "no new lints", partially because clippy exists :) The plan instead is to polish clippy and distribute it via rustup.
- steveklabnik 10y agoIt's "no new lints without an RFC." Some believe that this is equivalent to "no new lints", but the door isn't actually totally shut.
- Manishearth 10y agoPractically, it pretty much is. Yes, you can add new lints with an RfC. However, the bar for inclusion is very high. I'm totally okay with the status quo, but I very much disagree that there is scope for uplifting lints to rustc from clippy with the current policies.
- cpeterso 10y agoWe've come full circle: C lint was created as a standalone program because C compilers were just about compiling code. :) On one hand, I see how it is annoying when a compiler complains about code patterns that are not worth errors and could be false positives. OTOH, I feel like a language designed for safety should try to warn about as many bugs as possible. Would any of clippy's lints pass every Rust crate tested on Crater? Maybe those could be come rustc errors. For fun: Lint, a C Program Checker (1977) http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.56.1841 The separation of function between lint and the C compilers has both historical and practical rationale. The compilers turn C programs into executable files rapidly and efficiently. This is possible in part because the compilers do not do sophisticated type checking, especially between separately compiled programs. Lint takes a more global, leisurely view of the program, looking much more carefully at the compatibilities.
- Manishearth 10y ago> Would any of clippy's lints pass every Rust crate tested on Crater? lolnope Well, there are lint-checking-lints, and there are very few linters out there, and clippy passes clippy, so those would pass. A couple other obscure lints that check for things that in practice never happen. Too obscure to be included in rustc I guess. IMO a lint passing all of crater is a very good reason for it to not be included in rustc.