Skip to content

Commit

Permalink
refactor: use self in parse method
Browse files Browse the repository at this point in the history
  • Loading branch information
manhunto committed Dec 1, 2024
1 parent d354ddc commit f22e4d3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/solutions/year2024/day01.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pub struct Day01;

impl Solution for Day01 {
fn part_one(&self, input: &str) -> String {
let (mut left, mut right) = Self::parse(input);
let (mut left, mut right) = self.parse(input);

left.sort_unstable();
right.sort_unstable();
Expand All @@ -17,7 +17,7 @@ impl Solution for Day01 {
}

fn part_two(&self, input: &str) -> String {
let (left, right) = Self::parse(input);
let (left, right) = self.parse(input);

left.iter()
.map(|l| right.iter().filter(|r| *r == l).count() as i32 * l)
Expand All @@ -27,7 +27,7 @@ impl Solution for Day01 {
}

impl Day01 {
fn parse(input: &str) -> (Vec<i32>, Vec<i32>) {
fn parse(&self, input: &str) -> (Vec<i32>, Vec<i32>) {
input
.lines()
.map(|line| {
Expand Down

0 comments on commit f22e4d3

Please sign in to comment.