Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing the clippy warnings #14

Merged
merged 2 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/std.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ impl Eq for Instant {}

impl PartialOrd for Instant {
fn partial_cmp(&self, other: &Instant) -> Option<Ordering> {
self.inner.partial_cmp(&other.inner)
Some(self.cmp(other))
}
}

Expand Down Expand Up @@ -146,7 +146,7 @@ impl Eq for SystemTime {}

impl PartialOrd for SystemTime {
fn partial_cmp(&self, other: &SystemTime) -> Option<Ordering> {
self.inner.partial_cmp(&other.inner)
Some(self.cmp(other))
}
}

Expand Down
3 changes: 1 addition & 2 deletions src/timer/clock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ pub(crate) fn clock() -> Clock {
unsafe {
let clock = Clock::from_raw(clock);
let ret = clock.clone();
#[allow(clippy::drop_copy)]
drop(clock.into_raw());
let _ = clock.into_raw();
ret
}
}
Expand Down
6 changes: 1 addition & 5 deletions src/timer/heap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ impl<T: Ord> Heap<T> {

pub fn peek(&self) -> Option<&T> {
self.assert_consistent();
self.items.get(0).map(|i| &i.0)
self.items.first().map(|i| &i.0)
}

pub fn pop(&mut self) -> Option<T> {
Expand Down Expand Up @@ -161,10 +161,6 @@ impl<T: Ord> Heap<T> {
}

fn assert_consistent(&self) {
if !cfg!(assert_timer_heap_consistent) {
return;
}

assert_eq!(
self.items.len(),
self.index
Expand Down
3 changes: 1 addition & 2 deletions src/timer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -554,8 +554,7 @@ impl Default for TimerHandle {
unsafe {
let handle = TimerHandle::from_raw(fallback);
let ret = handle.clone();
#[allow(clippy::drop_copy)]
drop(handle.into_raw());
let _ = handle.into_raw();
ret
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/tokio_util/wheel/level.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ fn slot_for(duration: u64, level: usize) -> usize {
((duration >> (level * 6)) % LEVEL_MULT as u64) as usize
}

#[cfg(all(test, not(loom)))]
#[cfg(test)]
mod test {
use super::*;

Expand Down
3 changes: 1 addition & 2 deletions src/tokio_util/wheel/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ pub(crate) use self::stack::Stack;

use std::borrow::Borrow;
use std::fmt::Debug;
use std::usize;

#[derive(Debug)]
pub(crate) struct Wheel<T> {
Expand Down Expand Up @@ -201,7 +200,7 @@ fn level_for(elapsed: u64, when: u64) -> usize {
significant / 6
}

#[cfg(all(test, not(loom)))]
#[cfg(test)]
mod test {
use super::*;

Expand Down
Loading