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 { 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 { 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); render_window.set_size(Vector2u::new(WINDOW_WIDTH, WINDOW_HEIGHT) * new_current_scale);
let mut file = std::fs::OpenOptions::new() let mut file = std::fs::OpenOptions::new()
.write(true) .write(true)
.open(&scale_file_path) .open(scale_file_path)
.unwrap(); .unwrap();
file.write_all(new_current_scale.to_string().as_bytes()).unwrap(); file.write_all(new_current_scale.to_string().as_bytes()).unwrap();
file.flush().unwrap(); file.flush().unwrap();
@ -206,9 +206,8 @@ fn main() {
let mut new_highscore_sound = Sound::with_buffer(&new_highscore_buffer); let mut new_highscore_sound = Sound::with_buffer(&new_highscore_buffer);
while window.is_open() { while window.is_open() {
loop { while let Some(event) = window.poll_event() {
match window.poll_event() { match event {
Some(event) => match event {
Event::Closed | Event::KeyPressed { Event::Closed | Event::KeyPressed {
code: Key::Q, code: Key::Q,
alt: _, alt: _,
@ -265,8 +264,6 @@ fn main() {
_ => {} _ => {}
}, },
_ => {} _ => {}
},
None => break,
} }
} }
@ -297,8 +294,8 @@ fn main() {
if paused { if paused {
loop { loop {
match window.wait_event() { if let Some(event) = window.wait_event() {
Some(event) => match event { match event {
Event::Closed | Event::KeyPressed { Event::Closed | Event::KeyPressed {
code: Key::Q, code: Key::Q,
alt: _, alt: _,
@ -332,7 +329,6 @@ fn main() {
}, },
_ => {} _ => {}
} }
_ => {}
} }
} }
} }

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

Loading…
Cancel
Save