Skip to content

Commit

Permalink
Solve clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
amab8901 committed Feb 27, 2023
1 parent e9293cc commit 3ee4e07
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions tokio-stream/src/stream_ext/take.rs
Expand Up @@ -64,11 +64,11 @@ where

let (lower, upper) = self.stream.size_hint();

let lower = cmp::min(lower, self.remaining as usize);
let lower = cmp::min(lower, self.remaining);

let upper = match upper {
Some(x) if x < self.remaining as usize => Some(x),
_ => Some(self.remaining as usize),
Some(x) if x < self.remaining => Some(x),
_ => Some(self.remaining),
};

(lower, upper)
Expand Down
4 changes: 2 additions & 2 deletions tokio-util/src/compat.rs
Expand Up @@ -232,7 +232,7 @@ impl<T: tokio::io::AsyncSeek> futures_io::AsyncSeek for Compat<T> {
}
let res = ready!(self.as_mut().project().inner.poll_complete(cx));
*self.as_mut().project().seek_pos = None;
Poll::Ready(res.map(|p| p as u64))
Poll::Ready(res)
}
}

Expand All @@ -255,7 +255,7 @@ impl<T: futures_io::AsyncSeek> tokio::io::AsyncSeek for Compat<T> {
};
let res = ready!(self.as_mut().project().inner.poll_seek(cx, pos));
*self.as_mut().project().seek_pos = None;
Poll::Ready(res.map(|p| p as u64))
Poll::Ready(res)
}
}

Expand Down
2 changes: 1 addition & 1 deletion tokio/src/time/instant.rs
Expand Up @@ -188,7 +188,7 @@ impl ops::Sub<Duration> for Instant {
type Output = Instant;

fn sub(self, rhs: Duration) -> Instant {
Instant::from_std(self.std - rhs)
Instant::from_std(self.std.checked_sub(rhs).unwrap())
}
}

Expand Down
2 changes: 1 addition & 1 deletion tokio/src/util/slab.rs
Expand Up @@ -560,7 +560,7 @@ impl<T> Slots<T> {
assert!(slot >= base, "unexpected pointer");

let idx = (slot - base) / width;
assert!(idx < self.slots.len() as usize);
assert!(idx < self.slots.len());

idx
}
Expand Down

0 comments on commit 3ee4e07

Please sign in to comment.