Skip to content
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

Support -A, -W, -D and -F when running ./x.py clippy #97210

Merged
merged 1 commit into from
Jul 12, 2022
Merged

Support -A, -W, -D and -F when running ./x.py clippy #97210

merged 1 commit into from
Jul 12, 2022

Conversation

Milo123459
Copy link
Contributor

@Milo123459 Milo123459 commented May 20, 2022

Resolves #97059

This PR adds support for -A, -W, -D and -F when running ./x.py clippy.

@rust-highfive
Copy link
Collaborator

r? @Mark-Simulacrum

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 20, 2022
@rust-log-analyzer

This comment has been minimized.

src/bootstrap/flags.rs Outdated Show resolved Hide resolved
@Milo123459 Milo123459 marked this pull request as ready for review May 20, 2022 15:00
@jyn514
Copy link
Member

jyn514 commented May 20, 2022

Rather than special casing these 4 flags, I wonder if it instead makes sense to add --test-args (or I guess --run-args?) so that we can pass arbitrary flags to clippy / rustc.

I think RUSTFLAGS may already do this? although that breaks a lot of the caching ... I wonder if we should expose RUST_LINT_FLAGS to users.

@Milo123459
Copy link
Contributor Author

Maybe. Personally, I like having it work near the same as regular cargo, hence me making this PR.

@apiraino apiraino added the T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. label May 23, 2022
@Mark-Simulacrum
Copy link
Member

I am actually surprised to see cargo clippy supports passing these directly (cargo build/check/etc do not, today). I think I would prefer the route @jyn514 suggests here over us piping down arguments. The consistency argument is one I do not fully buy into, because we don't generally support every flag on any other Cargo command, and the full spectrum here does not seem significantly different.

In general given that Clippy is really only present in x.py for local usage and is not really intended to be well-supported beyond that, I prefer to keep its surface area quite minimal.

@Mark-Simulacrum Mark-Simulacrum added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 28, 2022
@jyn514
Copy link
Member

jyn514 commented May 28, 2022

I am actually surprised to see cargo clippy supports passing these directly (cargo build/check/etc do not, today).

@Mark-Simulacrum cargo-clippy is it's own binary distributed by clippy, it's not part of cargo itself. It has a few inconsistencies like this, another is that the sysroot detection is kind of hacky and occasionally needs help from bootstrap.

@Mark-Simulacrum
Copy link
Member

Yeah, I'm aware. I don't think that changes the rest of my perspectives though.

@JohnCSimon
Copy link
Member

Ping from triage:

@Milo123459
From what I can tell about the conversation it looks like this PR isn't something to move forward on - maybe close it?

@jyn514
Copy link
Member

jyn514 commented Jul 3, 2022

Rather than special casing these 4 flags, I wonder if it instead makes sense to add --test-args (or I guess --run-args?) so that we can pass arbitrary flags to clippy / rustc.

I think RUSTFLAGS may already do this? although that breaks a lot of the caching ... I wonder if we should expose RUST_LINT_FLAGS to users.

hmm, so normally this would be MAGIC_EXTRA_RUSTFLAGS, except that clippy bypasses our shim :/ #97443 (comment)

if let Ok(flags) = env::var("MAGIC_EXTRA_RUSTFLAGS") {
for flag in flags.split(' ') {
cmd.arg(flag);
}
}

@Milo123459
Copy link
Contributor Author

To be honest, I'm not really sure what to do, as Joshua said clippy doesn't work for the hack of directly passing arguments through so I'm not sure.

@jyn514
Copy link
Member

jyn514 commented Jul 3, 2022

@Mark-Simulacrum I think given that the only purpose of x.py clippy is to show warnings, it's reasonable to have the lint flags at the top-level. The other options are

I think A/W/D/F are reasonably low maintenance and consistent with cargo clipppy.

@Mark-Simulacrum
Copy link
Member

Okay, I'm not going to block merging this for clippy, but I do want to block any further expansion (i.e., this is not a blessing for it to be carried into check and other modes). Ultimately they are low maintenance, as you say, and consistent with how clippy works elsewhere, even if it's a little unfortunate it's necessary.

src/bootstrap/flags.rs Outdated Show resolved Hide resolved
@rust-log-analyzer

This comment has been minimized.

@jyn514
Copy link
Member

jyn514 commented Jul 4, 2022

Could you please squash the commits? https://rustc-dev-guide.rust-lang.org/git.html has instructions

@Milo123459
Copy link
Contributor Author

Should be all good now

@jyn514 jyn514 added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 4, 2022
Copy link
Member

@jyn514 jyn514 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay. r=me with the comment addressed.

src/bootstrap/config.rs Outdated Show resolved Hide resolved
@jyn514 jyn514 added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 10, 2022
@jyn514
Copy link
Member

jyn514 commented Jul 11, 2022

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Jul 11, 2022

📌 Commit e3d84b2 has been approved by jyn514

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 11, 2022
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jul 11, 2022
Support `-A`, `-W`, `-D` and `-F` when running `./x.py clippy`

Resolves rust-lang#97059

This PR adds support for `-A`, `-W`, `-D` and `-F` when running `./x.py clippy`.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jul 11, 2022
Support `-A`, `-W`, `-D` and `-F` when running `./x.py clippy`

Resolves rust-lang#97059

This PR adds support for `-A`, `-W`, `-D` and `-F` when running `./x.py clippy`.
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 12, 2022
…askrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#97210 (Support `-A`, `-W`, `-D` and `-F` when running `./x.py clippy`)
 - rust-lang#99055 (Fix rustdoc help options)
 - rust-lang#99075 (Fix duplicated type annotation suggestion)
 - rust-lang#99124 (Fix sized check ICE in asm check)
 - rust-lang#99142 (fix(doctest): treat fatal parse errors as incomplete attributes)
 - rust-lang#99145 (Don't rerun the build script for the compiler each time on non-windows platforms)
 - rust-lang#99146 (Do not error during method probe on `Sized` predicates for types that aren't the method receiver)
 - rust-lang#99161 (compiletest: trim edition before passing as flag)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 601c5a2 into rust-lang:master Jul 12, 2022
@rustbot rustbot added this to the 1.64.0 milestone Jul 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow -A, -W and -D in x.py clippy arguments
10 participants