diff --git a/futures-channel/src/mpsc/mod.rs b/futures-channel/src/mpsc/mod.rs index f69f440439..bce5e2e1e0 100644 --- a/futures-channel/src/mpsc/mod.rs +++ b/futures-channel/src/mpsc/mod.rs @@ -109,7 +109,7 @@ struct BoundedSenderInner { // unblocked. sender_task: Arc>, - // True if the sender might be blocked. This is an optimization to avoid + // `true` if the sender might be blocked. This is an optimization to avoid // having to lock the mutex most of the time. maybe_parked: bool, } @@ -189,7 +189,7 @@ impl fmt::Display for SendError { impl std::error::Error for SendError {} impl SendError { - /// Returns true if this error is a result of the channel being full. + /// Returns `true` if this error is a result of the channel being full. pub fn is_full(&self) -> bool { match self.kind { SendErrorKind::Full => true, @@ -197,7 +197,7 @@ impl SendError { } } - /// Returns true if this error is a result of the receiver being dropped. + /// Returns `true` if this error is a result of the receiver being dropped. pub fn is_disconnected(&self) -> bool { match self.kind { SendErrorKind::Disconnected => true, @@ -227,12 +227,12 @@ impl fmt::Display for TrySendError { impl std::error::Error for TrySendError {} impl TrySendError { - /// Returns true if this error is a result of the channel being full. + /// Returns `true` if this error is a result of the channel being full. pub fn is_full(&self) -> bool { self.err.is_full() } - /// Returns true if this error is a result of the receiver being dropped. + /// Returns `true` if this error is a result of the receiver being dropped. pub fn is_disconnected(&self) -> bool { self.err.is_disconnected() } @@ -536,7 +536,7 @@ impl BoundedSenderInner { // This operation will also atomically determine if the sender task // should be parked. // - // None is returned in the case that the channel has been closed by the + // `None` is returned in the case that the channel has been closed by the // receiver. This happens when `Receiver::close` is called or the // receiver is dropped. let park_self = match self.inc_num_messages() { @@ -997,7 +997,7 @@ impl Receiver { /// no longer empty. /// /// This function will panic if called after `try_next` or `poll_next` has - /// returned None. + /// returned `None`. pub fn try_next(&mut self) -> Result, TryRecvError> { match self.next_message() { Poll::Ready(msg) => { @@ -1127,7 +1127,7 @@ impl UnboundedReceiver { /// no longer empty. /// /// This function will panic if called after `try_next` or `poll_next` has - /// returned None. + /// returned `None`. pub fn try_next(&mut self) -> Result, TryRecvError> { match self.next_message() { Poll::Ready(msg) => { diff --git a/futures-channel/src/oneshot.rs b/futures-channel/src/oneshot.rs index d3be67e71e..d9f21d3083 100644 --- a/futures-channel/src/oneshot.rs +++ b/futures-channel/src/oneshot.rs @@ -126,7 +126,7 @@ impl Inner { } // Note that this lock acquisition may fail if the receiver - // is closed and sets the `complete` flag to true, whereupon + // is closed and sets the `complete` flag to `true`, whereupon // the receiver may call `poll()`. if let Some(mut slot) = self.data.try_lock() { assert!(slot.is_none()); diff --git a/futures-executor/src/unpark_mutex.rs b/futures-executor/src/unpark_mutex.rs index 3497faac12..1f69aed756 100644 --- a/futures-executor/src/unpark_mutex.rs +++ b/futures-executor/src/unpark_mutex.rs @@ -108,7 +108,7 @@ impl UnparkMutex { self.status.store(POLLING, SeqCst); } - /// Alert the mutex that polling completed with NotReady. + /// Alert the mutex that polling completed with `Pending`. /// /// # Safety /// diff --git a/futures-util/src/stream/stream/mod.rs b/futures-util/src/stream/stream/mod.rs index da5ade85bb..4f227326f0 100644 --- a/futures-util/src/stream/stream/mod.rs +++ b/futures-util/src/stream/stream/mod.rs @@ -544,10 +544,12 @@ pub trait StreamExt: Stream { Flatten::new(self) } - /// Combinator similar to [`StreamExt::fold`] that holds internal state and produces a new stream. + /// Combinator similar to [`StreamExt::fold`] that holds internal state + /// and produces a new stream. /// - /// Accepts initial state and closure which will be applied to each element of the stream until provided closure - /// returns `None`. Once `None` is returned, stream will be terminated. + /// Accepts initial state and closure which will be applied to each element + /// of the stream until provided closure returns `None`. Once `None` is + /// returned, stream will be terminated. /// /// # Examples /// @@ -580,7 +582,7 @@ pub trait StreamExt: Stream { /// /// This function, like `Iterator::skip_while`, will skip elements on the /// stream until the predicate `f` resolves to `false`. Once one element - /// returns false all future elements will be returned from the underlying + /// returns `false`, all future elements will be returned from the underlying /// stream. /// /// # Examples @@ -611,7 +613,7 @@ pub trait StreamExt: Stream { /// /// This function, like `Iterator::take_while`, will take elements from the /// stream until the predicate `f` resolves to `false`. Once one element - /// returns false it will always return that the stream is done. + /// returns `false`, it will always return that the stream is done. /// /// # Examples /// @@ -1117,7 +1119,7 @@ pub trait StreamExt: Stream { Forward::new(self, sink) } - /// Splits this `Stream + Sink` object into separate `Stream` and `Sink` + /// Splits this `Stream + Sink` object into separate `Sink` and `Stream` /// objects. /// /// This can be useful when you want to split ownership between tasks, or diff --git a/futures-util/src/stream/try_stream/mod.rs b/futures-util/src/stream/try_stream/mod.rs index 6a7ced4f8c..45a57ed7d1 100644 --- a/futures-util/src/stream/try_stream/mod.rs +++ b/futures-util/src/stream/try_stream/mod.rs @@ -385,8 +385,9 @@ pub trait TryStreamExt: TryStream { /// Skip elements on this stream while the provided asynchronous predicate /// resolves to `true`. /// - /// This function is similar to [`StreamExt::skip_while`](crate::stream::StreamExt::skip_while) - /// but exits early if an error occurs. + /// This function is similar to + /// [`StreamExt::skip_while`](crate::stream::StreamExt::skip_while) but exits + /// early if an error occurs. /// /// # Examples /// diff --git a/futures/tests/stream.rs b/futures/tests/stream.rs index fd6a8b6da7..54f49c668d 100644 --- a/futures/tests/stream.rs +++ b/futures/tests/stream.rs @@ -20,9 +20,9 @@ fn scan() { futures::executor::block_on(async { assert_eq!( stream::iter(vec![1u8, 2, 3, 4, 6, 8, 2]) - .scan(1, |acc, e| { - *acc += 1; - futures::future::ready(if e < *acc { Some(e) } else { None }) + .scan(1, |state, e| { + *state += 1; + futures::future::ready(if e < *state { Some(e) } else { None }) }) .collect::>() .await,