From ec03931924136a0a8225e936d3e1d221bdc08749 Mon Sep 17 00:00:00 2001 From: imrn99 Date: Tue, 21 May 2024 07:22:28 +0200 Subject: [PATCH] fix warnings is this lint even working correctly? --- integraal/src/structure/implementations.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/integraal/src/structure/implementations.rs b/integraal/src/structure/implementations.rs index d0b62d1..f3ccc58 100644 --- a/integraal/src/structure/implementations.rs +++ b/integraal/src/structure/implementations.rs @@ -6,6 +6,7 @@ use crate::{ ComputeMethod, DomainDescriptor, FunctionDescriptor, Integraal, IntegraalError, Scalar, }; use num::abs; +use std::ops::Deref; // ------ CONTENT @@ -28,7 +29,11 @@ impl<'a, X: Scalar> Integraal<'a, X> { self } - #[allow(clippy::missing_errors_doc, clippy::too_many_lines)] + #[allow( + clippy::missing_errors_doc, + clippy::missing_panics_doc, + clippy::too_many_lines + )] /// This method attempts to compute the integral. If it is successful, it will clear the /// internal [`FunctionDescriptor`] object before returning the result. /// @@ -138,7 +143,7 @@ impl<'a, X: Scalar> Integraal<'a, X> { Some(ComputeMethod::Trapezoid) => (1..args.len()) .map(|idx| { let step = args[idx] - args[idx - 1]; - let y1 = closure.clone()(args[idx - 1]); + let y1 = closure.deref()(args[idx - 1]); let y2 = closure(args[idx]); (y1.min(y2) + (y1 - y2).abs() / X::from_f32(2.0).unwrap()) * step }) @@ -175,7 +180,7 @@ impl<'a, X: Scalar> Integraal<'a, X> { .map(|step_id| { let x1 = *start + *step * X::from_usize(step_id - 1).unwrap(); let x2 = *start + *step * X::from_usize(step_id).unwrap(); - let y1 = closure.clone()(x1); + let y1 = closure.deref()(x1); let y2 = closure(x2); (y1.min(y2) + (y1 - y2).abs() / X::from_f32(2.0).unwrap()) * *step })