-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
various clippy fixes #121543
various clippy fixes #121543
Conversation
r? @clubby789 rustbot has assigned @clubby789. Use r? to explicitly pick a reviewer |
This PR modifies If appropriate, please update |
Looks good so far :) thanks! |
args.extend(ignored_lints.iter().map(|lint| format!("-Aclippy::{}", lint))); | ||
let mut clippy_lint_levels: Vec<String> = Vec::new(); | ||
allow.iter().for_each(|v| clippy_lint_levels.push(format!("-A{}", v))); | ||
deny.iter().for_each(|v| clippy_lint_levels.push(format!("-D{}", v))); | ||
warn.iter().for_each(|v| clippy_lint_levels.push(format!("-W{}", v))); | ||
forbid.iter().for_each(|v| clippy_lint_levels.push(format!("-F{}", v))); | ||
args.extend(clippy_lint_levels); | ||
args.extend(get_clippy_rules_in_order(&all_args, allow, deny, warn, forbid)); |
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.
like this, the manual lints passed to x.py clippy
will always override the ignored lints.
I'm not sure if we have any other options than either make x.py
always override the ignored lints or make the ignored lints always override the manual ones, so the way it is currently seems to be the less painful option..?
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.
7745deb should be appropriate solution I think?
6e8042b should fix that. |
This comment has been minimized.
This comment has been minimized.
6e8042b
to
1a2e189
Compare
This comment has been minimized.
This comment has been minimized.
Now clippy complains a lot of stuff because the |
This comment has been minimized.
This comment has been minimized.
Some changes occurred to the CTFE / Miri engine cc @rust-lang/miri This PR changes Stable MIR cc @oli-obk, @celinval, @spastorino, @ouz-a Some changes occurred in match lowering cc @Nadrieril Some changes occurred to the CTFE / Miri engine cc @rust-lang/miri |
@rustbot ready |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@@ -671,11 +671,11 @@ pub fn read_target_uint(endianness: Endian, mut source: &[u8]) -> Result<u128, i | |||
// So we do not read exactly 16 bytes into the u128, just the "payload". | |||
let uint = match endianness { | |||
Endian::Little => { | |||
source.read(&mut buf)?; | |||
let _ = source.read(&mut buf)?; |
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.
read_exact here, too?
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 already tried that and got failures in CI https://github.com/rust-lang/rust/actions/runs/8307751008/job/22737303335#step:27:1679. And that actually makes sense as trying to fill entire [0u8; std::mem::size_of::<u128>()]
will fail for most cases.
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.
right, you need to use the same [16 - source.len()..]
logic used in the Endian::Big
branch (or even better, move that logic before the match endianess
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 believe this is to cover the logic for the "most significant byte" and we shouldn't do the same in Little
branch.
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.
Ah makes sense. Then you need to slice ..source.len()
before using read_exact
Tho maybe we should just use one of the slice copying functions instead of using the Read trait
☔ The latest upstream changes (presumably #122637) made this pull request unmergeable. Please resolve the merge conflicts. |
We need to keep the order of the given clippy lint rules before passing them. Since clap doesn't offer any useful interface for this purpose out of the box, we have to handle it manually. Signed-off-by: onur-ozkan <work@onurozkan.dev>
Signed-off-by: onur-ozkan <work@onurozkan.dev>
Previously, when passing lint rules manually using `x clippy ..`, ignored lints would override manual ones. This change corrects the order by passing ignored lints after the manual ones. Signed-off-by: onur-ozkan <work@onurozkan.dev>
Signed-off-by: onur-ozkan <work@onurozkan.dev>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Signed-off-by: onur-ozkan <work@onurozkan.dev>
@bors r+ rollup |
…iaskrgr Rollup of 6 pull requests Successful merges: - rust-lang#121543 (various clippy fixes) - rust-lang#122540 (Do not use `?`-induced skewing of type inference in the compiler) - rust-lang#122730 (Expose `ucred::peer_cred` on QNX targets to enable dist builds) - rust-lang#122732 (Remove redundant coroutine captures note) - rust-lang#122739 (Add "put" as a confusable for insert on hash map/set) - rust-lang#122748 (Reduce `pub` usage in `rustc_session`.) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#121543 - onur-ozkan:clippy-args, r=oli-obk various clippy fixes We need to keep the order of the given clippy lint rules before passing them. Since clap doesn't offer any useful interface for this purpose out of the box, we have to handle it manually. Additionally, this PR makes `-D` rules work as expected. Previously, lint rules were limited to `-W`. By enabling `-D`, clippy began to complain numerous lines in the tree, all of which have been resolved in this PR as well. Fixes rust-lang#121481 cc `@matthiaskrgr`
We need to keep the order of the given clippy lint rules before passing them.
Since clap doesn't offer any useful interface for this purpose out of the box,
we have to handle it manually.
Additionally, this PR makes
-D
rules work as expected. Previously, lint rules were limited to-W
. By enabling-D
, clippy began to complain numerous lines in the tree, all of which have been resolved in this PR as well.Fixes #121481
cc @matthiaskrgr