From 32aec90d0fac637e165913f194422e5b3d96de36 Mon Sep 17 00:00:00 2001 From: Arne Dußin Date: Sat, 21 Nov 2020 01:12:07 +0100 Subject: Apply clippy lints --- src/math/polygon_graph.rs | 10 +++------- src/math/triangle.rs | 6 ++---- 2 files changed, 5 insertions(+), 11 deletions(-) (limited to 'src/math') diff --git a/src/math/polygon_graph.rs b/src/math/polygon_graph.rs index 7721cbf..14b2b0d 100644 --- a/src/math/polygon_graph.rs +++ b/src/math/polygon_graph.rs @@ -9,7 +9,7 @@ struct Node { } struct EdgeIterator<'a, T: Scalar + Copy> { - nodes: &'a Vec>, + nodes: &'a [Node], pos: (usize, usize), } @@ -39,7 +39,7 @@ fn find_node( } impl<'a, T: Scalar + Copy> EdgeIterator<'a, T> { - pub fn new(nodes: &'a Vec>) -> Self { + pub fn new(nodes: &'a [Node]) -> Self { Self { nodes, pos: (0, 0) } } } @@ -99,11 +99,7 @@ impl PolygonGraph { pub fn has_edge(&self, from: &Vec2, to: &Vec2) -> bool { // Binary search the starting and then the end node. if let Ok(from) = find_node(&self.nodes, from) { - if let Ok(_) = find_vec2(&self.nodes[from].adjacent, to) { - true - } else { - false - } + find_vec2(&self.nodes[from].adjacent, to).is_ok() } else { false } diff --git a/src/math/triangle.rs b/src/math/triangle.rs index 05e258d..5cf16e5 100644 --- a/src/math/triangle.rs +++ b/src/math/triangle.rs @@ -138,12 +138,10 @@ where let angle = ((ba * bc) / (ba.length() * bc.length())).acos(); // Make angle into a full circle angle by looking at the orientation of the triplet. - let angle = match orientation { + match orientation { TripletOrientation::Counterclockwise => T::pi() + (T::pi() - angle), _ => angle, - }; - - angle + } } #[cfg(test)] -- cgit v1.2.3-70-g09d2