Skip to content

Commit 3bed26d

Browse files
committed
Fix clippy
1 parent e2bc3a4 commit 3bed26d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/scheduler/stat.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ impl WorkCounterBase {
3838
fn merge_inplace(&mut self, other: &Self) {
3939
self.min = self.min.min(other.min);
4040
self.max = self.max.max(other.max);
41-
self.total = self.total + other.total;
41+
self.total += other.total;
4242
}
4343

4444
fn merge_val(&mut self, val: f64) {
4545
self.min = self.min.min(val);
4646
self.max = self.max.max(val);
47-
self.total = self.total + val;
47+
self.total += val;
4848
}
4949
}
5050

@@ -197,7 +197,7 @@ impl SchedulerStat {
197197
let vs = self
198198
.work_counters
199199
.entry(*id)
200-
.or_insert(vec![vec![]; counters.len()]);
200+
.or_insert_with(|| vec![vec![]; counters.len()]);
201201
for (v, c) in vs.iter_mut().zip(counters.iter()) {
202202
v.push(c.clone());
203203
}
@@ -254,7 +254,7 @@ impl WorkerLocalStat {
254254
};
255255
self.work_counters
256256
.entry(work_id)
257-
.or_insert(WorkerLocalStat::counter_set())
257+
.or_insert_with(WorkerLocalStat::counter_set)
258258
.iter_mut()
259259
.for_each(|c| c.start());
260260
stat

0 commit comments

Comments
 (0)