Day 3 done and pedantic clippy clean up

This commit is contained in:
Dylan Thies
2023-12-03 20:48:26 -05:00
parent 3ac75e55bf
commit ecbaf8f9fe
7 changed files with 259 additions and 14 deletions

View File

@@ -1,3 +1,5 @@
#![warn(clippy::all, clippy::pedantic)]
use log::debug;
use nom::{
bytes::complete::tag,
@@ -41,6 +43,13 @@ impl Game {
}
}
/// part2 of day 2 of AOC 2023
///
/// # Arguments
/// - input the puszzle input
///
/// # Panics
/// panics whenever the input isn't parsable
pub fn part1(input: &str) -> String {
let (_, games) = process_input(input).expect("there should be input");
debug!("{games:?}");

View File

@@ -1,3 +1,5 @@
#![warn(clippy::all, clippy::pedantic)]
use nom::{
bytes::complete::tag,
character::complete::{self, newline},
@@ -37,6 +39,13 @@ impl Game {
}
}
/// part2 of day 2 of AOC 2023
///
/// # Arguments
/// - input the puszzle input
///
/// # Panics
/// panics whenever the input isn't parsable
pub fn part2(input: &str) -> String {
let (_, games) = process_input(input).expect("there should be input");
games.iter().map(Game::to_power).sum::<u64>().to_string()