-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 clippy warnings with Rust 1.72.0 #5204
Conversation
6f5610b
to
392bec5
Compare
I don't really like the changes from |
src/uu/factor/src/factor.rs
Outdated
@@ -96,7 +96,7 @@ impl fmt::Display for Factors { | |||
v.sort_unstable(); | |||
|
|||
let include_exponents = f.alternate(); | |||
for (p, exp) in v.iter() { | |||
for (p, exp) in &*v { |
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.
for (p, exp) in &*v { | |
for (p, exp) in v { |
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.
yeah, just like you, i don't like the &* syntax :)
if v works, great! if it doesn't, i would prefer to keep v.iter
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.
The changes I suggested should work. But there are a few more cases of &*
and &mut *
left that I couldn't simplify. I'll go look for a clippy issue related to this. I'm guessing we aren't the only ones who don't like this.
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.
Found something related: rust-lang/rust-clippy#11074
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 will simplify where possible and go back to iter
(and disable the warning) in the other 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.
Thanks!
src/uu/factor/src/factor.rs
Outdated
@@ -292,7 +292,7 @@ impl std::ops::BitXor<Exponent> for Factors { | |||
fn bitxor(self, rhs: Exponent) -> Self { | |||
debug_assert_ne!(rhs, 0); | |||
let mut r = Self::one(); | |||
for (p, e) in self.0.borrow().0.iter() { | |||
for (p, e) in &self.0.borrow().0 { |
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.
for (p, e) in &self.0.borrow().0 { | |
for (p, e) in self.0.borrow().0 { |
src/uu/mktemp/src/mktemp.rs
Outdated
@@ -451,7 +451,7 @@ pub fn dry_exec(tmpdir: &str, prefix: &str, rand: usize, suffix: &str) -> UResul | |||
// Randomize. | |||
let bytes = &mut buf[prefix.len()..prefix.len() + rand]; | |||
rand::thread_rng().fill(bytes); | |||
for byte in bytes.iter_mut() { | |||
for byte in &mut *bytes { |
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.
for byte in &mut *bytes { | |
for byte in bytes { |
392bec5
to
01b2834
Compare
GNU testsuite comparison:
|
No description provided.