Skip to content

Commit

Permalink
style(clippy): fix linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mateusfg7 committed Nov 24, 2023
1 parent 551b30b commit d0c43bd
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/shapes/circle/structs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/shapes/rhombus/structs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/shapes/trapezoid/structs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/shapes/triangle/structs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand All @@ -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()
}
}

Expand Down

0 comments on commit d0c43bd

Please sign in to comment.