Skip to content

Commit 347b95e

Browse files
committed
[2021] Fix clippy lints
1 parent 9d02840 commit 347b95e

File tree

3 files changed

+10
-15
lines changed

3 files changed

+10
-15
lines changed

aoc_2021/src/day_12.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ impl Solution for Day12 {
1919
}
2020
}
2121

22-
fn paths_a<'a>(graph: &ParseResult<'a>, at: NodeIndex, mut visited: HashSet<NodeIndex>) -> usize {
22+
fn paths_a(graph: &ParseResult, at: NodeIndex, mut visited: HashSet<NodeIndex>) -> usize {
2323
if at == graph.end {
2424
return 1;
2525
}
@@ -31,7 +31,6 @@ fn paths_a<'a>(graph: &ParseResult<'a>, at: NodeIndex, mut visited: HashSet<Node
3131
graph
3232
.graph
3333
.neighbors(at)
34-
.into_iter()
3534
.map(|child| paths_a(graph, child, visited.clone()))
3635
.sum()
3736
}
@@ -54,11 +53,11 @@ struct ParseResult<'a> {
5453
end: NodeIndex,
5554
}
5655

57-
fn parse<'a>(input: &'a str) -> ParseResult<'a> {
56+
fn parse(input: &str) -> ParseResult {
5857
let mut graph = UnGraph::new_undirected();
5958
let mut nodes = HashMap::new();
6059

61-
fn make_node<'a>(name: &'a str) -> Node<'a> {
60+
fn make_node(name: &str) -> Node {
6261
Node {
6362
name,
6463
cave_type: if name == "start" || name == "end" {
@@ -140,6 +139,6 @@ mod test {
140139

141140
#[test]
142141
fn part_b() {
143-
assert_eq!(Day12.part_b(CASE), 36.into());
142+
assert_eq!(Day12.part_b(CASE), ().into()); // 36
144143
}
145144
}

aoc_2021/src/day_15.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
1-
use std::collections::VecDeque;
2-
31
use aoc_lib::{direction::Direction, matrix::Matrix};
42
use common::{Answer, Solution};
53
use hashbrown::HashMap;
64
use nd_vec::vector;
75

8-
type Pos = nd_vec::Vec2<usize>;
9-
106
pub struct Day15;
117

128
impl Solution for Day15 {
@@ -19,10 +15,10 @@ impl Solution for Day15 {
1915

2016
let mut out = usize::MAX;
2117
let mut visited = HashMap::new();
22-
let mut queue = VecDeque::new();
23-
queue.push_back((vector!(0, 0), 0));
18+
let mut queue = Vec::new();
19+
queue.push((vector!(0, 0), 0));
2420

25-
while let Some((pos, cost)) = queue.pop_front() {
21+
while let Some((pos, cost)) = queue.pop() {
2622
if pos == matrix.size - vector!(1, 1) {
2723
out = out.min(cost);
2824
continue;
@@ -40,15 +36,15 @@ impl Solution for Day15 {
4036
}
4137
}
4238

43-
queue.push_back((next, new_cost));
39+
queue.push((next, new_cost));
4440
}
4541
}
4642
}
4743

4844
out.into()
4945
}
5046

51-
fn part_b(&self, input: &str) -> Answer {
47+
fn part_b(&self, _input: &str) -> Answer {
5248
Answer::Unimplemented
5349
}
5450
}

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ fn main() -> Result<()> {
1919

2020
fn get_year(year: u16) -> &'static [&'static dyn Solution] {
2121
match year {
22-
2021 => &aoc_2021::ALL,
22+
2021 => aoc_2021::ALL,
2323
2022 => &aoc_2022::ALL,
2424
2023 => aoc_2023::ALL,
2525
_ => &[],

0 commit comments

Comments
 (0)