Skip to content

Commit 7819b80

Browse files
committed
Clippies
1 parent 0974b89 commit 7819b80

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

wrappers/tokio/impls/tokio-stream/src/stream_ext/take_while.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ where
5050
Poll::Ready(None)
5151
} else {
5252
self.as_mut().project().stream.poll_next(cx).map(|ready| {
53-
let ready = ready.and_then(|item| (self.as_mut().project().predicate)(&item).then(|| item));
53+
let ready = ready.and_then(|item| (self.as_mut().project().predicate)(&item).then_some(item));
5454

5555
if ready.is_none() {
5656
*self.as_mut().project().done = true;

wrappers/tokio/impls/tokio-stream/src/stream_map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ where
205205
/// Polls the next value, includes the vec entry index
206206
fn poll_next_entry(&mut self, cx: &mut Context<'_>) -> Poll<Option<(usize, V::Item)>> {
207207
// SHUTTLE_CHANGES: Uses Shuttle's controlled `thread_rng` for deterministic replay
208-
let start = if self.entries.len() == 0 {
208+
let start = if self.entries.is_empty() {
209209
0
210210
} else {
211211
shuttle::rand::thread_rng().gen::<usize>() % self.entries.len()

wrappers/tokio/impls/tokio-util/src/sync/cancellation_token/tree_node.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@
1818
//! Those invariants shall be true at any time.
1919
//!
2020
//! 1. A node that has no parents and no handles can no longer be cancelled.
21-
//! This is important during both cancellation and refcounting.
21+
//! This is important during both cancellation and refcounting.
2222
//!
2323
//! 2. If node B *is* or *was* a child of node A, then node B was created *after* node A.
24-
//! This is important for deadlock safety, as it is used for lock order.
25-
//! Node B can only become the child of node A in two ways:
26-
//! - being created with `child_node()`, in which case it is trivially true that
27-
//! node A already existed when node B was created
28-
//! - being moved A->C->B to A->B because node C was removed in `decrease_handle_refcount()`
29-
//! or `cancel()`. In this case the invariant still holds, as B was younger than C, and C
30-
//! was younger than A, therefore B is also younger than A.
24+
//! This is important for deadlock safety, as it is used for lock order.
25+
//! Node B can only become the child of node A in two ways:
26+
//! - being created with `child_node()`, in which case it is trivially true that
27+
//! node A already existed when node B was created
28+
//! - being moved A->C->B to A->B because node C was removed in `decrease_handle_refcount()`
29+
//! or `cancel()`. In this case the invariant still holds, as B was younger than C, and C
30+
//! was younger than A, therefore B is also younger than A.
3131
//!
3232
//! 3. If two nodes are both unlocked and node A is the parent of node B, then node B is a child of
3333
//! node A. It is important to always restore that invariant before dropping the lock of a node.

0 commit comments

Comments
 (0)