Skip to content

Commit 6871084

Browse files
authored
chore: clippy and doc fixes (#6081)
1 parent 1b8ebfc commit 6871084

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+220
-235
lines changed

tokio-macros/src/entry.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,6 @@ impl ToTokens for Body<'_> {
586586
for stmt in self.stmts {
587587
stmt.to_tokens(tokens);
588588
}
589-
})
589+
});
590590
}
591591
}

tokio-macros/src/select.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,27 +73,27 @@ fn clean_pattern(pat: &mut syn::Pat) {
7373
}
7474
}
7575
syn::Pat::Or(or) => {
76-
for case in or.cases.iter_mut() {
76+
for case in &mut or.cases {
7777
clean_pattern(case);
7878
}
7979
}
8080
syn::Pat::Slice(slice) => {
81-
for elem in slice.elems.iter_mut() {
81+
for elem in &mut slice.elems {
8282
clean_pattern(elem);
8383
}
8484
}
8585
syn::Pat::Struct(struct_pat) => {
86-
for field in struct_pat.fields.iter_mut() {
86+
for field in &mut struct_pat.fields {
8787
clean_pattern(&mut field.pat);
8888
}
8989
}
9090
syn::Pat::Tuple(tuple) => {
91-
for elem in tuple.elems.iter_mut() {
91+
for elem in &mut tuple.elems {
9292
clean_pattern(elem);
9393
}
9494
}
9595
syn::Pat::TupleStruct(tuple) => {
96-
for elem in tuple.elems.iter_mut() {
96+
for elem in &mut tuple.elems {
9797
clean_pattern(elem);
9898
}
9999
}

tokio-stream/src/once.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ impl<I> Unpin for Once<I> {}
3535
/// ```
3636
pub fn once<T>(value: T) -> Once<T> {
3737
Once {
38-
iter: crate::iter(Some(value).into_iter()),
38+
iter: crate::iter(Some(value)),
3939
}
4040
}
4141

tokio-stream/src/wrappers/mpsc_bounded.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ impl<T> ReceiverStream<T> {
3434
///
3535
/// [`Permit`]: struct@tokio::sync::mpsc::Permit
3636
pub fn close(&mut self) {
37-
self.inner.close()
37+
self.inner.close();
3838
}
3939
}
4040

tokio-stream/src/wrappers/mpsc_unbounded.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ impl<T> UnboundedReceiverStream<T> {
2828
/// This prevents any further messages from being sent on the channel while
2929
/// still enabling the receiver to drain messages that are buffered.
3030
pub fn close(&mut self) {
31-
self.inner.close()
31+
self.inner.close();
3232
}
3333
}
3434

tokio-test/src/io.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ struct Inner {
7474
}
7575

7676
impl Builder {
77-
/// Return a new, empty `Builder.
77+
/// Return a new, empty `Builder`.
7878
pub fn new() -> Self {
7979
Self::default()
8080
}
@@ -478,7 +478,7 @@ impl Drop for Mock {
478478
Action::Read(data) => assert!(data.is_empty(), "There is still data left to read."),
479479
Action::Write(data) => assert!(data.is_empty(), "There is still data left to write."),
480480
_ => (),
481-
})
481+
});
482482
}
483483
}
484484
/*

tokio-test/src/task.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ impl<T: Future> Spawn<T> {
127127
}
128128

129129
impl<T: Stream> Spawn<T> {
130-
/// If `T` is a [`Stream`] then poll_next it. This will handle pinning and the context
130+
/// If `T` is a [`Stream`] then `poll_next` it. This will handle pinning and the context
131131
/// type for the stream.
132132
pub fn poll_next(&mut self) -> Poll<Option<T::Item>> {
133133
let stream = self.future.as_mut();

tokio-util/src/either.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ where
116116
}
117117

118118
fn consume(self: Pin<&mut Self>, amt: usize) {
119-
delegate_call!(self.consume(amt))
119+
delegate_call!(self.consume(amt));
120120
}
121121
}
122122

tokio-util/src/sync/cancellation_token.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ impl Default for CancellationToken {
133133
}
134134

135135
impl CancellationToken {
136-
/// Creates a new CancellationToken in the non-cancelled state.
136+
/// Creates a new `CancellationToken` in the non-cancelled state.
137137
pub fn new() -> CancellationToken {
138138
CancellationToken {
139139
inner: Arc::new(tree_node::TreeNode::new()),

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
//! This mod provides the logic for the inner tree structure of the CancellationToken.
22
//!
3-
//! CancellationTokens are only light handles with references to TreeNode.
4-
//! All the logic is actually implemented in the TreeNode.
3+
//! CancellationTokens are only light handles with references to [`TreeNode`].
4+
//! All the logic is actually implemented in the [`TreeNode`].
55
//!
6-
//! A TreeNode is part of the cancellation tree and may have one parent and an arbitrary number of
6+
//! A [`TreeNode`] is part of the cancellation tree and may have one parent and an arbitrary number of
77
//! children.
88
//!
9-
//! A TreeNode can receive the request to perform a cancellation through a CancellationToken.
9+
//! A [`TreeNode`] can receive the request to perform a cancellation through a CancellationToken.
1010
//! This cancellation request will cancel the node and all of its descendants.
1111
//!
1212
//! As soon as a node cannot get cancelled any more (because it was already cancelled or it has no

0 commit comments

Comments
 (0)