-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Fix some clippy lints #8878
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
Fix some clippy lints #8878
Conversation
This commit can be replicated with `cargo +nightly clippy -Z unstable-options --fix`.
(rust_highfive has picked a reviewer for you, use r? to override) |
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.
Overall I like all of these except maybe the one.
src/cargo/util/errors.rs
Outdated
@@ -470,7 +470,7 @@ pub fn is_simple_exit_code(code: i32) -> bool { | |||
// codes are very large. This is just a rough | |||
// approximation of which codes are "normal" and which | |||
// ones are abnormal termination. | |||
code >= 0 && code <= 127 | |||
(0..=127).contains(&code) |
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 @ehuss has been against this one in the past.
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.
Ok, I reverted the change.
(Definition::Environment(_), Definition::Path(_)) => true, | ||
_ => false, | ||
} | ||
matches!((self, other), (Definition::Cli, Definition::Environment(_)) | (Definition::Cli, Definition::Path(_)) | (Definition::Environment(_), Definition::Path(_))) |
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.
This came up previously, but I don't think this change should be made.
Some(libc::ENOSYS) => true, | ||
_ => false, | ||
} | ||
matches!(err.raw_os_error(), Some(libc::ENOTSUP) | Some(libc::ENOSYS)) |
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 the meaning here has changed? The ENOSYS
arm is no longer just on Linux.
@@ -22,7 +22,7 @@ fn get_available_targets<'a>( | |||
.map(Target::name) | |||
.collect(); | |||
|
|||
targets.sort(); | |||
targets.sort_unstable(); |
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.
This also came up previously and I don't think this change should be made.
Oh I missed #8831, sorry. Probably that should take precedence over this change. |
This commit can be replicated with
cargo +nightly clippy -Z unstable-options --fix
.I am totally ambivalent as to whether this lands, if you want to close it because you don't like clippy that's fine by me.