diff options
| author | Arne Dußin | 2020-11-21 01:12:07 +0100 |
|---|---|---|
| committer | Arne Dußin | 2020-11-21 01:12:07 +0100 |
| commit | 32aec90d0fac637e165913f194422e5b3d96de36 (patch) | |
| tree | d7a10b6c9706c4de4e2a1da8e9c1ee8f5dd29d65 /src/math/polygon_graph.rs | |
| parent | 8785fda836fe3884bd51444fc55983fe135c6c9d (diff) | |
| download | graf_karto-32aec90d0fac637e165913f194422e5b3d96de36.tar.gz graf_karto-32aec90d0fac637e165913f194422e5b3d96de36.zip | |
Apply clippy lints
Diffstat (limited to 'src/math/polygon_graph.rs')
| -rw-r--r-- | src/math/polygon_graph.rs | 10 |
1 files changed, 3 insertions, 7 deletions
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<T: Scalar + Copy> { } struct EdgeIterator<'a, T: Scalar + Copy> { - nodes: &'a Vec<Node<T>>, + nodes: &'a [Node<T>], pos: (usize, usize), } @@ -39,7 +39,7 @@ fn find_node<T: Scalar + Copy + PartialOrd>( } impl<'a, T: Scalar + Copy> EdgeIterator<'a, T> { - pub fn new(nodes: &'a Vec<Node<T>>) -> Self { + pub fn new(nodes: &'a [Node<T>]) -> Self { Self { nodes, pos: (0, 0) } } } @@ -99,11 +99,7 @@ impl<T: Scalar + Copy + PartialOrd> PolygonGraph<T> { pub fn has_edge(&self, from: &Vec2<T>, to: &Vec2<T>) -> 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 } |
