diff --git a/src/main.rs b/src/main.rs index 26be4a0..7424a29 100644 --- a/src/main.rs +++ b/src/main.rs @@ -18,4 +18,4 @@ fn main() { "2023" => year_2023::run(day), _ => panic!("Invalid year specified"), }; -} \ No newline at end of file +} diff --git a/src/utils/input_reader.rs b/src/utils/input_reader.rs index e7b2fb4..2faeb6a 100644 --- a/src/utils/input_reader.rs +++ b/src/utils/input_reader.rs @@ -3,11 +3,10 @@ use std::fs::File; use std::io::{self, BufRead}; use std::path::Path; - pub fn read_lines

(filename: P) -> io::Result>> where P: AsRef, { let file = File::open(filename)?; Ok(io::BufReader::new(file).lines()) -} \ No newline at end of file +} diff --git a/src/utils/mod.rs b/src/utils/mod.rs index b777308..053b667 100644 --- a/src/utils/mod.rs +++ b/src/utils/mod.rs @@ -1,2 +1,2 @@ pub mod input_reader; -pub mod solution; \ No newline at end of file +pub mod solution; diff --git a/src/year_2023/day_01_trebuchet/mod.rs b/src/year_2023/day_01_trebuchet/mod.rs index 7575fc9..a69fd56 100644 --- a/src/year_2023/day_01_trebuchet/mod.rs +++ b/src/year_2023/day_01_trebuchet/mod.rs @@ -6,7 +6,7 @@ use crate::utils::solution::Solution; pub struct Day1Solution; impl Solution for Day1Solution { - fn part_one(&self) -> String{ + fn part_one(&self) -> String { // Implementation for part one of day 1 // ... part_one::part_one() @@ -17,4 +17,4 @@ impl Solution for Day1Solution { // ... part_two::part_two() } -} \ No newline at end of file +} diff --git a/src/year_2023/day_01_trebuchet/part_two.rs b/src/year_2023/day_01_trebuchet/part_two.rs index 8b60128..37ee000 100644 --- a/src/year_2023/day_01_trebuchet/part_two.rs +++ b/src/year_2023/day_01_trebuchet/part_two.rs @@ -16,7 +16,6 @@ pub fn part_two() -> String { } } - fn parse_line(s: &str) -> u32 { const RADIX: u32 = 10; diff --git a/src/year_2023/day_02_cube_conundrum/mod.rs b/src/year_2023/day_02_cube_conundrum/mod.rs index 47dedb7..42eb2af 100644 --- a/src/year_2023/day_02_cube_conundrum/mod.rs +++ b/src/year_2023/day_02_cube_conundrum/mod.rs @@ -6,7 +6,7 @@ use crate::utils::solution::Solution; pub struct Day2Solution; impl Solution for Day2Solution { - fn part_one(&self) -> String{ + fn part_one(&self) -> String { // Implementation for part one of day 1 // ... part_one::part_one() @@ -17,4 +17,4 @@ impl Solution for Day2Solution { // ... part_two::part_two() } -} \ No newline at end of file +} diff --git a/src/year_2023/day_02_cube_conundrum/part_one.rs b/src/year_2023/day_02_cube_conundrum/part_one.rs index 0ec7a14..734f6ff 100644 --- a/src/year_2023/day_02_cube_conundrum/part_one.rs +++ b/src/year_2023/day_02_cube_conundrum/part_one.rs @@ -1,6 +1,6 @@ use crate::utils::input_reader; -pub fn part_one() -> String{ +pub fn part_one() -> String { if let Ok(lines) = input_reader::read_lines("./input/2023/day_02/input.txt") { let mut result = 0; diff --git a/src/year_2023/day_02_cube_conundrum/part_two.rs b/src/year_2023/day_02_cube_conundrum/part_two.rs index 64b3e51..9d71f49 100644 --- a/src/year_2023/day_02_cube_conundrum/part_two.rs +++ b/src/year_2023/day_02_cube_conundrum/part_two.rs @@ -22,15 +22,13 @@ pub fn part_two() -> String { } } - - fn process_line(s: &str) -> u32 { let v: Vec<&str> = s.split(':').collect(); v[0].split("Game ").collect::>()[1] .parse::() .unwrap(); - + let games: Vec<&str> = v[1].split(';').collect(); let mut min_game = Game { diff --git a/src/year_2023/day_03_gear_ratios/mod.rs b/src/year_2023/day_03_gear_ratios/mod.rs index 4f5eb87..8734eb2 100644 --- a/src/year_2023/day_03_gear_ratios/mod.rs +++ b/src/year_2023/day_03_gear_ratios/mod.rs @@ -1,12 +1,11 @@ pub mod part_one; - use crate::utils::solution::Solution; pub struct Day3Solution; impl Solution for Day3Solution { - fn part_one(&self) -> String{ + fn part_one(&self) -> String { // Implementation for part one of day 1 // ... part_one::part_one() @@ -17,4 +16,4 @@ impl Solution for Day3Solution { // ... String::from("Not implemented") } -} \ No newline at end of file +} diff --git a/src/year_2023/day_03_gear_ratios/part_one.rs b/src/year_2023/day_03_gear_ratios/part_one.rs index e43544c..476f683 100644 --- a/src/year_2023/day_03_gear_ratios/part_one.rs +++ b/src/year_2023/day_03_gear_ratios/part_one.rs @@ -19,7 +19,6 @@ pub fn part_one() -> String { } } - fn create_matrix(lines: io::Lines>) -> Vec> { let mut matrix: Vec> = Vec::new(); diff --git a/src/year_2023/day_04_scratchcards/mod.rs b/src/year_2023/day_04_scratchcards/mod.rs index a2378e4..45cd080 100644 --- a/src/year_2023/day_04_scratchcards/mod.rs +++ b/src/year_2023/day_04_scratchcards/mod.rs @@ -1,12 +1,11 @@ pub mod part_one; - use crate::utils::solution::Solution; pub struct Day4Solution; impl Solution for Day4Solution { - fn part_one(&self) -> String{ + fn part_one(&self) -> String { // Implementation for part one of day 1 // ... part_one::part_one() @@ -17,4 +16,4 @@ impl Solution for Day4Solution { // ... String::from("Not implemented") } -} \ No newline at end of file +} diff --git a/src/year_2023/day_04_scratchcards/part_one.rs b/src/year_2023/day_04_scratchcards/part_one.rs index aab305f..0327e22 100644 --- a/src/year_2023/day_04_scratchcards/part_one.rs +++ b/src/year_2023/day_04_scratchcards/part_one.rs @@ -17,7 +17,6 @@ pub fn part_one() -> String { } fn process_line(s: &str) -> u32 { - let mut winning_numbers = HashSet::new(); let mut res = 0; @@ -45,5 +44,3 @@ fn process_line(s: &str) -> u32 { return res; } - - diff --git a/src/year_2023/day_06_wait_for_it/mod.rs b/src/year_2023/day_06_wait_for_it/mod.rs index d9ed005..8e7753a 100644 --- a/src/year_2023/day_06_wait_for_it/mod.rs +++ b/src/year_2023/day_06_wait_for_it/mod.rs @@ -1,13 +1,12 @@ pub mod part_one; pub mod part_two; - use crate::utils::solution::Solution; pub struct Day6Solution; impl Solution for Day6Solution { - fn part_one(&self) -> String{ + fn part_one(&self) -> String { // Implementation for part one of day 1 // ... part_one::part_one() @@ -18,4 +17,4 @@ impl Solution for Day6Solution { // ... part_two::part_two() } -} \ No newline at end of file +} diff --git a/src/year_2023/day_06_wait_for_it/part_one.rs b/src/year_2023/day_06_wait_for_it/part_one.rs index 392b441..f7cd112 100644 --- a/src/year_2023/day_06_wait_for_it/part_one.rs +++ b/src/year_2023/day_06_wait_for_it/part_one.rs @@ -40,5 +40,3 @@ fn process_race_result(time: u32, distance: u32) -> u32 { return win_count; } - - diff --git a/src/year_2023/day_06_wait_for_it/part_two.rs b/src/year_2023/day_06_wait_for_it/part_two.rs index d4905f1..6407c0c 100644 --- a/src/year_2023/day_06_wait_for_it/part_two.rs +++ b/src/year_2023/day_06_wait_for_it/part_two.rs @@ -37,5 +37,3 @@ fn process_race_result(time: u64, distance: u64) -> u64 { return win_count; } - - diff --git a/src/year_2023/mod.rs b/src/year_2023/mod.rs index 9005afc..6e2b503 100644 --- a/src/year_2023/mod.rs +++ b/src/year_2023/mod.rs @@ -19,4 +19,4 @@ pub fn run(day: &str) { // Call part_one and part_two on the solution instance println!("Part One Result: {}", solution.part_one()); println!("Part Two Result: {}", solution.part_two()); -} \ No newline at end of file +}