From 2838eb5a25c39e8bd51b18b90b4d58cc339a7074 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20M=C3=BCller?= Date: Thu, 2 Jul 2026 22:13:23 +0200 Subject: [PATCH] Remove &self from printing department solver methods --- src/solvers/printing_department.rs | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/solvers/printing_department.rs b/src/solvers/printing_department.rs index 8480850..767ab8a 100644 --- a/src/solvers/printing_department.rs +++ b/src/solvers/printing_department.rs @@ -9,7 +9,7 @@ impl PrintingDepartment { const PAPER_ROLL_CHAR: char = '@'; const MAX_NEIGHBORS_ACCESSIBLE: u8 = 3; - fn init_paper_roll_grid(&self, reader: R) -> Grid> { + fn init_paper_roll_grid(reader: R) -> Grid> { let mut grid = Grid::new(0, 0); for line in reader.lines().map_while(Result::ok) { grid.push_row( @@ -21,7 +21,7 @@ impl PrintingDepartment { grid } - fn count_neighbors(&self, grid: &mut Grid>) -> Vec { + fn count_neighbors(grid: &mut Grid>) -> Vec { let mut removables = Vec::new(); let mut location = Point2(0, 0); // Loops over the grid. @@ -54,11 +54,7 @@ impl PrintingDepartment { removables } - fn count_removable_paper_rolls( - &self, - mut grid: Grid>, - mut removables: Vec, - ) -> u64 { + fn count_removable_paper_rolls(mut grid: Grid>, mut removables: Vec) -> u64 { // Considers everything in "removables" as already counted. let mut result = removables.len() as u64; while let Some(current) = removables.pop() { @@ -86,9 +82,9 @@ impl Solver for PrintingDepartment { const PUZZLE_NAME: &'static str = "Printing Department"; fn process_data(&self, reader: R) -> (u64, u64) { - let mut grid = self.init_paper_roll_grid(reader); - let removables = self.count_neighbors(&mut grid); + let mut grid = Self::init_paper_roll_grid(reader); + let removables = Self::count_neighbors(&mut grid); let part1 = removables.len() as u64; - (part1, self.count_removable_paper_rolls(grid, removables)) + (part1, Self::count_removable_paper_rolls(grid, removables)) } }