-
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
Allow all unused
lints inside ui tests
#7611
Conversation
So what this PR does is to also allow those in the |
Yes 👍 |
Now that you're referencing the compiletest_rs code, I'm wondering if this should maybe be implemented there 🤔 |
The question is, if we apply a suggestion and it leads to an Currently the Not sure if this may lead to problems in testing suggestions or if I'm just overthinking this. 🤔 |
Yes, me too. Maybe as a config option for rust-fix tests. |
We have a bunch of files who allow unused lints inside
That might be an option, I'll look into it 🙃 |
Yeah, I think this would be a better approach. |
Do we maybe want to also limit the unused lints inside the normal ui tests? While testing, I noticed that we have some |
I don't think so. I really don't care about unused stuff in tests. |
Okay, I'll open an issue regarding unused lints in compiletest and look at implementing is there 🙃 |
Don't we ultimately want to be consistent with rustc tests? |
Yeah, the compiletest-rs crate should not deviate too much from the Rust compiletest. But I'm really unsure what the current state of both crates currently is. |
There is an issue for unifying compiletest-rs with the one from Rust. Manishearth/compiletest-rs#238 It only lists removing the dependency on |
The maintainers of the Rust compiletest don't want to move it out of the compiler for maintainability reasons. But we of course want it to be unified, because we would get all the great things that are implemented/fixed/... there. So we shouldn't change that much in compiletest-rs. One relevant question here: How many allows (an estimate is enough) are there for |
Understandable. I opened Manishearth/compiletest-rs#243 also asking if this should be implemented in the upstream version first
About 81 based on a quick search |
Clippy currently allows some unused lints inside UI tests, but not all of them during the compilation tests of the
.fixed
files. As a result, we often have attributes like#[allow(unused)]
... in our tests. This PR allows all lints inside theunused
group during Clippy's execution and the compilation test.Other lints are already allowed during this compilation, like
unused_imports
. I sadly couldn't find where they are allowed and by I'm guessing that they are allowed by default incompiletest_rs
. Therefore, I opted to pass theallow
flag to the compiler insidecompile-test.rs
.An example can be tested by removing
#[allow(dead_code, unused_assignments)]
from line 3 intests/ui/assign_ops.rs
on master (The compilation test fails) and then on this branch (cargo uitest
is happy). Reproduction:I thought about removing all the now unused
#[allow()]
attributes, but that resulted in changes to a lot of files with little benefit. If this is accepted, it might be worth to do this in a followup PR or so. 🙃changelog: none
r? @flip1995 I'm guessing that you have the most knowledge about this right now.
cc: @camsteffen since you've also worked a bit with compile test inside Clippy
Hope you're having a good day after reading this 🙃