chore: clippy + time

This commit is contained in:
Xavier Morel
2024-12-10 14:08:36 +01:00
parent 6baedf6fde
commit 4df513a1a7
2 changed files with 2 additions and 24 deletions

View File

@@ -35,8 +35,9 @@ Solutions for [Advent of Code](https://adventofcode.com/) in [Rust](https://www.
| [Day 7](./src/bin/07.rs) | `43.5ms` | `3.7s` | | [Day 7](./src/bin/07.rs) | `43.5ms` | `3.7s` |
| [Day 8](./src/bin/08.rs) | `110.0µs` | `395.4µs` | | [Day 8](./src/bin/08.rs) | `110.0µs` | `395.4µs` |
| [Day 9](./src/bin/09.rs) | `897.8µs` | `549.0ms` | | [Day 9](./src/bin/09.rs) | `897.8µs` | `549.0ms` |
| [Day 10](./src/bin/10.rs) | `836.4µs` | `1.6ms` |
**Total: 12224.23ms** **Total: 12226.66ms**
<!--- benchmarking table ---> <!--- benchmarking table --->
--- ---

View File

@@ -1,7 +1,5 @@
advent_of_code::solution!(10); advent_of_code::solution!(10);
use std::iter::successors;
#[derive(Debug, Clone, PartialOrd, Ord, PartialEq, Eq)] #[derive(Debug, Clone, PartialOrd, Ord, PartialEq, Eq)]
struct Pos { struct Pos {
x: usize, x: usize,
@@ -94,27 +92,6 @@ impl Topo {
} }
} }
fn print_route(route: Vec<(Pos, u8)>, max: &Pos) {
println!("==========");
for y in 0..max.y {
print!("|");
for x in 0..max.x {
let mut found = false;
for r in &route {
if r.0.x == x && r.0.y == y {
found = true;
print!("{}", r.1);
}
}
if !found {
print!(" ");
}
}
println!("|");
}
println!("==========");
}
pub fn part_one(input: &str) -> Option<usize> { pub fn part_one(input: &str) -> Option<usize> {
let topo = Topo::init(input).ok()?; let topo = Topo::init(input).ok()?;
let ths = topo.get_trailheads(); let ths = topo.get_trailheads();