From 049055e3ff5ffe86700b668e924fbff96e82be94 Mon Sep 17 00:00:00 2001 From: Nora Widdecke Date: Mon, 22 Nov 2021 12:58:47 +0100 Subject: Remove unnecessary borrows. - Fixed with the help of clippy::needless_borrow. --- openpgp/examples/statistics.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'openpgp/examples') 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::>(); - 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::>(); - 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::>(); - 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::>(); - 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); -- cgit v1.2.3