summaryrefslogtreecommitdiff
path: root/src/accumulated_time.rs
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2023-10-21 08:08:58 +0300
committerLars Wirzenius <liw@liw.fi>2023-10-21 09:14:46 +0300
commitc667532dedb23188be7cb59d26994060c67e0c38 (patch)
treef27bbacd84dba319b72935ac4e54e279c3f48648 /src/accumulated_time.rs
parentfa2570fe73dd4df1f2e00bd6f513522a30f9aedf (diff)
downloadobnam2-c667532dedb23188be7cb59d26994060c67e0c38.tar.gz
chore: fix blemishes found by clippy
Signed-off-by: Lars Wirzenius <liw@liw.fi> Sponsored-by: author
Diffstat (limited to 'src/accumulated_time.rs')
-rw-r--r--src/accumulated_time.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/accumulated_time.rs b/src/accumulated_time.rs
index e633a10..cdf34b2 100644
--- a/src/accumulated_time.rs
+++ b/src/accumulated_time.rs
@@ -37,7 +37,7 @@ impl<T: Eq + PartialEq + Hash + Copy> AccumulatedTime<T> {
/// clock is stopped.
pub fn start(&mut self, clock: T) {
let mut map = self.accumulated.lock().unwrap();
- let ct = map.entry(clock).or_insert_with(ClockTime::default);
+ let ct = map.entry(clock).or_default();
assert!(ct.started.is_none());
ct.started = Some(Instant::now());
}
@@ -47,7 +47,7 @@ impl<T: Eq + PartialEq + Hash + Copy> AccumulatedTime<T> {
/// Its run time is added to the accumulated time for that kind of clock.
pub fn stop(&mut self, clock: T) {
let mut map = self.accumulated.lock().unwrap();
- if let Some(mut ct) = map.get_mut(&clock) {
+ if let Some(ct) = map.get_mut(&clock) {
assert!(ct.started.is_some());
if let Some(started) = ct.started.take() {
ct.nanos += started.elapsed().as_nanos();