mirror of
https://github.com/mx42/aoc2024.rs.git
synced 2026-01-14 13:59:52 +01:00
chore: clippy
This commit is contained in:
@@ -78,7 +78,7 @@ fn bfs(walls: &HashMap<Pos, usize>, start: Pos, end: &Pos) -> Option<Vec<Pos>> {
|
|||||||
if current == *end {
|
if current == *end {
|
||||||
let mut path = vec![];
|
let mut path = vec![];
|
||||||
let mut parent = current.clone();
|
let mut parent = current.clone();
|
||||||
while let Some(&ref p) = parent_map.get(&parent) {
|
while let Some(p) = parent_map.get(&parent) {
|
||||||
path.push(p.clone());
|
path.push(p.clone());
|
||||||
parent = p.clone();
|
parent = p.clone();
|
||||||
}
|
}
|
||||||
@@ -129,7 +129,7 @@ fn bfs(walls: &HashMap<Pos, usize>, start: Pos, end: &Pos) -> Option<Vec<Pos>> {
|
|||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
||||||
fn print_map(size: &Pos, walls: &HashMap<Pos, usize>, path: &Vec<Pos>) {
|
fn print_map(size: &Pos, walls: &HashMap<Pos, usize>, path: &[Pos]) {
|
||||||
for y in 0..=size.y {
|
for y in 0..=size.y {
|
||||||
for x in 0..=size.x {
|
for x in 0..=size.x {
|
||||||
let p = Pos::init(x, y);
|
let p = Pos::init(x, y);
|
||||||
@@ -166,7 +166,7 @@ pub fn part_two(input: &str) -> Option<String> {
|
|||||||
Pos::init(70, 70)
|
Pos::init(70, 70)
|
||||||
};
|
};
|
||||||
|
|
||||||
print_map(&end, &coords, &vec![]);
|
print_map(&end, &coords, &[]);
|
||||||
|
|
||||||
let route = bfs(&coords, Pos::init(0, 0), &end);
|
let route = bfs(&coords, Pos::init(0, 0), &end);
|
||||||
println!("{:?}", route);
|
println!("{:?}", route);
|
||||||
|
|||||||
Reference in New Issue
Block a user