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
+15 -11
View File
@@ -42,7 +42,7 @@ impl NavigatedPage<QuizMessage> for QuizState {
}
self.current_roman = content;
if self.correct_roman == self.current_roman {
if self.is_help == false {
if !self.is_help {
self.score.correct += 1;
}
@@ -84,16 +84,7 @@ impl NavigatedPage<QuizMessage> for QuizState {
.size(28)
.width(150)
.on_input(ContentChanged),
row![
text!("{}", self.score.total.to_string()).size(25),
text!("{}", self.score.correct.to_string())
.size(25)
.color(iced::Color::from_rgb8(60, 170, 60)),
text!("{}", self.score.fail.to_string())
.color(iced::Color::from_rgb8(255, 79, 0))
.size(25),
]
.spacing(DEFAULT_SPACING),
score_display(&self.score),
button("Закончить").style(jl_button).on_press(Back),
]
.spacing(DEFAULT_SPACING)
@@ -105,6 +96,19 @@ impl NavigatedPage<QuizMessage> for QuizState {
}
}
fn score_display<'a, T: 'a>(score: &Score) -> Element<'a, T> {
row![
text!("{}", score.total.to_string()).size(25),
text!("{}", score.correct.to_string())
.size(25)
.color(iced::Color::from_rgb8(60, 170, 60)),
text!("{}", score.fail.to_string())
.color(iced::Color::from_rgb8(255, 79, 0))
.size(25),
]
.spacing(DEFAULT_SPACING).into()
}
impl QuizState {
pub(crate) fn new() -> QuizState {
QuizState {