Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
m00nwtchr committed Mar 12, 2024
1 parent 544671a commit 158e5b7
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 21 deletions.
2 changes: 1 addition & 1 deletion cofd/app/src/component/integrity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ impl<Message> Component<Message, iced::Renderer> 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)]
Expand Down
6 changes: 2 additions & 4 deletions cofd/app/src/component/merits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,13 @@ impl<Message> Component<Message, iced::Renderer> for MeritComponent<Message> {
let skills = &character.skills();

let vec: Vec<Translated<Merit>> = 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();

Expand Down
2 changes: 1 addition & 1 deletion cofd/app/src/component/skills.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ impl<Message> SkillsComponent<Message> {

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
Expand Down
1 change: 0 additions & 1 deletion cofd/app/src/component/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use cofd::{character::ArmorStruct, prelude::*};
use crate::{
fl,
i18n::flt,
widget::dots::{Shape, SheetDots},
Element, INPUT_PADDING,
};

Expand Down
2 changes: 1 addition & 1 deletion cofd/app/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ impl Application for PlayerCompanionApp {
Message::Msg => {}

Message::Save => match self.save() {
Ok(_) => {}
Ok(()) => {}
Err(err) => {
log::error!("{}", err);
}
Expand Down
8 changes: 4 additions & 4 deletions cofd/app/src/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<T: for<'a> Deserialize<'a>>(&self, name: &str) -> anyhow::Result<Option<T>> {
Expand Down
14 changes: 6 additions & 8 deletions cofd/app/src/view/overview.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,36 +272,36 @@ 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 {
Splat::Changeling(.., data) => {
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);
}
}
_ => (),
Expand Down Expand Up @@ -571,9 +571,7 @@ where
.into()
} else {
let reg: Vec<Translated<Regalia>> = all_regalia
.iter()
.cloned()
.filter(|reg| reg != sg)
.iter().filter(|&reg| reg != sg).cloned()
.map(Into::into)
.collect();

Expand Down
2 changes: 1 addition & 1 deletion cofd/app/src/widget/track.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ where
}
}

if row.children().len() > 0 {
if !row.children().is_empty() {
col = col.push(row);
}

Expand Down

0 comments on commit 158e5b7

Please sign in to comment.