clippies
This commit is contained in:
parent
35637cece1
commit
1a6d37f4f3
@ -11,5 +11,6 @@ repos:
|
|||||||
# Simply remove the comments (#) below for args and the flags you want.
|
# Simply remove the comments (#) below for args and the flags you want.
|
||||||
args:
|
args:
|
||||||
- --auto-add-tiles-to-git=amend
|
- --auto-add-tiles-to-git=amend
|
||||||
|
- --create-all-days
|
||||||
# - --language-sorting=jl,kt,py,rs
|
# - --language-sorting=jl,kt,py,rs
|
||||||
# - --exclude-patterns=2021/*/*.apl,2021/*/*.py,2021/*/*.cpp
|
# - --exclude-patterns=2021/*/*.apl,2021/*/*.py,2021/*/*.cpp
|
||||||
|
@ -10,7 +10,7 @@ pub fn get_input(input: &[u8]) -> Vec<String> {
|
|||||||
|
|
||||||
// PROBLEM 1 solution
|
// PROBLEM 1 solution
|
||||||
#[aoc(day3, part1)]
|
#[aoc(day3, part1)]
|
||||||
pub fn part1(input: &Vec<String>) -> u64 {
|
pub fn part1(input: &[String]) -> u64 {
|
||||||
let re = Regex::new(r"(?-u)mul\((\d+),(\d+)\)").unwrap();
|
let re = Regex::new(r"(?-u)mul\((\d+),(\d+)\)").unwrap();
|
||||||
input
|
input
|
||||||
.iter()
|
.iter()
|
||||||
@ -24,7 +24,7 @@ pub fn part1(input: &Vec<String>) -> u64 {
|
|||||||
|
|
||||||
// PROBLEM 2 solution
|
// PROBLEM 2 solution
|
||||||
#[aoc(day3, part2)]
|
#[aoc(day3, part2)]
|
||||||
pub fn part2(input: &Vec<String>) -> u64 {
|
pub fn part2(input: &[String]) -> u64 {
|
||||||
let mut sum = 0u64;
|
let mut sum = 0u64;
|
||||||
let mut do_mul: u64 = 1;
|
let mut do_mul: u64 = 1;
|
||||||
let re = Regex::new(r"(?-u)(do\(\)|don't\(\)|mul\((\d+),(\d+)\))").unwrap();
|
let re = Regex::new(r"(?-u)(do\(\)|don't\(\)|mul\((\d+),(\d+)\))").unwrap();
|
||||||
|
@ -65,10 +65,7 @@ impl OrderingRules {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn is_sorted(&self, a: u64, b: u64) -> bool {
|
fn is_sorted(&self, a: u64, b: u64) -> bool {
|
||||||
match self.pairs.get(&(a, b)) {
|
matches!(self.pairs.get(&(a, b)), Some(Ordering::Less) | Some(Ordering::Equal))
|
||||||
Some(Ordering::Less) | Some(Ordering::Equal) => true,
|
|
||||||
_ => false,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,5 +12,6 @@ pub mod day9;
|
|||||||
pub mod day10;
|
pub mod day10;
|
||||||
pub mod day11;
|
pub mod day11;
|
||||||
pub mod day12;
|
pub mod day12;
|
||||||
|
pub mod day13;
|
||||||
|
|
||||||
aoc_lib! { year = 2024 }
|
aoc_lib! { year = 2024 }
|
||||||
|
3
src/main.rs
Normal file
3
src/main.rs
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
use aoc_runner_derive::aoc_main;
|
||||||
|
|
||||||
|
aoc_main!{ lib = aoc2024 }
|
Loading…
x
Reference in New Issue
Block a user