Skip to content

Commit f64a345

Browse files
committed
Bit of refactoring, fixing clippy warnings
1 parent f9ed53c commit f64a345

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

121 files changed

+296
-279
lines changed

aoc-solver/src/solution.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ impl std::fmt::Display for AocError {
3232
}
3333

3434
pub trait Solution {
35-
type A: fmt::Display;
36-
type B: fmt::Display;
35+
type Part1: fmt::Display;
36+
type Part2: fmt::Display;
3737

3838
fn default_input(&self) -> &'static str;
3939

40-
fn part_1(&self, input: &str) -> Result<Self::A, AocError>;
41-
fn part_2(&self, input: &str) -> Result<Self::B, AocError>;
40+
fn part_1(&self, input: &str) -> Result<Self::Part1, AocError>;
41+
fn part_2(&self, input: &str) -> Result<Self::Part2, AocError>;
4242

4343
fn run(&self, input: Option<String>, day: u32, year: u32) -> Vec<String> {
4444
let input = input.unwrap_or_else(|| self.default_input().to_owned());

aoc-solver/src/y2020/day01.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ use crate::solution::{AocError, Solution};
33
pub struct Day01;
44

55
impl Solution for Day01 {
6-
type A = usize;
7-
type B = usize;
6+
type Part1 = usize;
7+
type Part2 = usize;
88

99
fn default_input(&self) -> &'static str {
1010
include_str!("../../../inputs/2020/day01.txt")

aoc-solver/src/y2020/day02.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ fn parse_input(input: &str) -> Vec<DatabaseRow> {
4545
}
4646

4747
impl Solution for Day02 {
48-
type A = usize;
49-
type B = usize;
48+
type Part1 = usize;
49+
type Part2 = usize;
5050

5151
fn default_input(&self) -> &'static str {
5252
include_str!("../../../inputs/2020/day02.txt")

aoc-solver/src/y2020/day03.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ fn parse(input: &str) -> (HashSet<(usize, usize)>, usize, usize) {
4444
}
4545

4646
impl Solution for Day03 {
47-
type A = usize;
48-
type B = usize;
47+
type Part1 = usize;
48+
type Part2 = usize;
4949

5050
fn default_input(&self) -> &'static str {
5151
include_str!("../../../inputs/2020/day03.txt")

aoc-solver/src/y2020/day04.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,8 @@ fn parse_passport_part2(input: &str) -> IResult<&str, Passport> {
178178
}
179179

180180
impl Solution for Day04 {
181-
type A = usize;
182-
type B = usize;
181+
type Part1 = usize;
182+
type Part2 = usize;
183183

184184
fn default_input(&self) -> &'static str {
185185
include_str!("../../../inputs/2020/day04.txt")

aoc-solver/src/y2020/day05.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ fn parse_boarding_pass(input: &str) -> BoardingPass {
3030
}
3131

3232
impl Solution for Day05 {
33-
type A = usize;
34-
type B = usize;
33+
type Part1 = usize;
34+
type Part2 = usize;
3535

3636
fn default_input(&self) -> &'static str {
3737
include_str!("../../../inputs/2020/day05.txt")

aoc-solver/src/y2020/day06.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ fn parse_answers_2(input: &str) -> HashSet<char> {
2525
}
2626

2727
impl Solution for Day06 {
28-
type A = usize;
29-
type B = usize;
28+
type Part1 = usize;
29+
type Part2 = usize;
3030

3131
fn default_input(&self) -> &'static str {
3232
include_str!("../../../inputs/2020/day06.txt")

aoc-solver/src/y2020/day07.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ fn find_inner_bags_count(current: String, rules: HashMap<String, Rule>) -> usize
8484
}
8585

8686
impl Solution for Day07 {
87-
type A = usize;
88-
type B = usize;
87+
type Part1 = usize;
88+
type Part2 = usize;
8989

9090
fn default_input(&self) -> &'static str {
9191
include_str!("../../../inputs/2020/day07.txt")

aoc-solver/src/y2020/day08.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ fn parse_instruction(input: &str) -> IResult<&str, Instruction> {
8787
}
8888

8989
impl Solution for Day08 {
90-
type A = i32;
91-
type B = i32;
90+
type Part1 = i32;
91+
type Part2 = i32;
9292

9393
fn default_input(&self) -> &'static str {
9494
include_str!("../../../inputs/2020/day08.txt")

aoc-solver/src/y2020/day09.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ fn solve_part2(input: &str, preamble_len: usize) -> Result<usize, AocError> {
6969
}
7070

7171
impl Solution for Day09 {
72-
type A = usize;
73-
type B = usize;
72+
type Part1 = usize;
73+
type Part2 = usize;
7474

7575
fn default_input(&self) -> &'static str {
7676
include_str!("../../../inputs/2020/day09.txt")

0 commit comments

Comments
 (0)