Fix clippy warnings
This commit is contained in:
parent
7e9e3e63c3
commit
100a8c3a6a
4 changed files with 4 additions and 6 deletions
|
@ -12,8 +12,7 @@ pub(crate) fn part_1(input: &[[[u32; 2]; 2]]) -> usize {
|
||||||
let times_contained = input
|
let times_contained = input
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|sections| sections_contain_each_other(**sections))
|
.filter(|sections| sections_contain_each_other(**sections))
|
||||||
.collect::<Vec<_>>()
|
.count();
|
||||||
.len();
|
|
||||||
println!("Part 1: {times_contained}");
|
println!("Part 1: {times_contained}");
|
||||||
times_contained
|
times_contained
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,8 +12,7 @@ pub(crate) fn part_2(input: &[[[u32; 2]; 2]]) -> usize {
|
||||||
let times_overlapped = input
|
let times_overlapped = input
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|sections| sections_overlap(**sections))
|
.filter(|sections| sections_overlap(**sections))
|
||||||
.collect::<Vec<_>>()
|
.count();
|
||||||
.len();
|
|
||||||
println!("Part 2: {times_overlapped}");
|
println!("Part 2: {times_overlapped}");
|
||||||
times_overlapped
|
times_overlapped
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ use std::collections::HashSet;
|
||||||
|
|
||||||
use crate::Move;
|
use crate::Move;
|
||||||
|
|
||||||
pub(crate) fn part_1(input: &Vec<Move>) -> usize {
|
pub(crate) fn part_1(input: &[Move]) -> usize {
|
||||||
let mut head_position = (0i64, 0i64);
|
let mut head_position = (0i64, 0i64);
|
||||||
let mut tail_position = (0i64, 0i64);
|
let mut tail_position = (0i64, 0i64);
|
||||||
let mut visited_tail_positions = HashSet::new();
|
let mut visited_tail_positions = HashSet::new();
|
||||||
|
|
|
@ -52,7 +52,7 @@ fn tail_update(diff: (i64, i64)) -> (i64, i64) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn part_2(input: &Vec<Move>) -> usize {
|
pub(crate) fn part_2(input: &[Move]) -> usize {
|
||||||
let mut rope = Rope::<TAIL_LENGTH>::new();
|
let mut rope = Rope::<TAIL_LENGTH>::new();
|
||||||
|
|
||||||
for head_movement in input {
|
for head_movement in input {
|
||||||
|
|
Loading…
Reference in a new issue