mirror of
https://github.com/mx42/aoc2024.rs.git
synced 2026-01-14 13:59:52 +01:00
ci: fix clippy
This commit is contained in:
@@ -19,9 +19,9 @@ Solutions for [Advent of Code](https://adventofcode.com/) in [Rust](https://www.
|
|||||||
| Day | Part 1 | Part 2 |
|
| Day | Part 1 | Part 2 |
|
||||||
| :---: | :---: | :---: |
|
| :---: | :---: | :---: |
|
||||||
| [Day 1](./src/bin/01.rs) | `72.0µs` | `76.8µs` |
|
| [Day 1](./src/bin/01.rs) | `72.0µs` | `76.8µs` |
|
||||||
| [Day 2](./src/bin/02.rs) | `333.6µs` | `642.1µs` |
|
| [Day 2](./src/bin/02.rs) | `215.6µs` | `371.6µs` |
|
||||||
|
|
||||||
**Total: 1.12ms**
|
**Total: 0.74ms**
|
||||||
<!--- benchmarking table --->
|
<!--- benchmarking table --->
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ advent_of_code::solution!(2);
|
|||||||
|
|
||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
|
|
||||||
fn validate_input_p1(input: &Vec<u32>) -> bool {
|
fn validate_input_p1(input: &[u32]) -> bool {
|
||||||
input
|
input
|
||||||
.iter()
|
.iter()
|
||||||
.fold(
|
.fold(
|
||||||
@@ -30,7 +30,7 @@ fn validate_input_p2(input: &Vec<u32>) -> bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for i in 0..input.len() {
|
for i in 0..input.len() {
|
||||||
let mut input2 = input.clone();
|
let mut input2 = input.to_owned();
|
||||||
input2.remove(i);
|
input2.remove(i);
|
||||||
if validate_input_p1(&input2) {
|
if validate_input_p1(&input2) {
|
||||||
return true;
|
return true;
|
||||||
@@ -50,7 +50,7 @@ pub fn part_one(input: &str) -> Option<usize> {
|
|||||||
.map(|nb| nb.parse::<u32>().expect("parsing failed"))
|
.map(|nb| nb.parse::<u32>().expect("parsing failed"))
|
||||||
.collect::<Vec<u32>>()
|
.collect::<Vec<u32>>()
|
||||||
})
|
})
|
||||||
.filter(validate_input_p1)
|
.filter(|s| validate_input_p1(s))
|
||||||
.count()
|
.count()
|
||||||
.into()
|
.into()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user