From dbc7c9e7ef9bc698a277a6518fb3c51346747d81 Mon Sep 17 00:00:00 2001 From: Sebastian Tobie Date: Mon, 16 Dec 2024 20:42:16 +0100 Subject: [PATCH] formatted some code --- src/bin/2024/02.rs | 7 +++++-- src/bin/2024/03.rs | 10 +++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/bin/2024/02.rs b/src/bin/2024/02.rs index fd7e1f4..c1b3145 100644 --- a/src/bin/2024/02.rs +++ b/src/bin/2024/02.rs @@ -1,6 +1,9 @@ -use advent_of_code::{strings::{convert_to_array, parsenumber}, KD}; #[allow(unused_imports)] use advent_of_code::{include_data, include_example}; +use advent_of_code::{ + strings::{convert_to_array, parsenumber}, + KD, +}; include_data!(DATA 2024 02); @@ -73,7 +76,7 @@ fn safe(record: Vec) -> bool { match (direction, last > level) { (KD::Top, false) | (KD::Bottom, true) => last = level, (KD::Top, true) | (KD::Bottom, false) => errors += 1, - _=>unreachable!() + _ => unreachable!(), } } if errors > 0 { diff --git a/src/bin/2024/03.rs b/src/bin/2024/03.rs index 134aa67..66aafd4 100644 --- a/src/bin/2024/03.rs +++ b/src/bin/2024/03.rs @@ -5,21 +5,21 @@ use regex::{Captures, Regex}; include_data!(DATA 2024 03); -fn parse_part1(input : Vec>) -> u32 { +fn parse_part1(input: Vec>) -> u32 { let mut sum = 0; - let (mut i,mut j): (u32, u32); + let (mut i, mut j): (u32, u32); for capture in input { i = parsenumber(capture.name("i").unwrap().as_str()); - j=parsenumber(capture.name("j").unwrap().as_str()); + j = parsenumber(capture.name("j").unwrap().as_str()); sum += i * j } sum } -fn parse_part2(input : Vec>)->u32 { +fn parse_part2(input: Vec>) -> u32 { let mut sum = 0; let mut parse = true; - let (mut i,mut j): (u32, u32); + let (mut i, mut j): (u32, u32); for capture in input { match (capture.get(1).unwrap().as_str(), parse) { ("do()", _) => parse = true,