Commit e349c66
authored
fix(job_queue): Handle Clippy CLI arguments in
fixes #16637
### What does this PR try to resolve?
Clippy lints can be enabled via the command line via `cargo clippy --
-Wclippy::lint`, and these need to be included in the `cargo fix`
command (because if a lint is not emitted, it's not fixed, and some
lints are allow-by-default)
---
When `cargo clippy` is executed, Clippy sets the env. var `CLIPPY_ARGS`
to the arguments that were passed to Clippy, separated by the string
`__CLIPPY_HACKERY__`. To avoid breaking behaviour in between runs (like
in `fix`), we should maintain those arguments.
This PR takes that `CLIPPY_ARGS` env var (if it exists), replaces the
`__CLIPPY_HACKERY__` separator and appends it to the suggested `cargo
clippy --fix` command when emitting fixable warnings.
### How to test and review this PR?
Via copying a crate (in my case, `tokio-1.38.1`) and executing the
following commands:
```bash
rustup run nightly ~/git/cargo/target/debug/cargo clippy -- -Wclippy::pedantic -Aclippy::allow_attributes -Wclippy::dbg_macro -Wclippy::eq_op
```
In order to get some warnings. If any fixable warning is emitted, the
output message should end with:
```text
warning: `tokio` (lib) generated 42 warnings (run `cargo clippy --fix --lib -p tokio -- -Wclippy::pedantic -Aclippy::allow_attributes -Wclippy::dbg_macro -Wclippy::eq_op` to apply 16 suggestions)
```
Now, testing with the suggested command (in this case, also with the
version pinned @1.38.1):
```bash
rustup run nightly ~/git/cargo/target/debug/cargo clippy --fix --lib -p tokio@1.38.1 -- -Wclippy::pedantic -Aclippy::allow_attributes -Wclippy::dbg_macro -Wclippy::eq_op
```
All warnings (including those allow-by-default `pedantic` lints!) should
be fixed now.fix message (#16652)2 files changed
Lines changed: 33 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
119 | | - | |
120 | 119 | | |
121 | 120 | | |
122 | 121 | | |
123 | 122 | | |
| 123 | + | |
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
| |||
1089 | 1089 | | |
1090 | 1090 | | |
1091 | 1091 | | |
1092 | | - | |
1093 | | - | |
1094 | | - | |
1095 | | - | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
1096 | 1099 | | |
| 1100 | + | |
1097 | 1101 | | |
1098 | 1102 | | |
1099 | 1103 | | |
| |||
1105 | 1109 | | |
1106 | 1110 | | |
1107 | 1111 | | |
| 1112 | + | |
| 1113 | + | |
1108 | 1114 | | |
1109 | 1115 | | |
1110 | | - | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
1111 | 1128 | | |
1112 | 1129 | | |
1113 | 1130 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1550 | 1550 | | |
1551 | 1551 | | |
1552 | 1552 | | |
| 1553 | + | |
| 1554 | + | |
| 1555 | + | |
| 1556 | + | |
| 1557 | + | |
| 1558 | + | |
| 1559 | + | |
| 1560 | + | |
| 1561 | + | |
| 1562 | + | |
1553 | 1563 | | |
1554 | 1564 | | |
1555 | 1565 | | |
| |||
0 commit comments