refactor(day-01): use new template

This commit is contained in:
2024-12-01 21:06:59 +02:00
parent 9020a27a4a
commit cf14bce68e
13 changed files with 77 additions and 2008 deletions

View File

@@ -1,9 +1,12 @@
use color_eyre::Result;
use day_01::part1::process;
use miette::{Context, Result};
#[tracing::instrument]
fn main() -> Result<()> {
tracing_subscriber::fmt::init();
let file = include_str!("../../input1.txt");
let result = process(file)?;
let result = process(file).context("process part 1")?;
println!("{}", result);
Ok(())
}

View File

@@ -1,9 +1,12 @@
use color_eyre::Result;
use day_01::part2::process;
use miette::{Context, Result};
#[tracing::instrument]
fn main() -> Result<()> {
tracing_subscriber::fmt::init();
let file = include_str!("../../input2.txt");
let result = process(file)?;
let result = process(file).context("process part 2")?;
println!("{}", result);
Ok(())
}

View File

@@ -1,5 +1,6 @@
use color_eyre::Result;
use miette::Result;
#[tracing::instrument]
pub fn process(input: &str) -> Result<usize> {
let (mut firsts, mut lasts): (Vec<_>, Vec<_>) = input
.lines()

View File

@@ -1,5 +1,6 @@
use color_eyre::Result;
use miette::Result;
#[tracing::instrument]
pub fn process(input: &str) -> Result<usize> {
let sum = {
let (firsts, lasts): (Vec<_>, Vec<_>) = input