Movatterモバイル変換


[0]ホーム

URL:


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

Commitf43530b

Browse files
authored
chore: address someclippy::pedantic warnings (fspoettel#55)
1 parent84208a6 commitf43530b

File tree

5 files changed

+21
-18
lines changed

5 files changed

+21
-18
lines changed

‎src/template/commands/all.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
usecrate::template::{all_days, run_multi::run_multi};
22

33
pubfnhandle(is_release:bool,is_timed:bool){
4-
run_multi(all_days().collect(), is_release, is_timed);
4+
run_multi(&all_days().collect(), is_release, is_timed);
55
}

‎src/template/commands/scaffold.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,5 +65,5 @@ pub fn handle(day: Day) {
6565
}
6666

6767
println!("---");
68-
println!("🎄 Type `cargo solve {}` to run your solution.", day);
68+
println!("🎄 Type `cargo solve {day}` to run your solution.");
6969
}

‎src/template/commands/time.rs‎

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,29 @@ use crate::template::{all_days, readme_benchmarks, Day};
77
pubfnhandle(day:Option<Day>,recreate_all:bool){
88
let stored_timings =Timings::read_from_file();
99

10-
let days_to_run = day.map(|day|HashSet::from([day])).unwrap_or_else(||{
11-
if recreate_all{
12-
all_days().collect()
13-
}else{
14-
// when the `--all` flag is not set, filter out days that are fully benched.
15-
all_days()
16-
.filter(|day| !stored_timings.is_day_complete(day))
17-
.collect()
18-
}
19-
});
10+
let days_to_run = day.map_or_else(
11+
||{
12+
if recreate_all{
13+
all_days().collect()
14+
}else{
15+
// when the `--all` flag is not set, filter out days that are fully benched.
16+
all_days()
17+
.filter(|day| !stored_timings.is_day_complete(*day))
18+
.collect()
19+
}
20+
},
21+
|day|HashSet::from([day]),
22+
);
2023

21-
let timings =run_multi(days_to_run,true,true).unwrap();
24+
let timings =run_multi(&days_to_run,true,true).unwrap();
2225

2326
let merged_timings = stored_timings.merge(&timings);
2427
merged_timings.store_file().unwrap();
2528

2629
println!();
2730
match readme_benchmarks::update(merged_timings){
2831
Ok(()) =>{
29-
println!("Stored updated benchmarks.")
32+
println!("Stored updated benchmarks.");
3033
}
3134
Err(_) =>{
3235
eprintln!("Failed to store updated benchmarks.");

‎src/template/run_multi.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use super::{
77
timings::{Timing,Timings},
88
};
99

10-
pubfnrun_multi(days_to_run:HashSet<Day>,is_release:bool,is_timed:bool) ->Option<Timings>{
10+
pubfnrun_multi(days_to_run:&HashSet<Day>,is_release:bool,is_timed:bool) ->Option<Timings>{
1111
letmut timings:Vec<Timing> =Vec::with_capacity(days_to_run.len());
1212

1313
all_days().for_each(|day|{

‎src/template/timings.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ impl Timings {
3838
match s{
3939
Ok(timings) => timings,
4040
Err(e) =>{
41-
eprintln!("{}", e);
41+
eprintln!("{e}");
4242
Timings::default()
4343
}
4444
}
@@ -67,10 +67,10 @@ impl Timings {
6767
self.data.iter().map(|x| x.total_nanos).sum::<f64>() /1_000_000_f64
6868
}
6969

70-
pubfnis_day_complete(&self,day:&Day) ->bool{
70+
pubfnis_day_complete(&self,day:Day) ->bool{
7171
self.data
7272
.iter()
73-
.any(|t|&t.day == day && t.part_1.is_some() && t.part_2.is_some())
73+
.any(|t| t.day == day && t.part_1.is_some() && t.part_2.is_some())
7474
}
7575
}
7676

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp