From d0c43bdd6d87ac5fb78b220d71959d55a3f3848a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateus=20Felipe=20Gon=C3=A7alves?= Date: Fri, 24 Nov 2023 16:24:54 +0000 Subject: [PATCH] style(clippy): fix linting issues --- src/shapes/circle/structs.rs | 2 +- src/shapes/rhombus/structs.rs | 2 +- src/shapes/trapezoid/structs.rs | 2 +- src/shapes/triangle/structs.rs | 8 ++++---- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/shapes/circle/structs.rs b/src/shapes/circle/structs.rs index 3142c60..792f837 100644 --- a/src/shapes/circle/structs.rs +++ b/src/shapes/circle/structs.rs @@ -6,7 +6,7 @@ impl Circle { pub fn get_area(&self) -> f64 { let pi = std::f64::consts::PI; - return &self.radius * pi.powi(2); + self.radius * pi.powi(2) } } diff --git a/src/shapes/rhombus/structs.rs b/src/shapes/rhombus/structs.rs index dd61c89..c653c40 100644 --- a/src/shapes/rhombus/structs.rs +++ b/src/shapes/rhombus/structs.rs @@ -5,7 +5,7 @@ pub struct Rhombus { impl Rhombus { pub fn get_area(&self) -> f32 { - (&self.s_diagonal * &self.l_diagonal) / 2.0 + (self.s_diagonal * self.l_diagonal) / 2.0 } } diff --git a/src/shapes/trapezoid/structs.rs b/src/shapes/trapezoid/structs.rs index 95520c1..295bbf6 100644 --- a/src/shapes/trapezoid/structs.rs +++ b/src/shapes/trapezoid/structs.rs @@ -6,7 +6,7 @@ pub struct Trapezoid { impl Trapezoid { pub fn get_area(&self) -> f32 { - ((&self.l_base + &self.s_base) * &self.height) / 2.0 + ((self.l_base + self.s_base) * self.height) / 2.0 } } diff --git a/src/shapes/triangle/structs.rs b/src/shapes/triangle/structs.rs index 6800ad0..892ff8b 100644 --- a/src/shapes/triangle/structs.rs +++ b/src/shapes/triangle/structs.rs @@ -5,7 +5,7 @@ pub struct SimpleTriangle { impl SimpleTriangle { pub fn get_area(&self) -> f32 { - (&self.base * &self.height) / 2.0 + (self.base * self.height) / 2.0 } } @@ -17,14 +17,14 @@ pub struct SidesTriangle { impl SidesTriangle { pub fn get_semi_perimeter(&self) -> f32 { - (&self.side_a + &self.side_b + &self.side_c) / 2.0 + (self.side_a + self.side_b + self.side_c) / 2.0 } pub fn get_area(&self) -> f32 { let p: f32 = self.get_semi_perimeter(); - let sides_and_p: f32 = p * (p - &self.side_a) * (p - &self.side_b) * (p - &self.side_c); + let sides_and_p: f32 = p * (p - self.side_a) * (p - self.side_b) * (p - self.side_c); - return sides_and_p.sqrt(); + sides_and_p.sqrt() } }