Skip to content

Commit 43c9f7d

Browse files
committed
Make clippy happy
1 parent 58dcc17 commit 43c9f7d

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

src/map.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,15 @@ impl ObstacleMap {
5050
}
5151

5252
pub fn shortest_path(&self, start: (f64, f64), goal: (f64, f64)) -> Vec<(f64, f64)> {
53-
PathPlanner::new(&self, start, goal).shortest_path()
53+
PathPlanner::new(self, start, goal).shortest_path()
5454
}
5555
}
5656

5757
impl ObstacleMap {
5858
pub fn as_vertices(&self) -> Vec<Coord> {
5959
self.obstacles
6060
.iter()
61-
.map(|obstacle| obstacle.as_vertices(&self.config))
62-
.flatten()
61+
.flat_map(|obstacle| obstacle.as_vertices(&self.config))
6362
.collect()
6463
}
6564

src/planner.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,18 +70,16 @@ impl PathPlanner {
7070
path.push(*previous);
7171
}
7272
path.reverse();
73-
return path
74-
.into_iter()
73+
path.into_iter()
7574
.map(|idx| self.vertices[idx].x_y())
76-
.collect();
75+
.collect()
7776
}
7877

7978
fn expand_node(&mut self, vertex: usize) {
80-
let g_vertex = self
79+
let g_vertex = *self
8180
.g_score
8281
.get(&vertex)
83-
.unwrap_or(&OrderedFloat(std::f64::INFINITY))
84-
.clone();
82+
.unwrap_or(&OrderedFloat(f64::INFINITY));
8583
for successor in self.successors.iter().cloned() {
8684
let multiplier = if self
8785
.obstacle
@@ -95,11 +93,10 @@ impl PathPlanner {
9593
} else {
9694
OrderedFloat(1.0)
9795
};
98-
let g_successor = self
96+
let g_successor = *self
9997
.g_score
10098
.get(&successor)
101-
.unwrap_or(&OrderedFloat(std::f64::INFINITY))
102-
.clone();
99+
.unwrap_or(&OrderedFloat(f64::INFINITY));
103100
let g_tentative = g_vertex + multiplier * self.distance(vertex, successor);
104101
if g_tentative < g_successor {
105102
self.from.insert(successor, vertex);

0 commit comments

Comments
 (0)