From 13c694f9775dfc11b3399ee2844a0873ee571f7a Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Sat, 26 Feb 2022 12:55:29 -0500 Subject: [PATCH] simplify some stuff --- src/function.rs | 11 +---------- src/misc.rs | 7 +------ 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/src/function.rs b/src/function.rs index 6b29a38..2526ac7 100644 --- a/src/function.rs +++ b/src/function.rs @@ -28,12 +28,7 @@ impl FunctionOutput { } #[inline] - pub fn has_integral(&self) -> bool { - match &self.front { - Some(_) => true, - None => false, - } - } + pub fn has_integral(&self) -> bool { self.front.is_some() } } pub struct Function { @@ -209,10 +204,6 @@ impl Function { } } - pub fn get_string(&self) -> String { self.func_str.clone() } - - pub fn str_compare(&self, other_string: String) -> bool { self.func_str == other_string } - // Creates and does the math for creating all the rectangles under the graph fn integral_rectangles(&self) -> (Vec<(f64, f64)>, f64) { if !self.integral { diff --git a/src/misc.rs b/src/misc.rs index a5170c7..28a9a7b 100644 --- a/src/misc.rs +++ b/src/misc.rs @@ -147,12 +147,7 @@ impl Cache { pub fn invalidate(&mut self) { self.backing_data = None; } #[inline] - pub fn is_valid(&self) -> bool { - match &self.backing_data { - Some(_) => true, - None => false, - } - } + pub fn is_valid(&self) -> bool { self.backing_data.is_some() } } // Tests to make sure my cursed function works as intended