Skip to content

clippy #29

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

Merged
merged 1 commit into from
Jun 1, 2025
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/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -393,15 +393,15 @@ impl<T> fmt::Display for TrySendError<T> {
#[inline]
fn format_send_error<T>(e: &SendError<T>, f: &mut fmt::Formatter) -> fmt::Result {
match *e {
SendError::Io(ref io_err) => write!(f, "{}", io_err),
SendError::Io(ref io_err) => write!(f, "{io_err}"),
SendError::Disconnected(..) => write!(f, "Disconnected"),
}
}

#[inline]
fn format_try_send_error<T>(e: &TrySendError<T>, f: &mut fmt::Formatter) -> fmt::Result {
match *e {
TrySendError::Io(ref io_err) => write!(f, "{}", io_err),
TrySendError::Io(ref io_err) => write!(f, "{io_err}"),
TrySendError::Full(..) => write!(f, "Full"),
TrySendError::Disconnected(..) => write!(f, "Disconnected"),
}
Expand Down
24 changes: 7 additions & 17 deletions src/timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ impl<T> Timer<T> {

self.schedule_readiness(tick);

trace!("inserted timout; slot={}; token={:?}", slot, token);
trace!("inserted timout; slot={slot}; token={token:?}");

// Return the new timeout
Timeout { token, tick }
Expand Down Expand Up @@ -266,7 +266,7 @@ impl<T> Timer<T> {
while self.tick <= target_tick {
let curr = self.next;

trace!("ticking; curr={:?}", curr);
trace!("ticking; curr={curr:?}");

if curr == EMPTY {
self.tick += 1;
Expand All @@ -292,7 +292,7 @@ impl<T> Timer<T> {
let links = self.entries[curr.into()].links;

if links.tick <= self.tick {
trace!("triggering; token={:?}", curr);
trace!("triggering; token={curr:?}");

// Unlink will also advance self.next
self.unlink(&links, curr);
Expand Down Expand Up @@ -357,7 +357,7 @@ impl<T> Timer<T> {
}

// Attempt to move the wakeup time forward
trace!("advancing the wakeup time; target={}; curr={}", tick, curr);
trace!("advancing the wakeup time; target={tick}; curr={curr}");
match inner.wakeup_state.compare_exchange_weak(
curr,
tick as usize,
Expand Down Expand Up @@ -490,11 +490,7 @@ fn spawn_wakeup_thread(

let now_tick = current_tick(start, tick_ms);

trace!(
"wakeup thread: sleep_until_tick={:?}; now_tick={:?}",
sleep_until_tick,
now_tick
);
trace!( "wakeup thread: sleep_until_tick={sleep_until_tick:?}; now_tick={now_tick:?}");

if now_tick < sleep_until_tick {
// Calling park_timeout with u64::MAX leads to undefined
Expand All @@ -504,19 +500,13 @@ fn spawn_wakeup_thread(
match tick_ms.checked_mul(sleep_until_tick - now_tick) {
Some(sleep_duration) => {
trace!(
"sleeping; tick_ms={}; now_tick={}; sleep_until_tick={}; duration={:?}",
tick_ms,
now_tick,
sleep_until_tick,
sleep_duration
"sleeping; tick_ms={tick_ms}; now_tick={now_tick}; sleep_until_tick={sleep_until_tick}; duration={sleep_duration:?}"
);
thread::park_timeout(Duration::from_millis(sleep_duration));
}
None => {
trace!(
"sleeping; tick_ms={}; now_tick={}; blocking sleep",
tick_ms,
now_tick
"sleeping; tick_ms={tick_ms}; now_tick={now_tick}; blocking sleep"
);
thread::park();
}
Expand Down
Loading