Skip to content

Commit 1b240a6

Browse files
committed
Fix lint warnings
1 parent 4dfb133 commit 1b240a6

File tree

7 files changed

+21
-18
lines changed

7 files changed

+21
-18
lines changed

benches/benchmark.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![allow(unstable_features)]
12
#![feature(test)]
23
extern crate test;
34

src/main.rs

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,22 @@ fn main() {
3939
for Solution { year, day, wrapper } in &solutions {
4040
let path: PathBuf =
4141
["input", &format!("year{year}"), &format!("day{day:02}.txt")].iter().collect();
42-
let Ok(data) = read_to_string(&path) else {
43-
eprintln!("Place input file in {path:?}");
44-
continue;
45-
};
4642

47-
let time = Instant::now();
48-
let (answer1, answer2) = wrapper(&data);
49-
let duration = time.elapsed().as_micros();
50-
elapsed += time.elapsed();
43+
if let Ok(data) = read_to_string(&path) {
44+
let time = Instant::now();
45+
let (answer1, answer2) = wrapper(&data);
46+
let duration = time.elapsed().as_micros();
47+
elapsed += time.elapsed();
5148

52-
println!("{BOLD}{YELLOW}{year} Day {day:02}{RESET}");
53-
println!(" Part 1: {answer1}");
54-
println!(" Part 2: {answer2}");
55-
println!(" Duration: {duration} μs");
49+
println!("{BOLD}{YELLOW}{year} Day {day:02}{RESET}");
50+
println!(" Part 1: {answer1}");
51+
println!(" Part 2: {answer2}");
52+
println!(" Duration: {duration} μs");
53+
} else {
54+
eprintln!("{BOLD}{RED}{year} Day {day:02}{RESET}");
55+
eprintln!(" Missing input!");
56+
eprintln!(" Place input file in {BOLD}{WHITE}{}{RESET}", path.display());
57+
}
5658
}
5759

5860
// Print totals

src/year2015/day04.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pub struct Shared {
3131

3232
pub fn parse(input: &str) -> Shared {
3333
let shared = Shared {
34-
prefix: input.trim().to_string(),
34+
prefix: input.trim().to_owned(),
3535
done: AtomicBool::new(false),
3636
counter: AtomicU32::new(1000),
3737
first: AtomicU32::new(u32::MAX),

src/year2016/day05.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ struct Exclusive {
2222

2323
pub fn parse(input: &str) -> Vec<u32> {
2424
let shared = Shared {
25-
prefix: input.trim().to_string(),
25+
prefix: input.trim().to_owned(),
2626
done: AtomicBool::new(false),
2727
counter: AtomicU32::new(1000),
2828
};

src/year2016/day17.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ pub fn parse(input: &str) -> State {
2828
state
2929
}
3030

31-
pub fn part1(input: &State) -> String {
32-
input.min.to_string()
31+
pub fn part1(input: &State) -> &str {
32+
&input.min
3333
}
3434

3535
pub fn part2(input: &State) -> usize {

src/year2017/day14.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ struct Exclusive {
2222

2323
/// Parallelize the hashing as each row is independent.
2424
pub fn parse(input: &str) -> Vec<u8> {
25-
let shared = Shared { prefix: input.trim().to_string(), counter: AtomicUsize::new(0) };
25+
let shared = Shared { prefix: input.trim().to_owned(), counter: AtomicUsize::new(0) };
2626
let exclusive = Exclusive { grid: vec![0; 0x4000] };
2727
let mutex = Mutex::new(exclusive);
2828

src/year2019/day13.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ fn draw(tiles: &[i64], score: i64, blocks: i64) {
106106

107107
for y in 0..20 {
108108
for x in 0..44 {
109-
let _ = match tiles[44 * y + x] {
109+
let _unused = match tiles[44 * y + x] {
110110
0 => write!(s, " "),
111111
1 if y == 0 => write!(s, "{GREEN}_{RESET}"),
112112
1 => write!(s, "{GREEN}|{RESET}"),

0 commit comments

Comments
 (0)