From 6b500292a3516ba95ec485b22f4bece7e7dadd1e Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Mon, 28 Feb 2022 10:33:00 -0500 Subject: [PATCH] cleanup --- Cargo.toml | 5 ++++- src/egui_app.rs | 20 +++++++------------- src/function.rs | 16 ++++++++-------- src/lib.rs | 2 +- 4 files changed, 20 insertions(+), 23 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index cd74433..bb2fcbc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,10 +22,13 @@ lto = true [dependencies] meval = { git = "https://github.com/Titaniumtown/meval-rs.git" } eframe = { git = "https://github.com/Titaniumtown/egui", branch = "patch-1", default-features = false, features = ["egui_glow"] } -instant = { version = "0.1.12", features = ["wasm-bindgen"] } git-version = "0.3.5" +[target.'cfg(not(target_arch = "wasm32"))'.dependencies] +instant = { version = "0.1.12" } + [target.'cfg(target_arch = "wasm32")'.dependencies] +instant = { version = "0.1.12", features = ["wasm-bindgen"] } console_error_panic_hook = "0.1.7" wee_alloc = "0.4.5" wasm-bindgen = { version = "0.2.79", default-features = false, features = ["std"] } diff --git a/src/egui_app.rs b/src/egui_app.rs index 74cffa4..772e09d 100644 --- a/src/egui_app.rs +++ b/src/egui_app.rs @@ -6,7 +6,7 @@ use eframe::{egui, epi}; use egui::plot::{Line, Plot, Values}; use egui::widgets::plot::BarChart; use egui::widgets::Button; -use egui::{Color32, Vec2, FontData, FontFamily}; +use egui::{Color32, FontData, FontFamily, Vec2}; use git_version::git_version; // Grabs git version on compile time @@ -83,18 +83,12 @@ impl epi::App for MathApp { "Ubuntu-Light".to_owned(), FontData::from_static(include_bytes!("Ubuntu-Light.ttf")), ); - fonts.families.insert( - FontFamily::Monospace, - vec![ - "Ubuntu-Light".to_owned(), - ], - ); - fonts.families.insert( - FontFamily::Proportional, - vec![ - "Ubuntu-Light".to_owned(), - ], - ); + fonts + .families + .insert(FontFamily::Monospace, vec!["Ubuntu-Light".to_owned()]); + fonts + .families + .insert(FontFamily::Proportional, vec!["Ubuntu-Light".to_owned()]); ctx.set_fonts(fonts); diff --git a/src/function.rs b/src/function.rs index b97614b..a72cf3d 100644 --- a/src/function.rs +++ b/src/function.rs @@ -52,15 +52,15 @@ impl Clone for Function { Self { function: Box::new(func), func_str: self.func_str.clone(), - min_x: self.min_x.clone(), - max_x: self.max_x.clone(), - pixel_width: self.pixel_width.clone(), + min_x: self.min_x, + max_x: self.max_x, + pixel_width: self.pixel_width, back_cache: self.back_cache.clone(), front_cache: self.front_cache.clone(), - integral: self.integral.clone(), - integral_min_x: self.integral_min_x.clone(), - integral_max_x: self.integral_max_x.clone(), - integral_num: self.integral_num.clone(), + integral: self.integral, + integral_min_x: self.integral_min_x, + integral_max_x: self.integral_max_x, + integral_num: self.integral_num, } } } @@ -182,7 +182,7 @@ impl Function { .clone() .iter() .filter(|ele| (ele.x >= min_x) && (min_x >= ele.x)) - .map(|ele| *ele) + .copied() .collect(); let x_to_go = match movement_right { diff --git a/src/lib.rs b/src/lib.rs index f93b40c..7f3cf3a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -31,7 +31,7 @@ fn init_tracing_wasm() { #[cfg(target_arch = "wasm32")] #[cfg(not(debug_assertions))] -fn init_tracing_wasm() { } +fn init_tracing_wasm() {} #[cfg(target_arch = "wasm32")] #[wasm_bindgen]