diff --git a/src/lib.rs b/src/lib.rs index 519c65e..df6a9ba 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -233,9 +233,7 @@ impl ChartManager { // Creates and does the math for creating all the rectangles under the graph #[inline] - fn integral_rectangles( - &self, step: f32 - ) -> (Vec<(f32, f32, f32)>, f32) { + fn integral_rectangles(&self, step: f32) -> (Vec<(f32, f32, f32)>, f32) { let data2: Vec<(f32, f32, f32)> = (0..self.num_interval) .map(|e| { let x: f32 = ((e as f32) * step) + self.min_x; diff --git a/src/misc.rs b/src/misc.rs index 9eeb72c..968807e 100644 --- a/src/misc.rs +++ b/src/misc.rs @@ -1,5 +1,5 @@ -use wasm_bindgen::prelude::*; use meval::Expr; +use wasm_bindgen::prelude::*; pub type DrawResult = Result>; @@ -90,7 +90,7 @@ pub fn add_asterisks(function_in: String) -> String { pub struct Function { function: Box f64>, - func_str: String + func_str: String, } impl Function { @@ -99,25 +99,18 @@ impl Function { let func = expr.bind("x").unwrap(); Self { function: Box::new(func), - func_str + func_str, } } #[inline] - pub fn run(&self, x: f32) -> f32 { - (self.function)(x as f64) as f32 - } + pub fn run(&self, x: f32) -> f32 { (self.function)(x as f64) as f32 } - pub fn str_compare(&self, other_string: String) -> bool { - self.func_str == other_string - } + pub fn str_compare(&self, other_string: String) -> bool { self.func_str == other_string } - pub fn get_string(&self) -> String { - self.func_str.clone() - } + pub fn get_string(&self) -> String { self.func_str.clone() } } - /// Result of screen to chart coordinates conversion. #[wasm_bindgen] pub struct Point { @@ -211,7 +204,6 @@ fn asterisk_test() { assert_eq!(&add_asterisks("x!".to_string()), "x!"); } - // Tests cache when initialized with value #[test] fn cache_test_full() { @@ -232,4 +224,4 @@ fn cache_test_empty() { assert_eq!(cache.is_valid(), false); cache.set("data"); assert_eq!(cache.is_valid(), true); -} \ No newline at end of file +}