Fix clippy warnings

main
Elnu 1 year ago
parent 05e9a7b8e0
commit ab85163723

@ -23,7 +23,7 @@ pub fn texture(name: &str) -> String {
}
fn get_level(lines: u32) -> u32 {
return std::cmp::min(lines / LINES_PER_LEVEL, 15);
std::cmp::min(lines / LINES_PER_LEVEL, 15)
}
fn get_update_interval(level: u32) -> u32 {
@ -53,7 +53,7 @@ fn handle_resize_events(code: Key, current_scale: &mut u32, render_window: &mut
render_window.set_size(Vector2u::new(WINDOW_WIDTH, WINDOW_HEIGHT) * new_current_scale);
let mut file = std::fs::OpenOptions::new()
.write(true)
.open(&scale_file_path)
.open(scale_file_path)
.unwrap();
file.write_all(new_current_scale.to_string().as_bytes()).unwrap();
file.flush().unwrap();
@ -206,9 +206,8 @@ fn main() {
let mut new_highscore_sound = Sound::with_buffer(&new_highscore_buffer);
while window.is_open() {
loop {
match window.poll_event() {
Some(event) => match event {
while let Some(event) = window.poll_event() {
match event {
Event::Closed | Event::KeyPressed {
code: Key::Q,
alt: _,
@ -265,8 +264,6 @@ fn main() {
_ => {}
},
_ => {}
},
None => break,
}
}
@ -297,8 +294,8 @@ fn main() {
if paused {
loop {
match window.wait_event() {
Some(event) => match event {
if let Some(event) = window.wait_event() {
match event {
Event::Closed | Event::KeyPressed {
code: Key::Q,
alt: _,
@ -332,7 +329,6 @@ fn main() {
},
_ => {}
}
_ => {}
}
}
}

@ -29,7 +29,7 @@ impl<'a> Block<'a> {
if !cell {
continue;
}
let mut rotated = Vector2i::new(x as i32, y as i32);
let mut rotated = Vector2i::new(x, y);
if self.block_type.rotate {
let center_x = row.len() as i32 / 2;
let center_y = self.block_type.grid.len() as i32 / 2;

Loading…
Cancel
Save