2024 day-5 clippy and done

This commit is contained in:
Dylan Thies
2024-12-05 11:47:14 -05:00
parent d320036973
commit 25dedc74fa
5 changed files with 320 additions and 0 deletions

31
2024/day-5/src/main.rs Normal file
View File

@@ -0,0 +1,31 @@
#![warn(clippy::all, clippy::pedantic)]
use day_5::part1;
use day_5::part2;
use error_stack::{Result, ResultExt};
use thiserror::Error;
#[cfg(feature = "dhat-heap")]
#[global_allocator]
static ALLOC: dhat::Alloc = dhat::Alloc;
#[derive(Debug, Error)]
enum Day5Error {
#[error("Part 1 failed")]
Part1Error,
#[error("Part 2 failed")]
Part2Error,
}
fn main() -> Result<(), Day5Error> {
#[cfg(feature = "dhat-heap")]
let _profiler = dhat::Profiler::new_heap();
let input = include_str!("./input.txt");
let part1_result = part1(input).change_context(Day5Error::Part1Error)?;
println!("part 1: {part1_result}");
let part2_result = part2(input).change_context(Day5Error::Part2Error)?;
println!("part 2: {part2_result}");
Ok(())
}