fix warning

This commit is contained in:
2025-07-05 12:40:54 +02:00
parent 37126caaa0
commit b6b2d70e31
2 changed files with 14 additions and 15 deletions

BIN
logo.png~ Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@@ -1,6 +1,6 @@
mod polygon_draw;
use std::{fs, io};
use std::fs;
use iced::{
Color, Element, Task, Theme,
@@ -78,7 +78,7 @@ impl MyApp {
if s.starts_with("Ngon") {
if let Ok(sides) = s.trim_start_matches("Ngon").parse::<u8>() {
poly = Polygon::n_gon(0.0, sides, self.default_sound.clone());
poly.name = format!("Ngon_{}", sides);
poly.name = format!("Ngon_{sides}");
} else {
return;
}
@@ -138,7 +138,7 @@ impl MyApp {
let teta_temp = self.poly_frame.teta;
self.poly_frame.teta += 2.0
* PI
* (1.0 / self.nb_sec_for_rev as f32)
* (1.0 / self.nb_sec_for_rev)
* (time_btw.as_millis() as f32 / 1_000.0);
self.poly_frame.teta %= 2.0 * PI;
let sound_to_play = self
@@ -158,21 +158,20 @@ impl MyApp {
self.poly_frame.polygons[i].global_teta = teta;
}
Message::ChangeColor(i, s) => {
let c: Color;
match s.as_str() {
"Green" => c = Color::from_rgb(0.0, 1.0, 0.0),
"Blue" => c = Color::from_rgb(0.0, 0.0, 1.0),
"Cyan" => c = Color::from_rgb(0.0, 1.0, 1.0),
"Yellow" => c = Color::from_rgb(1.0, 1.0, 0.0),
"Pink" => c = Color::from_rgb(1.0, 0.0, 1.0),
_ => c = Color::BLACK,
}
let c = match s.as_str() {
"Green" => Color::from_rgb(0.0, 1.0, 0.0),
"Blue" => Color::from_rgb(0.0, 0.0, 1.0),
"Cyan" => Color::from_rgb(0.0, 1.0, 1.0),
"Yellow" => Color::from_rgb(1.0, 1.0, 0.0),
"Pink" => Color::from_rgb(1.0, 0.0, 1.0),
_ => Color::BLACK,
};
self.poly_frame.polygons[i].color = c;
self.poly_frame.polygons[i].color_name = s;
}
Message::ChangeSound(i, s) => {
self.poly_frame.polygons[i].sound =
StaticSoundData::from_file(format!("./assets/{}", s))
StaticSoundData::from_file(format!("./assets/{s}"))
.expect("Fail to load audio");
self.poly_frame.polygons[i].sound_name = s;
}
@@ -219,7 +218,7 @@ impl MyApp {
.into()
})
.collect();
let ngon_options: Vec<String> = (5..=42).map(|sides| format!("Ngon{}", sides)).collect();
let ngon_options: Vec<String> = (5..=42).map(|sides| format!("Ngon{sides}")).collect();
let all_options: Vec<String> = [
"Segment",
"Triangle",
@@ -235,7 +234,7 @@ impl MyApp {
]
.iter()
.map(|s| s.to_string())
.chain(ngon_options.into_iter())
.chain(ngon_options)
.collect();
let polygon_column = Column::with_children(polygon_rows);