diff options
author | Nora Widdecke <nora@sequoia-pgp.org> | 2021-11-22 12:58:47 +0100 |
---|---|---|
committer | Nora Widdecke <nora@sequoia-pgp.org> | 2021-11-29 11:53:55 +0100 |
commit | 049055e3ff5ffe86700b668e924fbff96e82be94 (patch) | |
tree | 30dfd63e4d1c3016210b698813e99b70787890e8 /openpgp/examples | |
parent | 97ce753fefae770ee0b5b02a611d75e29a7cd01d (diff) |
Remove unnecessary borrows.
- Fixed with the help of clippy::needless_borrow.
Diffstat (limited to 'openpgp/examples')
-rw-r--r-- | openpgp/examples/statistics.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/openpgp/examples/statistics.rs b/openpgp/examples/statistics.rs index fc262ee8..d0c5023d 100644 --- a/openpgp/examples/statistics.rs +++ b/openpgp/examples/statistics.rs @@ -176,7 +176,7 @@ fn main() -> openpgp::Result<()> { SubpacketValue::Unknown { .. } => unreachable!(), SubpacketValue::KeyFlags(k) => - if let Some(count) = key_flags.get_mut(&k) { + if let Some(count) = key_flags.get_mut(k) { *count += 1; } else { key_flags.insert(k.clone(), 1); @@ -437,7 +437,7 @@ fn main() -> openpgp::Result<()> { // Sort by the number of occurrences. let mut kf = key_flags.iter().map(|(f, n)| (format!("{:?}", f), n)) .collect::<Vec<_>>(); - kf.sort_unstable_by(|a, b| b.1.cmp(&a.1)); + kf.sort_unstable_by(|a, b| b.1.cmp(a.1)); for (f, n) in kf.iter() { println!("{:>22} {:>9}", f, n); } @@ -456,7 +456,7 @@ fn main() -> openpgp::Result<()> { let a = format!("{:?}", a); (a[1..a.len()-1].to_string(), n) }).collect::<Vec<_>>(); - preferences.sort_unstable_by(|a, b| b.1.cmp(&a.1)); + preferences.sort_unstable_by(|a, b| b.1.cmp(a.1)); for (a, n) in preferences { println!("{:>70} {:>9}", a, n); } @@ -475,7 +475,7 @@ fn main() -> openpgp::Result<()> { let a = format!("{:?}", a); (a[1..a.len()-1].to_string(), n) }).collect::<Vec<_>>(); - preferences.sort_unstable_by(|a, b| b.1.cmp(&a.1)); + preferences.sort_unstable_by(|a, b| b.1.cmp(a.1)); for (a, n) in preferences { let a = format!("{:?}", a); println!("{:>70} {:>9}", &a[1..a.len()-1], n); @@ -495,7 +495,7 @@ fn main() -> openpgp::Result<()> { let a = format!("{:?}", a); (a[1..a.len()-1].to_string(), n) }).collect::<Vec<_>>(); - preferences.sort_unstable_by(|a, b| b.1.cmp(&a.1)); + preferences.sort_unstable_by(|a, b| b.1.cmp(a.1)); for (a, n) in preferences { let a = format!("{:?}", a); println!("{:>70} {:>9}", &a[1..a.len()-1], n); |