-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
clippy_restriction
and clippy_deprecated
not listed in README
#2964
Comments
See #2897 for related discussion. |
You should only enable specific lints in restriction that meet your particular situation or preferences. Enabling the whole group makes no sense as some lints in restriction contradict other lints. Also many of them promote code that is plain unidiomatic. Basically the restriction group is opt-in on per-lint basis IMO. |
@mikerite, I see what you’re trying to say. I do not fully agree with your ideas though. First of all, whatever the reasoning to not include As for contradictions, there’s only one mentioned in the PR discussion and that isn’t a contradiction, just one suggestion that could be conflicting with another lint’s. Does |
I agree with you that those categories should be documented in the README. I was just explaining why the restriction lints are not included in pedantic.
I'm not sure about that. I know some the lints involving shadowing where moved from pedantic to restriction because some shadowing is considered idiomatic - see #2322. |
Just from the common meaning of the word, ‘pedantic’ signals the highest possible level of strictness, beyond concerns such as idiomaticness. Now of course there’s some historical influence from e.g. |
Just going to point out that pragmatically, I just wasted 30 minutes trying to figure out why a lint wasn't triggering even though I did Philosophically, using the word all to mean anything other than all, is beyond incomprehensible. Using |
You should _never_ be turning on all restriction lints, or even some of
them really, they're for very tightly scoped use only. It's easier to
consider these to not be lints in the usual sense, they don't actually tell
you things for improving your code, they're additional checks that may be
useful for specific situations.
The deprecated lints do nothing anyway, they exist so that people don't get
unknown lint warnings.
Nursery lints aren't ready yet.
Pedantic lints _could_ be included, but they're really annoying when taken
as a group and usually should be picked individually. C++ has precedent for
this with -Wall -Wpedantic
clippy::all is "all lints that are on by default".
Changing clippy::all to include nursery and restriction lints is a
non-starter. Making it include pedantic lints is something that could be
discussed, but I'm leaning on the side of not having that, especially for
the sake of non-power-users.
We should definitely document this better.
(We can also deprecate it in favor of clippy::recommended but that has more
discoverability issues)
…On Fri, Feb 22, 2019, 11:54 AM Ahmed Charles ***@***.***> wrote:
Just going to point out that pragmatically, I just wasted 30 minutes
trying to figure out why a lint wasn't triggering even though I did
#![deny(clippy::all)] and continued to not trigger after
#![deny(clippy::pedantic)] was added. That's when I found this issue.
Adding one line to the README doesn't seem like an undue burden.
Philosophically, using the word all to mean anything other than all, is
beyond incomprehensible. Using clippy::recommended would be significantly
more understandable, whether or not clippy::all exists or not. But if it
exists, it should do what it says and enable all lints.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#2964 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABivSOmD_lxMch2gLgNTuLUfP3T_xkIQks5vP40ygaJpZM4VhcUC>
.
|
Two completely separate/orthogonal things:
As for the C++ precedent, I reject that notion. MSVC has -Wall and it actually means what normal English speakers would expect. GCC's reluctance to break people who used it incorrectly (and clang's bug-for-bug compatibility with GCC in this regard), shouldn't be taken as reasonable precedent. Many of Rust's design choices deviate from C++, for good reason. |
As somewhat of an aside, in all of my projects, I explicitly enable every lint in rustc (not clippy). There isn't a way to turn on all lints as a group. So, instead, every time I run |
Actually, no, this isn't incorrect, "all" is always "all of some category", if I say "give me all of them" when buying apples, I'm asking for all the apples in front of me, I'm not asking for all the apples in the universe. Language is nuanced. The mental model we wish to present is: Clippy is a bunch of lints. They are on by default, and you can tweak this with You're right that this is a bit confusing, and in retrospect we should have chosen something else that was less ambiguous. It's much harder to change now. We did have a bit of a discussion about this when picking the name and
This is not a first-class use case of clippy, however. This use case is still supported -- use the lint groups provided -- however I'm not going to support changes that favor this use case at the expense of the main use case. I have already opened a pull request to clarify the documentation that would have solved your initial issue |
If we can come up with a good, discoverable name for clippy::all we could have a deprecation process moving it over. We'd still have to support it meaning the same thing, however we can stop documenting it and warn when people use it that way. |
A more correct alternative for 'all' would be 'most'. It's very simple. |
It's not, that's not something very discoverable, nor does it convey useful information. It is more correct, but it isn't more useful. |
I'm not sure how much the discoverability of all actually matters. If you're using clippy in a scenario that requires discovering Note, the category of |
@Manishearth: whether 'all' is more discoverable than 'most' is of little importance, as @ahmedcharles just explained. Simply put, nobody is going to want to use Clippy without reading any of the very brief documentation in the README. Indeed the README acknowledges this by giving very specific instructions about how to configure Clippy. Clippy isn't an autodiscoverable tool and learning how to get started with it takes just 5 minutes, or at least it should. 'All' conveys as much useful information as 'most', with the difference that the former is plainly wrong and the second isn't. Every programmer needs to read in the README what 'all' means just as he/she would have to for 'most'. Using wrong names is misleading. Many software projects do want to catch any and all potential issues and add exceptions locally, the value judgments on this issue tracker I've seen about e.g. |
I'm using "discoverability" in a broader sense here. The ability to:
"most" and "recommended" don't satisfy either. "all" doesn't quite satisfy the first but I'm okay with it for reasons already stated
You're correct, except it impacts them in the way we want it to, The "all" lints are the ones we want people to think of as the main clippy lints; these are all the lints we properly support. The rest of the lints are less supported for various reasons; e.g. the pedantic lints are too pedantic to be something we recommend, and similarly the nursery lints are too new and broken. Power users can go and enable them if they want, but this isn't a normal feature. The number one use case of You're correct in noting that there's a semantic discrepancy here, however it's semi-intentional; and usability trumps semantic correctness for us.
Plenty of folks will learn to use it from looking at other code. And this argument is equally valid for people who want to use the extra lints in clippy, the readme clearly states what's going on there. It didn't before, which is why this issue exists, but I clarified that. |
Turning every instance of So, the position that |
It does not, Overall the benefit of semantic correctness here is slight, and |
Since I was the one who pushed the First of here is the short discussion about the naming: rust-lang/rust#44690 (comment) @Manishearth suggested to name it That's why I did go for The thought behind that was, that new users (that don't really want to read the documentation) can just write That being said... In retrospect I would go with @mikerite and agree that |
@flip1995: |
This isn't a matter of perception, but a matter of what interface we choose to expose first and foremost, and what interface we wish to signal support for. We totally understand that some people want all the pedantic lints too, but that is not the default interface we expose. We still expose everything they need. |
These categories aren’t listed in the current README. Also, I found that
clippy_pedantic
does not includeclippy_restriction
. The README assertsclippy_pedantic
covers ‘everything’.The text was updated successfully, but these errors were encountered: