Update deps and fix some useless code

Signed-off-by: Ivan Bushchik <ivabus@ivabus.dev>
This commit is contained in:
Ivan Bushchik 2023-03-12 21:27:34 +03:00
parent 2eca1003cf
commit 5448afe653
No known key found for this signature in database
GPG key ID: 9F6DDABE11A2674D
3 changed files with 12 additions and 15 deletions

View file

@ -1,4 +1,4 @@
use std::ops::{Add, AddAssign, Mul, MulAssign};
use std::ops::{Add, AddAssign, Mul};
use rand::{thread_rng, Rng};
@ -17,7 +17,7 @@ fn check_valid<T>(a: &Matrix<T>) -> bool {
}
pub fn sum<T: Add<Output = T> + Copy>(a: &Matrix<T>, b: &Matrix<T>) -> Option<Matrix<T>> {
if !(check_valid(&a) && check_valid(&b)) {
if !(check_valid(a) && check_valid(b)) {
return None;
}
@ -40,7 +40,7 @@ pub fn mul<T: Mul<Output = T> + Copy + AddAssign + From<u8>>(
a: &Matrix<T>,
b: &Matrix<T>,
) -> Option<Matrix<T>> {
if !(check_valid(&a) && check_valid(&b)) {
if !(check_valid(a) && check_valid(b)) {
return None;
}

View file

@ -9,10 +9,10 @@ optimize = ["log/release_max_level_warn"]
default = ["optimize"]
[dependencies]
env_logger = "0.10"
log = "0.4"
env_logger = "0.10.0"
log = "0.4.17"
matrix = { version = "0.1.2", path = "../matrix" }
pixels = "0.11.0"
winit = "0.28.1"
winit = "0.28.2"
winit_input_helper = "0.14.0"
bresenham = "0.1.1"

View file

@ -107,16 +107,13 @@ fn main() {
let mut bitmap: [[bool; WIDTH as usize]; HEIGHT as usize] =
[[false; WIDTH as usize]; HEIGHT as usize];
event_loop.run(move |event, _, control_flow| {
match event {
Event::MainEventsCleared => {
render(pixels.get_frame_mut(), &bitmap);
if let Err(err) = pixels.render() {
error!("pixels.render() failed: {err}");
*control_flow = ControlFlow::Exit;
return;
}
if event == Event::MainEventsCleared {
render(pixels.get_frame_mut(), &bitmap);
if let Err(err) = pixels.render() {
error!("pixels.render() failed: {err}");
*control_flow = ControlFlow::Exit;
return;
}
_ => {}
}
// Handle input events