From 6d4bd0b8aec2dab835f867a09b83ec11f554f68b Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Mon, 28 Feb 2022 10:35:23 -0500 Subject: [PATCH] remove some explicit inline declarations --- src/egui_app.rs | 1 - src/function.rs | 11 ----------- src/misc.rs | 3 --- 3 files changed, 15 deletions(-) diff --git a/src/egui_app.rs b/src/egui_app.rs index 772e09d..d48c177 100644 --- a/src/egui_app.rs +++ b/src/egui_app.rs @@ -35,7 +35,6 @@ pub struct MathApp { } impl Default for MathApp { - #[inline] fn default() -> Self { let def_min_x = -10.0; let def_max_x = 10.0; diff --git a/src/function.rs b/src/function.rs index a72cf3d..8dd9db5 100644 --- a/src/function.rs +++ b/src/function.rs @@ -11,13 +11,10 @@ pub struct FunctionOutput { } impl FunctionOutput { - #[inline] pub fn new(back: Vec, front: Option<(Vec, f64)>) -> Self { Self { back, front } } - #[inline] pub fn get_back(&self) -> Vec { self.back.clone() } - #[inline] pub fn get_front(&self) -> (Vec, f64) { match &self.front { Some(x) => (x.0.clone(), x.1), @@ -25,7 +22,6 @@ impl FunctionOutput { } } - #[inline] pub fn has_integral(&self) -> bool { self.front.is_some() } } @@ -105,10 +101,8 @@ impl Function { } // Runs the internal function to get values - #[inline] fn run_func(&self, x: f64) -> f64 { (self.function)(x) } - #[inline(always)] pub fn update( &mut self, func_str: String, integral: bool, integral_min_x: Option, integral_max_x: Option, integral_num: Option, @@ -159,7 +153,6 @@ impl Function { } } - #[inline(always)] pub fn update_bounds(&mut self, min_x: f64, max_x: f64, pixel_width: usize) { if pixel_width != self.pixel_width { self.back_cache = None; @@ -170,7 +163,6 @@ impl Function { && self.back_cache.is_some() && false { - println!("rebuilding cache"); let range_new: f64 = max_x.abs() + min_x.abs(); let resolution: f64 = (self.pixel_width as f64 / range_new) as f64; @@ -207,15 +199,12 @@ impl Function { } } - #[inline] pub fn get_step(&self) -> f64 { (self.integral_min_x - self.integral_max_x).abs() / (self.integral_num as f64) } - #[inline] pub fn is_integral(&self) -> bool { self.integral } - #[inline(always)] pub fn run(&mut self) -> FunctionOutput { let front_values: Vec = match self.back_cache.is_some() { true => self.back_cache.as_ref().expect("").clone(), diff --git a/src/misc.rs b/src/misc.rs index e68b500..d0b0ef5 100644 --- a/src/misc.rs +++ b/src/misc.rs @@ -5,7 +5,6 @@ EXTREMELY Janky function that tries to put asterisks in the proper places to be One limitation though, variables with multiple characters like `pi` cannot be multiplied (like `pipipipi` won't result in `pi*pi*pi*pi`). But that's such a niche use case (and that same thing could be done by using exponents) that it doesn't really matter. In the future I may want to completely rewrite this or implement this natively into mevel-rs (which would probably be good to do) */ -#[inline] pub fn add_asterisks(function_in: String) -> String { let function = function_in.replace("log10(", "log(").replace("pi", "π"); // pi -> π and log10 -> log let valid_variables: Vec = "xeπ".chars().collect(); @@ -79,7 +78,6 @@ pub fn add_asterisks(function_in: String) -> String { } // Tests function to make sure it's able to be parsed. Returns the string of the Error produced, or an empty string if it runs successfully. -#[inline] pub fn test_func(function_string: String) -> String { // Factorials do not work, and it would be really difficult to make them work if function_string.contains('!') { @@ -110,7 +108,6 @@ pub fn test_func(function_string: String) -> String { } // Rounds f64 to specific number of digits -#[inline] pub fn digits_precision(x: f64, digits: usize) -> f64 { let large_number: f64 = 10.0_f64.powf(digits as f64); (x * large_number).round() / large_number