Clippy code cleanup

This commit is contained in:
2026-08-15 13:22:59 +03:00
parent 9917702c4c
commit e676898135
22 changed files with 290 additions and 171 deletions
+8 -10
View File
@@ -263,7 +263,6 @@ impl RepetitionsState {
column![self.activity_bar(set)].align_x(Center)
.width(Fill)
.spacing(DEFAULT_SPACING)
.into()
}
fn activity_bar(&self, set: &CardSetSettings) -> Element<'_, RepetitionsMessage> {
const MAX_DAY_COUNT: f32 = 128.0;
@@ -301,7 +300,7 @@ impl RepetitionsState {
.spacing(QUARTER_SPACING);
let mut iter = counts.into_iter();
let mut iter = counts.iter();
for i in 0..30 {
let mut column = Column::new().spacing(QUARTER_SPACING);
@@ -309,7 +308,7 @@ impl RepetitionsState {
let value = *iter.next().unwrap() as f32;
let k = (value / MAX_DAY_COUNT).min(1.0) * 0.9 + 0.1;
let date = now.clone().checked_sub_days(Days::new(30 * 7 - i * 7 - j - 1)).unwrap();
let date = (*now).checked_sub_days(Days::new(30 * 7 - i * 7 - j - 1)).unwrap();
column = column.push(tooltip(
iced::widget::container(space().height(15).width(15)).style(
@@ -340,7 +339,7 @@ impl RepetitionsState {
fn words_words_view(&self, set: &CardSetSettings) -> Element<'_, RepetitionsMessage> {
column![
text!("Худшие слова"),
container(scrollable(self.worst_words_list(&set)).height(200)).style(bordered_box),
container(scrollable(self.worst_words_list(set)).height(200)).style(bordered_box),
radio(
"Начать с плохих слов",
SetOrderMode::TrainWorstFirst,
@@ -376,19 +375,19 @@ impl RepetitionsState {
fn sets_list(&self) -> Column<'_, RepetitionsMessage> {
let mut column = Column::new();
let mut i = 0;
let sets = &self.state.lock().unwrap().card_sets;
for set in sets {
for (i, set) in sets.iter().enumerate() {
column = column.push(
button(text!("{}", set.name.clone()))
.on_press_with(move || SelectSet(i.clone()))
.on_press_with(move || SelectSet(i))
.style(move |_x: &Theme, status: Status| Style {
background: if status == Status::Hovered {
Some(Background::Color(Color::WHITE.scale_alpha(0.2)))
} else {
None
},
text_color: if self.correct_filters[i.clone()] {
text_color: if self.correct_filters[i] {
_x.palette().primary
} else {
_x.palette().warning
@@ -402,7 +401,6 @@ impl RepetitionsState {
snap: false,
}),
);
i += 1;
}
column
@@ -507,7 +505,7 @@ impl CardSetSettings {
}
fn update_worst_words(&mut self, state: &AppState) {
if let Some(_) = self.worst_words_list {
if self.worst_words_list.is_some() {
return;
}