-
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
Replace #[allow]
with #[expect]
in Clippy
#8797
Conversation
Also, just to make sure @bors try |
Replace `#[allow]` with `#[expect]` in Clippy Hey `@rust-lang/clippy,` `@Alexendoo,` `@dswij,` I'm currently working on the expect attribute as defined in [Rust RFC 2383](https://rust-lang.github.io/rfcs/2383-lint-reasons.html). With that, an `#[allow]` attribute can be replaced with a `#[expect]` attribute that suppresses the lint, but also emits a warning, if the lint isn't emitted in the expected scope. With this PR I would like to test the attribute on a project scale and Clippy obviously came to mind. This PR replaces (almost) all `#[allow]` attributes in `clippy_utils` and `clippy_lints` with the `#[expect]` attribute. I was also able to remove some allows since, the related FPs have been fixed 🎉. My question is now, are there any concerns regarding this? It's still okay to add normal `#[allow]` attributes, I see the need to nit-pick about that in new PRs, unless it's actually a FP. Also, I would not recommend using `#[expect]` in tests, as changes to a lint could the trigger the expect attribute in other files. Additionally, I've noticed that Clippy has a bunch of `#[allow(clippy::too_many_lines)]` attributes. Should we maybe allow the lint all together or increase the threshold setting? To me, it seems like we mostly just ignore it in our code. 😅 🙃 --- changelog: none r? `@flip1995` (I've requested you for now, since you're also helping with reviewing the expect implementation. You are welcome to delegate this PR, even if it should be a simple review 🙃 )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a good move. This will also give us tests for FPs and we won't miss fixes to them anymore as in the write.rs
file.
Let's wait if other people have concerns. But I don't really see what would speak against this.
Regarding the If this is added in a new PR, we might want to see what we can do to simplify/split up the function. |
☀️ Try build successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
66b5c71
to
03960eb
Compare
I forgot to add the expect changes in |
I think we should do this 👍 |
Unrelated to the PR itself, but relevant for clippy. What happens to |
Interesting question, the |
It looks there are no concerns so far. @flip1995, I've pushed an update with the expects for |
@bors r+ Thanks! |
📌 Commit 03960eb has been approved by |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
Hey @rust-lang/clippy, @Alexendoo, @dswij, I'm currently working on the expect attribute as defined in Rust RFC 2383. With that, an
#[allow]
attribute can be replaced with a#[expect]
attribute that suppresses the lint, but also emits a warning, if the lint isn't emitted in the expected scope.With this PR I would like to test the attribute on a project scale and Clippy obviously came to mind. This PR replaces (almost) all
#[allow]
attributes inclippy_utils
andclippy_lints
with the#[expect]
attribute. I was also able to remove some allows since, the related FPs have been fixed 🎉.My question is now, are there any concerns regarding this? It's still okay to add normal
#[allow]
attributes, I see the need to nit-pick about that in new PRs, unless it's actually a FP. Also, I would not recommend using#[expect]
in tests, as changes to a lint could the trigger the expect attribute in other files.Additionally, I've noticed that Clippy has a bunch of
#[allow(clippy::too_many_lines)]
attributes. Should we maybe allow the lint all together or increase the threshold setting? To me, it seems like we mostly just ignore it in our code. 😅 🙃changelog: none
r? @flip1995 (I've requested you for now, since you're also helping with reviewing the expect implementation. You are welcome to delegate this PR, even if it should be a simple review 🙃 )