diff --git a/build.rs b/build.rs index c69c188..9def218 100644 --- a/build.rs +++ b/build.rs @@ -33,7 +33,7 @@ fn generate_hashmap() { compile_hashmap().build() ) .unwrap(); - write!(&mut file, ";\n").unwrap(); + writeln!(&mut file, ";").unwrap(); } /// List of supported functions from exmex @@ -60,10 +60,10 @@ fn compile_hashmap() -> phf_codegen::Map { .filter(|e| e.len() > 1) .filter(|ele| { if seen.contains(ele) { - return false; + false } else { seen.insert(ele.clone()); - return true; + true } }) .collect::>>(); diff --git a/src/function.rs b/src/function.rs index d12bc77..bcd41bd 100644 --- a/src/function.rs +++ b/src/function.rs @@ -224,7 +224,7 @@ impl FunctionEntry { }); if apply_key | clicked { - *string = string.clone() + &selections[self.autocomplete.i]; + *string = string.clone() + selections[self.autocomplete.i]; push_cursor = true; } else { ui.memory().open_popup(popup_id); @@ -249,7 +249,7 @@ impl FunctionEntry { TextEdit::store_state(ui.ctx(), te_id, state); } } - return func_edit_focus; + func_edit_focus } /// Creates and does the math for creating all the rectangles under the @@ -267,7 +267,7 @@ impl FunctionEntry { let sum_func = self.get_sum_func(*sum); - let data2: Vec<(f64, f64)> = dyn_iter(&step_helper(*integral_num, &integral_min_x, &step)) + let data2: Vec<(f64, f64)> = dyn_iter(&step_helper(*integral_num, integral_min_x, &step)) .map(|x| { let step_offset = step * x.signum(); // store the offset here so it doesn't have to be calculated multiple times let x2: f64 = x + step_offset; @@ -299,16 +299,16 @@ impl FunctionEntry { let range = self.min_x..self.max_x; let newtons_method_output: Vec = match derivative_level { 0 => newtons_method_helper( - &threshold, + threshold, &range, - &self.back_data.as_ref().unwrap(), + self.back_data.as_ref().unwrap(), &|x: f64| self.function.get(x), &|x: f64| self.function.get_derivative_1(x), ), 1 => newtons_method_helper( - &threshold, + threshold, &range, - &self.derivative_data.as_ref().unwrap(), + self.derivative_data.as_ref().unwrap(), &|x: f64| self.function.get_derivative_1(x), &|x: f64| self.function.get_derivative_2(x), ), @@ -331,7 +331,7 @@ impl FunctionEntry { &mut self, min_x: &f64, max_x: &f64, width_changed: bool, settings: &AppSettings, ) { let resolution: f64 = settings.plot_width as f64 / (max_x.abs() + min_x.abs()); - let resolution_iter = resolution_helper(&settings.plot_width + 1, &min_x, &resolution); + let resolution_iter = resolution_helper(&settings.plot_width + 1, min_x, &resolution); // Makes sure proper arguments are passed when integral is enabled if self.integral && settings.integral_changed { diff --git a/src/misc.rs b/src/misc.rs index 178a1b0..1a58dff 100644 --- a/src/misc.rs +++ b/src/misc.rs @@ -260,7 +260,7 @@ pub fn newtons_method_helper( .filter(|(prev, curr)| !prev.y.is_nan() && !curr.y.is_nan()) .filter(|(prev, curr)| prev.y.signum() != curr.y.signum()) .map(|(prev, _)| prev.x) - .map(|start_x| newtons_method(f, f_1, &start_x, &range, &threshold).unwrap_or(f64::NAN)) + .map(|start_x| newtons_method(f, f_1, &start_x, range, threshold).unwrap_or(f64::NAN)) .filter(|x| !x.is_nan()) .collect() } diff --git a/src/suggestions.rs b/src/suggestions.rs index f59a3c8..49982fe 100644 --- a/src/suggestions.rs +++ b/src/suggestions.rs @@ -52,7 +52,7 @@ impl ToString for HintEnum<'static> { .iter() .map(|a| a.to_string()) .collect::() - .to_string(), + , HintEnum::None => String::new(), } } @@ -196,10 +196,7 @@ pub fn get_completion(key: String) -> Option> { return None; } - match COMPLETION_HASHMAP.get(&key) { - Some(data_x) => Some(data_x.clone()), - None => None, - } + COMPLETION_HASHMAP.get(&key).cloned() } /*