diff --git a/detcore-model/src/time.rs b/detcore-model/src/time.rs index 9a4452f..1fbd6e6 100644 --- a/detcore-model/src/time.rs +++ b/detcore-model/src/time.rs @@ -329,6 +329,7 @@ impl Ord for DetTime { } } +#[allow(clippy::non_canonical_partial_ord_impl)] impl PartialOrd for DetTime { fn partial_cmp(&self, other: &Self) -> Option { let nanos = other.as_nanos(); diff --git a/detcore/src/dirents.rs b/detcore/src/dirents.rs index 4d12f98..cbfc1d5 100644 --- a/detcore/src/dirents.rs +++ b/detcore/src/dirents.rs @@ -26,6 +26,7 @@ pub struct Dirent64 { } // sort by name, but "." < ".." <= .. +#[allow(clippy::non_canonical_partial_ord_impl)] impl PartialOrd for Dirent64 { fn partial_cmp(&self, other: &Self) -> Option { if self.name.as_bytes()[..2] == b".\0"[..] { diff --git a/detcore/src/logdiff.rs b/detcore/src/logdiff.rs index f6da64d..e3af14d 100644 --- a/detcore/src/logdiff.rs +++ b/detcore/src/logdiff.rs @@ -340,7 +340,7 @@ fn diff_vecs( Ok(false) } else { let mut diff_count = 0; - for (_ix, ((oix, ox), (_, oy))) in v1.iter().zip(v2.iter()).enumerate() { + for ((oix, ox), (_, oy)) in v1.iter().zip(v2.iter()) { let (x, y) = if opts.strip_lines { (strip_log_entry(ox), strip_log_entry(oy)) } else { diff --git a/detcore/src/preemptions.rs b/detcore/src/preemptions.rs index 4a8e67a..df086f7 100644 --- a/detcore/src/preemptions.rs +++ b/detcore/src/preemptions.rs @@ -361,7 +361,7 @@ impl ThreadHistory { /// Return the priority of the initial timeslice after the thread starts running. pub fn initial_priority(&self) -> Priority { - if let Some((_ns, pr)) = self.prio_changes.get(0) { + if let Some((_ns, pr)) = self.prio_changes.first() { *pr } else { self.final_prio diff --git a/detcore/src/scheduler.rs b/detcore/src/scheduler.rs index a2d729d..d328bb1 100644 --- a/detcore/src/scheduler.rs +++ b/detcore/src/scheduler.rs @@ -999,11 +999,7 @@ impl Scheduler { .next_turns .get(dettid) .expect("Missing next_turns entry"); - let entry: &mut Vec<_> = self - .blocked - .futex_waiters - .entry(futexid) - .or_insert_with(Vec::new); + let entry: &mut Vec<_> = self.blocked.futex_waiters.entry(futexid).or_default(); entry.push((*dettid, nxt.resp.clone())); // When we park, we use a resource request to signal WHAT we're blocking on. But this is // not quite the same as when an active thread in the runqueue blocks on a resource, because diff --git a/detcore/src/scheduler/timed_waiters.rs b/detcore/src/scheduler/timed_waiters.rs index 5ae4d77..607f7e4 100644 --- a/detcore/src/scheduler/timed_waiters.rs +++ b/detcore/src/scheduler/timed_waiters.rs @@ -52,7 +52,7 @@ impl fmt::Display for TimedEvent { impl TimedEvents { pub fn insert(&mut self, ns: LogicalTime, dt: DetTid) { - let set = self.map.entry(ns).or_insert_with(BTreeSet::new); + let set = self.map.entry(ns).or_default(); if !set.insert(TimedEvent::ThreadEvt(dt)) { panic!( "TimedEvents::insert should not take a DetTid which is *already* in the set: {}", @@ -72,7 +72,7 @@ impl TimedEvents { let old = self.alarm_times.insert(dp, ns); self.clear_old_alarm(old); - let set = self.map.entry(ns).or_insert_with(BTreeSet::new); + let set = self.map.entry(ns).or_default(); let evt = TimedEvent::AlarmEvt(dp, dt, sig); if !set.insert(evt) { panic!( diff --git a/detcore/src/tool_global.rs b/detcore/src/tool_global.rs index 5e938a0..75a1116 100644 --- a/detcore/src/tool_global.rs +++ b/detcore/src/tool_global.rs @@ -716,7 +716,6 @@ impl GlobalState { // TODO: eliminate this loop. Could instead signal with an ivar. let response_ivar = loop { tokio::task::yield_now().await; - let detpid = detpid; let mut sched = self.sched.lock().unwrap(); // The resources that must be held for the fresh thread to run: let rsrcs = { diff --git a/hermit-cli/src/bin/hermit/analyze/minimize.rs b/hermit-cli/src/bin/hermit/analyze/minimize.rs index 3f5b7ab..a9d6e21 100644 --- a/hermit-cli/src/bin/hermit/analyze/minimize.rs +++ b/hermit-cli/src/bin/hermit/analyze/minimize.rs @@ -279,9 +279,7 @@ impl AnalyzeOpts { ":: Knocked out only one preemption ({:?}), so concluding that one is critical.", critical ); - let entry = critical_preempts - .entry(selected_tid) - .or_insert_with(BTreeSet::new); + let entry = critical_preempts.entry(selected_tid).or_default(); assert!(entry.insert(critical)); continue; diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 9ab0b5d..acb9297 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -# @fb-only: path = "../../third-party-buck/platform010/build/rust/llvm-fb-12" +# @fb-only: path = "../../third-party-buck/platform010/build/rust/llvm-fb-15" channel = "nightly" # @oss-only