Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e89137b

Browse files
Update benchmark and fix lint
1 parent a8a3007 commit e89137b

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

‎README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ Performance is reasonable even on older hardware, for example a 2011 MacBook Pro
263263
| Day | Problem | Solution | Benchmark (μs) |
264264
| --- | --- | --- | --: |
265265
| 1 | [Chronal Calibration](https://adventofcode.com/2018/day/1) | [Source](src/year2018/day01.rs) | 16 |
266-
| 2 | [Inventory Management System](https://adventofcode.com/2018/day/2) | [Source](src/year2018/day02.rs) | 78 |
266+
| 2 | [Inventory Management System](https://adventofcode.com/2018/day/2) | [Source](src/year2018/day02.rs) | 49 |
267267
| 3 | [No Matter How You Slice It](https://adventofcode.com/2018/day/3) | [Source](src/year2018/day03.rs) | 55 |
268268
| 4 | [Repose Record](https://adventofcode.com/2018/day/4) | [Source](src/year2018/day04.rs) | 46 |
269269
| 5 | [Alchemical Reduction](https://adventofcode.com/2018/day/5) | [Source](src/year2018/day05.rs) | 390 |

‎src/year2018/day02.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
//! # Inventory Management System
2-
32
use crate::util::hash::*;
43

54
pub fn parse(input: &str) -> Vec<&[u8]> {
@@ -46,7 +45,6 @@ pub fn part1(input: &[&[u8]]) -> u32 {
4645

4746
pub fn part2(input: &[&[u8]]) -> String {
4847
let width = input[0].len();
49-
5048
let mut seen = FastSet::with_capacity(input.len());
5149

5250
// Use a set to check for duplicates by comparing the prefix and suffix of IDs excluding one
@@ -58,7 +56,7 @@ pub fn part2(input: &[&[u8]]) -> String {
5856

5957
if !seen.insert([prefix, suffix]) {
6058
// Convert to String
61-
return prefix.iter().chain(suffix).cloned().map(char::from).collect();
59+
return prefix.iter().chain(suffix).copied().map(char::from).collect();
6260
}
6361
}
6462

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /