Skip to content

Commit 5190b21

Browse files
committed
Clippy
1 parent 4ae7b73 commit 5190b21

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

aoc2024/src/bin/15.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ pub fn part_one(input: &str) -> Option<u64> {
132132
Some(
133133
map.iter()
134134
.enumerate()
135-
.map(|(row, v)| {
135+
.flat_map(|(row, v)| {
136136
v.iter().enumerate().filter_map(move |(col, c)| {
137137
if *c == 'O' {
138138
Some((100 * row + col) as u64)
@@ -141,7 +141,6 @@ pub fn part_one(input: &str) -> Option<u64> {
141141
}
142142
})
143143
})
144-
.flatten()
145144
.sum::<u64>(),
146145
)
147146
}
@@ -279,7 +278,7 @@ fn complex_shift(temp: (usize, usize), d: Dir, map: &mut [Vec<char>]) -> bool {
279278
}
280279

281280
fn simple_shift(temp: (usize, usize), d: Dir, map: &mut [Vec<char>]) -> bool {
282-
let orig = temp.clone();
281+
let orig = temp;
283282
let mut temp = temp;
284283
match d {
285284
Dir::Left => {
@@ -372,7 +371,7 @@ pub fn part_two(input: &str) -> Option<u64> {
372371
Some(
373372
map.iter()
374373
.enumerate()
375-
.map(|(row, v)| {
374+
.flat_map(|(row, v)| {
376375
v.iter().enumerate().filter_map(move |(col, c)| {
377376
if *c == '[' {
378377
Some((100 * row + col) as u64)
@@ -381,7 +380,6 @@ pub fn part_two(input: &str) -> Option<u64> {
381380
}
382381
})
383382
})
384-
.flatten()
385383
.sum::<u64>(),
386384
)
387385
}

0 commit comments

Comments
 (0)