clippy and fmt

This commit is contained in:
Mike Dilger 2023-01-14 12:41:23 +13:00
parent 7540ee473a
commit 0990806d45
2 changed files with 8 additions and 6 deletions

View File

@ -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()
}

View File

@ -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 {