From 158e5b7482e5b97df4918f198dc8843eae27e1fb Mon Sep 17 00:00:00 2001 From: m00nwtchr Date: Tue, 12 Mar 2024 19:12:45 +0100 Subject: [PATCH] clippy --- cofd/app/src/component/integrity.rs | 2 +- cofd/app/src/component/merits.rs | 6 ++---- cofd/app/src/component/skills.rs | 2 +- cofd/app/src/component/traits.rs | 1 - cofd/app/src/main.rs | 2 +- cofd/app/src/store.rs | 8 ++++---- cofd/app/src/view/overview.rs | 14 ++++++-------- cofd/app/src/widget/track.rs | 2 +- 8 files changed, 16 insertions(+), 21 deletions(-) diff --git a/cofd/app/src/component/integrity.rs b/cofd/app/src/component/integrity.rs index bce6a89..94d668e 100644 --- a/cofd/app/src/component/integrity.rs +++ b/cofd/app/src/component/integrity.rs @@ -148,7 +148,7 @@ impl Component for IntegrityComponent { text(fl!("werewolf", "flesh-touchstone")).size(H3_SIZE), column![text_input( "", - character.touchstones.get(0).unwrap_or(&String::new()), + character.touchstones.first().unwrap_or(&String::new()), |str| Event::TouchstoneChanged(0, str), ) .padding(INPUT_PADDING)] diff --git a/cofd/app/src/component/merits.rs b/cofd/app/src/component/merits.rs index 4b6b7eb..604d345 100644 --- a/cofd/app/src/component/merits.rs +++ b/cofd/app/src/component/merits.rs @@ -87,15 +87,13 @@ impl Component for MeritComponent { let skills = &character.skills(); let vec: Vec> = vec - .iter() - .cloned() - .filter(|e| { + .iter().filter(|&e| { character .merits .iter() .filter(|(merit, _)| *merit == *e) .count() == 0 && e.is_available(&character, attributes, skills) - }) + }).cloned() .map(Into::into) .collect(); diff --git a/cofd/app/src/component/skills.rs b/cofd/app/src/component/skills.rs index 0a7a1fe..6dccd5d 100644 --- a/cofd/app/src/component/skills.rs +++ b/cofd/app/src/component/skills.rs @@ -109,7 +109,7 @@ impl SkillsComponent { col1 = col1.push( button(text(flt("skill", Some(skill.name())).unwrap()).style( - if specialties.len() > 0 { + if !specialties.is_empty() { theme::Text::Color(Color::from_rgb(0.0, 0.7, 0.0)) } else { theme::Text::Default diff --git a/cofd/app/src/component/traits.rs b/cofd/app/src/component/traits.rs index dfd989e..528f443 100644 --- a/cofd/app/src/component/traits.rs +++ b/cofd/app/src/component/traits.rs @@ -9,7 +9,6 @@ use cofd::{character::ArmorStruct, prelude::*}; use crate::{ fl, i18n::flt, - widget::dots::{Shape, SheetDots}, Element, INPUT_PADDING, }; diff --git a/cofd/app/src/main.rs b/cofd/app/src/main.rs index faa7782..97da4a5 100644 --- a/cofd/app/src/main.rs +++ b/cofd/app/src/main.rs @@ -200,7 +200,7 @@ impl Application for PlayerCompanionApp { Message::Msg => {} Message::Save => match self.save() { - Ok(_) => {} + Ok(()) => {} Err(err) => { log::error!("{}", err); } diff --git a/cofd/app/src/store.rs b/cofd/app/src/store.rs index e036ab6..fcbe28c 100644 --- a/cofd/app/src/store.rs +++ b/cofd/app/src/store.rs @@ -32,13 +32,13 @@ impl Store { std::fs::create_dir_all(dir.unwrap()).ok()?; } - let store = Some(Self { - dirs - }); + } } - store + Some(Self { + dirs + }) } pub fn get Deserialize<'a>>(&self, name: &str) -> anyhow::Result> { diff --git a/cofd/app/src/view/overview.rs b/cofd/app/src/view/overview.rs index 505b706..7fe31f7 100644 --- a/cofd/app/src/view/overview.rs +++ b/cofd/app/src/view/overview.rs @@ -272,14 +272,14 @@ where if val.is_empty() { character.conditions.remove(i); } else { - vec_changed(i, val, &mut character.conditions) + vec_changed(i, val, &mut character.conditions); } } Event::AspirationChanged(i, val) => { if val.is_empty() { character.aspirations.remove(i); } else { - vec_changed(i, val, &mut character.aspirations) + vec_changed(i, val, &mut character.aspirations); } } Event::SplatThingChanged(i, val) => match &mut character.splat { @@ -287,21 +287,21 @@ where if val.is_empty() { data.frailties.remove(i); } else { - vec_changed(i, val, &mut data.frailties) + vec_changed(i, val, &mut data.frailties); } } Splat::Vampire(.., data) => { if val.is_empty() { data.banes.remove(i); } else { - vec_changed(i, val, &mut data.banes) + vec_changed(i, val, &mut data.banes); } } Splat::Mage(.., data) => { if val.is_empty() { data.obsessions.remove(i); } else { - vec_changed(i, val, &mut data.obsessions) + vec_changed(i, val, &mut data.obsessions); } } _ => (), @@ -571,9 +571,7 @@ where .into() } else { let reg: Vec> = all_regalia - .iter() - .cloned() - .filter(|reg| reg != sg) + .iter().filter(|®| reg != sg).cloned() .map(Into::into) .collect(); diff --git a/cofd/app/src/widget/track.rs b/cofd/app/src/widget/track.rs index 138a5fb..1d63422 100644 --- a/cofd/app/src/widget/track.rs +++ b/cofd/app/src/widget/track.rs @@ -85,7 +85,7 @@ where } } - if row.children().len() > 0 { + if !row.children().is_empty() { col = col.push(row); }