From 0990806d45c884bde4af5b6566f1c61335da543c Mon Sep 17 00:00:00 2001 From: Mike Dilger Date: Sat, 14 Jan 2023 12:41:23 +1300 Subject: [PATCH] clippy and fmt --- src/people.rs | 6 +++--- src/ui/feed.rs | 8 +++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/people.rs b/src/people.rs index 3a0a5765..40605bf8 100644 --- a/src/people.rs +++ b/src/people.rs @@ -384,12 +384,12 @@ impl People { if score > 0 { // if there is not a name, fallback to showing the initial chars of the pubkey, // but this is probably unnecessary and will never happen - if result_name == "" { + if result_name.is_empty() { result_name = person.pubkey.to_string(); } // bigger names have a higher match chance, but they should be scored lower - score = score - result_name.len() as u16; + score -= result_name.len() as u16; return Some((score, result_name, person.pubkey.clone())); } @@ -405,7 +405,7 @@ impl People { results.len() }; results[0..max] - .into_iter() + .iter() .map(|r| (r.1.to_owned(), r.2.clone())) .collect() } diff --git a/src/ui/feed.rs b/src/ui/feed.rs index 70b08dd3..8425a799 100644 --- a/src/ui/feed.rs +++ b/src/ui/feed.rs @@ -186,9 +186,11 @@ fn real_posting_area(app: &mut GossipUi, ctx: &Context, frame: &mut eframe::Fram let idx = app .draft_tags .iter() - .position(|tag| match tag { - Tag::Pubkey { pubkey, .. } if pubkey.0 == *pair.1 => true, - _ => false, + .position(|tag| { + matches!( + tag, + Tag::Pubkey { pubkey, .. } if pubkey.0 == *pair.1 + ) }) .unwrap_or_else(|| { app.draft_tags.push(Tag::Pubkey {