From 50c5ae513fc51fbcbedbd4353b6616404008feb6 Mon Sep 17 00:00:00 2001 From: Rafael Bachmann Date: Sat, 17 Aug 2024 18:45:28 +0200 Subject: [PATCH] lint: remove double spaces from docs and doc tests --- .cirrus.yml | 6 ++--- CONTRIBUTING.md | 2 +- README.md | 2 +- tokio-util/src/codec/length_delimited.rs | 2 +- tokio-util/src/codec/mod.rs | 6 ++--- tokio-util/src/io/sync_bridge.rs | 4 +-- tokio-util/src/sync/mpsc.rs | 20 +++++++------- tokio-util/src/task/join_map.rs | 4 +-- tokio-util/src/time/wheel/mod.rs | 6 ++--- tokio-util/tests/time_delay_queue.rs | 8 +++--- tokio/README.md | 2 +- tokio/src/fs/metadata.rs | 2 +- tokio/src/fs/mocks.rs | 2 +- tokio/src/fs/open_options.rs | 4 +-- tokio/src/io/async_fd.rs | 2 +- tokio/src/io/async_write.rs | 2 +- tokio/src/io/bsd/poll_aio.rs | 26 +++++++++---------- tokio/src/io/mod.rs | 2 +- tokio/src/io/poll_evented.rs | 2 +- tokio/src/io/stdio_common.rs | 2 +- tokio/src/io/util/lines.rs | 2 +- tokio/src/macros/select.rs | 2 +- tokio/src/net/tcp/listener.rs | 4 +-- tokio/src/net/tcp/split_owned.rs | 4 +-- tokio/src/net/tcp/stream.rs | 2 +- tokio/src/net/udp.rs | 2 +- tokio/src/net/unix/listener.rs | 2 +- tokio/src/net/unix/split_owned.rs | 2 +- tokio/src/net/unix/stream.rs | 2 +- tokio/src/net/windows/named_pipe.rs | 2 +- tokio/src/runtime/blocking/pool.rs | 2 +- tokio/src/runtime/builder.rs | 2 +- tokio/src/runtime/handle.rs | 2 +- tokio/src/runtime/metrics/worker.rs | 4 +-- tokio/src/runtime/mod.rs | 2 +- tokio/src/runtime/runtime.rs | 4 +-- .../runtime/scheduler/multi_thread/worker.rs | 2 +- .../scheduler/multi_thread_alt/worker.rs | 2 +- tokio/src/runtime/task/harness.rs | 2 +- tokio/src/runtime/task/id.rs | 2 +- tokio/src/runtime/task/list.rs | 2 +- tokio/src/runtime/task/mod.rs | 2 +- tokio/src/runtime/tests/task_combinations.rs | 2 +- tokio/src/runtime/time/wheel/mod.rs | 6 ++--- tokio/src/signal/ctrl_c.rs | 2 +- tokio/src/sync/mpsc/bounded.rs | 18 ++++++------- tokio/src/sync/mpsc/mod.rs | 2 +- tokio/src/sync/mpsc/unbounded.rs | 6 ++--- tokio/src/sync/mutex.rs | 8 +++--- tokio/src/sync/notify.rs | 2 +- tokio/src/sync/once_cell.rs | 2 +- tokio/src/sync/oneshot.rs | 6 ++--- tokio/src/sync/rwlock.rs | 2 +- tokio/src/sync/watch.rs | 2 +- tokio/src/task/blocking.rs | 6 ++--- tokio/src/task/local.rs | 4 +-- tokio/src/time/clock.rs | 2 +- tokio/src/util/metric_atomics.rs | 2 +- tokio/tests/io_poll_aio.rs | 10 +++---- 59 files changed, 120 insertions(+), 120 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index a7ce0d9d456..ec99c872d15 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -7,9 +7,9 @@ env: RUST_NIGHTLY: nightly-2024-05-05 RUSTFLAGS: -D warnings -# Test FreeBSD in a full VM on cirrus-ci.com. Test the i686 target too, in the -# same VM. The binary will be built in 32-bit mode, but will execute on a -# 64-bit kernel and in a 64-bit environment. Our tests don't execute any of +# Test FreeBSD in a full VM on cirrus-ci.com. Test the i686 target too, in the +# same VM. The binary will be built in 32-bit mode, but will execute on a +# 64-bit kernel and in a 64-bit environment. Our tests don't execute any of # the system's binaries, so the environment shouldn't matter. task: name: FreeBSD 64-bit diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ad7239f4476..08f4865318a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -560,7 +560,7 @@ _Adapted from the [Node.js contributing guide][node]_. The Tokio GitHub repository has a lot of issues and PRs to keep track of. This section explains the meaning of various labels, as well as our [GitHub -project][project]. The section is primarily targeted at maintainers. Most +project][project]. The section is primarily targeted at maintainers. Most contributors aren't able to set these labels. ### Area diff --git a/README.md b/README.md index 091d1d90cec..5d28a3d64ab 100644 --- a/README.md +++ b/README.md @@ -196,7 +196,7 @@ release. The MSRV history for past minor releases can be found below: * 1.27 to 1.29 - Rust 1.56 * 1.17 to 1.26 - Rust 1.49 * 1.15 to 1.16 - Rust 1.46 - * 1.0 to 1.14 - Rust 1.45 + * 1.0 to 1.14 - Rust 1.45 Note that although we try to avoid the situation where a dependency transitively increases the MSRV of Tokio, we do not guarantee that this does not happen. diff --git a/tokio-util/src/codec/length_delimited.rs b/tokio-util/src/codec/length_delimited.rs index fed49ca8a79..7c088f1557d 100644 --- a/tokio-util/src/codec/length_delimited.rs +++ b/tokio-util/src/codec/length_delimited.rs @@ -271,7 +271,7 @@ //! second half of the head is needed. //! //! `length_field_offset` indicates how many bytes to skip before starting -//! to read the length field. `length_adjustment` is the number of bytes to +//! to read the length field. `length_adjustment` is the number of bytes to //! skip starting at the end of the length field. In this case, it is the //! second half of the head. //! diff --git a/tokio-util/src/codec/mod.rs b/tokio-util/src/codec/mod.rs index 50f01c28fa7..37966249aa4 100644 --- a/tokio-util/src/codec/mod.rs +++ b/tokio-util/src/codec/mod.rs @@ -77,7 +77,7 @@ //! A [`Decoder`] is used together with [`FramedRead`] or [`Framed`] to turn an //! [`AsyncRead`] into a [`Stream`]. The job of the decoder trait is to specify //! how sequences of bytes are turned into a sequence of frames, and to -//! determine where the boundaries between frames are. The job of the +//! determine where the boundaries between frames are. The job of the //! `FramedRead` is to repeatedly switch between reading more data from the IO //! resource, and asking the decoder whether we have received enough data to //! decode another frame of data. @@ -108,7 +108,7 @@ //! It is guaranteed that, from one call to `decode` to another, the provided //! buffer will contain the exact same data as before, except that if more data //! has arrived through the IO resource, that data will have been appended to -//! the buffer. This means that reading frames from a `FramedRead` is +//! the buffer. This means that reading frames from a `FramedRead` is //! essentially equivalent to the following loop: //! //! ```no_run @@ -217,7 +217,7 @@ //! //! An [`Encoder`] is used together with [`FramedWrite`] or [`Framed`] to turn //! an [`AsyncWrite`] into a [`Sink`]. The job of the encoder trait is to -//! specify how frames are turned into a sequences of bytes. The job of the +//! specify how frames are turned into a sequences of bytes. The job of the //! `FramedWrite` is to take the resulting sequence of bytes and write it to the //! IO resource. //! diff --git a/tokio-util/src/io/sync_bridge.rs b/tokio-util/src/io/sync_bridge.rs index 1af9a281962..61a04c5cbe5 100644 --- a/tokio-util/src/io/sync_bridge.rs +++ b/tokio-util/src/io/sync_bridge.rs @@ -122,9 +122,9 @@ impl SyncIoBridge { /// by e.g. [`tokio::task::spawn_blocking`]. /// /// Stated even more strongly: to make use of this bridge, you *must* move - /// it into a separate thread outside the runtime. The synchronous I/O will use the + /// it into a separate thread outside the runtime. The synchronous I/O will use the /// underlying handle to block on the backing asynchronous source, via - /// [`tokio::runtime::Handle::block_on`]. As noted in the documentation for that + /// [`tokio::runtime::Handle::block_on`]. As noted in the documentation for that /// function, an attempt to `block_on` from an asynchronous execution context /// will panic. /// diff --git a/tokio-util/src/sync/mpsc.rs b/tokio-util/src/sync/mpsc.rs index 8e2ff814622..98977d3a102 100644 --- a/tokio-util/src/sync/mpsc.rs +++ b/tokio-util/src/sync/mpsc.rs @@ -15,7 +15,7 @@ impl PollSendError { /// Consumes the stored value, if any. /// /// If this error was encountered when calling `start_send`/`send_item`, this will be the item - /// that the caller attempted to send. Otherwise, it will be `None`. + /// that the caller attempted to send. Otherwise, it will be `None`. pub fn into_inner(self) -> Option { self.0 } @@ -47,7 +47,7 @@ pub struct PollSender { acquire: PollSenderFuture, } -// Creates a future for acquiring a permit from the underlying channel. This is used to ensure +// Creates a future for acquiring a permit from the underlying channel. This is used to ensure // there's capacity for a send to complete. // // By reusing the same async fn for both `Some` and `None`, we make sure every future passed to @@ -133,7 +133,7 @@ impl PollSender { /// /// # Errors /// - /// If the channel is closed, an error will be returned. This is a permanent state. + /// If the channel is closed, an error will be returned. This is a permanent state. pub fn poll_reserve(&mut self, cx: &mut Context<'_>) -> Poll>> { loop { let (result, next_state) = match self.take_state() { @@ -173,7 +173,7 @@ impl PollSender { /// /// # Errors /// - /// If the channel is closed, an error will be returned. This is a permanent state. + /// If the channel is closed, an error will be returned. This is a permanent state. /// /// # Panics /// @@ -221,8 +221,8 @@ impl PollSender { /// remain open until all senders have dropped, or until the [`Receiver`] closes the channel. /// /// If a slot was previously reserved by calling `poll_reserve`, then a final call can be made - /// to `send_item` in order to consume the reserved slot. After that, no further sends will be - /// possible. If you do not intend to send another item, you can release the reserved slot back + /// to `send_item` in order to consume the reserved slot. After that, no further sends will be + /// possible. If you do not intend to send another item, you can release the reserved slot back /// to the underlying sender by calling [`abort_send`]. /// /// [`abort_send`]: crate::sync::PollSender::abort_send @@ -232,7 +232,7 @@ impl PollSender { self.sender = None; // If we're already idle, closed, or we haven't yet reserved a slot, we can quickly - // transition to the closed state. Otherwise, leave the existing permit in place for the + // transition to the closed state. Otherwise, leave the existing permit in place for the // caller if they want to complete the send. match self.state { State::Idle(_) => self.state = State::Closed, @@ -246,12 +246,12 @@ impl PollSender { /// Aborts the current in-progress send, if any. /// - /// Returns `true` if a send was aborted. If the sender was closed prior to calling + /// Returns `true` if a send was aborted. If the sender was closed prior to calling /// `abort_send`, then the sender will remain in the closed state, otherwise the sender will be /// ready to attempt another send. pub fn abort_send(&mut self) -> bool { // We may have been closed in the meantime, after a call to `poll_reserve` already - // succeeded. We'll check if `self.sender` is `None` to see if we should transition to the + // succeeded. We'll check if `self.sender` is `None` to see if we should transition to the // closed state when we actually abort a send, rather than resetting ourselves back to idle. let (result, next_state) = match self.take_state() { @@ -268,7 +268,7 @@ impl PollSender { }; (true, state) } - // We got the permit. If we haven't closed yet, get the sender back. + // We got the permit. If we haven't closed yet, get the sender back. State::ReadyToSend(permit) => { let state = if self.sender.is_some() { State::Idle(permit.release()) diff --git a/tokio-util/src/task/join_map.rs b/tokio-util/src/task/join_map.rs index 13e27bb670b..c17d58f63f5 100644 --- a/tokio-util/src/task/join_map.rs +++ b/tokio-util/src/task/join_map.rs @@ -13,7 +13,7 @@ use tokio::task::{AbortHandle, Id, JoinError, JoinSet, LocalSet}; /// keys. /// /// This type is very similar to the [`JoinSet`] type in `tokio::task`, with the -/// addition of a set of keys associated with each task. These keys allow +/// addition of a set of keys associated with each task. These keys allow /// [cancelling a task][abort] or [multiple tasks][abort_matching] in the /// `JoinMap` based on their keys, or [test whether a task corresponding to a /// given key exists][contains] in the `JoinMap`. @@ -463,7 +463,7 @@ where /// completed. The `value` is the return value of that ask, and `key` is /// the key associated with the task. /// * `Some((key, Err(err))` if one of the tasks in this `JoinMap` has - /// panicked or been aborted. `key` is the key associated with the task + /// panicked or been aborted. `key` is the key associated with the task /// that panicked or was aborted. /// * `None` if the `JoinMap` is empty. /// diff --git a/tokio-util/src/time/wheel/mod.rs b/tokio-util/src/time/wheel/mod.rs index c067ed7c37a..e08659931aa 100644 --- a/tokio-util/src/time/wheel/mod.rs +++ b/tokio-util/src/time/wheel/mod.rs @@ -164,7 +164,7 @@ where } else { // in this case the poll did not indicate an expiration // _and_ we were not able to find a next expiration in - // the current list of timers. advance to the poll's + // the current list of timers. Advance to the poll's // current time and do nothing else. self.set_elapsed(now); return None; @@ -203,8 +203,8 @@ where res } - /// iteratively find entries that are between the wheel's current - /// time and the expiration time. for each in that population either + /// Iteratively find entries that are between the wheel's current + /// time and the expiration time. For each in that population either /// return it for notification (in the case of the last level) or tier /// it down to the next level (in all other cases). pub(crate) fn poll_expiration( diff --git a/tokio-util/tests/time_delay_queue.rs b/tokio-util/tests/time_delay_queue.rs index d9584e111d8..ff415713a04 100644 --- a/tokio-util/tests/time_delay_queue.rs +++ b/tokio-util/tests/time_delay_queue.rs @@ -539,8 +539,8 @@ async fn reset_later_after_slot_starts() { // At this point the queue hasn't been polled, so `elapsed` on the wheel // for the queue is still at 0 and hence the 1ms resolution slots cover - // [0-64). Resetting the time on the entry to 120 causes it to get put in - // the [64-128) slot. As the queue knows that the first entry is within + // [0-64). Resetting the time on the entry to 120 causes it to get put in + // the [64-128) slot. As the queue knows that the first entry is within // that slot, but doesn't know when, it must wake immediately to advance // the wheel. queue.reset_at(&foo, now + ms(120)); @@ -601,8 +601,8 @@ async fn reset_earlier_after_slot_starts() { // At this point the queue hasn't been polled, so `elapsed` on the wheel // for the queue is still at 0 and hence the 1ms resolution slots cover - // [0-64). Resetting the time on the entry to 120 causes it to get put in - // the [64-128) slot. As the queue knows that the first entry is within + // [0-64). Resetting the time on the entry to 120 causes it to get put in + // the [64-128) slot. As the queue knows that the first entry is within // that slot, but doesn't know when, it must wake immediately to advance // the wheel. queue.reset_at(&foo, now + ms(120)); diff --git a/tokio/README.md b/tokio/README.md index 091d1d90cec..5d28a3d64ab 100644 --- a/tokio/README.md +++ b/tokio/README.md @@ -196,7 +196,7 @@ release. The MSRV history for past minor releases can be found below: * 1.27 to 1.29 - Rust 1.56 * 1.17 to 1.26 - Rust 1.49 * 1.15 to 1.16 - Rust 1.46 - * 1.0 to 1.14 - Rust 1.45 + * 1.0 to 1.14 - Rust 1.45 Note that although we try to avoid the situation where a dependency transitively increases the MSRV of Tokio, we do not guarantee that this does not happen. diff --git a/tokio/src/fs/metadata.rs b/tokio/src/fs/metadata.rs index 21ebe4f786b..68ea6288aa2 100644 --- a/tokio/src/fs/metadata.rs +++ b/tokio/src/fs/metadata.rs @@ -15,7 +15,7 @@ use std::path::Path; /// # Platform-specific behavior /// /// This function currently corresponds to the `stat` function on Unix and the -/// `GetFileAttributesEx` function on Windows. Note that, this [may change in +/// `GetFileAttributesEx` function on Windows. Note that, this [may change in /// the future][changes]. /// /// [changes]: https://doc.rust-lang.org/std/io/index.html#platform-specific-behavior diff --git a/tokio/src/fs/mocks.rs b/tokio/src/fs/mocks.rs index 80317c5eff5..b8584cc09e1 100644 --- a/tokio/src/fs/mocks.rs +++ b/tokio/src/fs/mocks.rs @@ -20,7 +20,7 @@ mock! { pub fn create(pb: PathBuf) -> io::Result; // These inner_ methods exist because std::fs::File has two // implementations for each of these methods: one on "&mut self" and - // one on "&&self". Defining both of those in terms of an inner_ method + // one on "&&self". Defining both of those in terms of an inner_ method // allows us to specify the expectation the same way, regardless of // which method is used. pub fn inner_flush(&self) -> io::Result<()>; diff --git a/tokio/src/fs/open_options.rs b/tokio/src/fs/open_options.rs index 12615393867..dbf0bec651a 100644 --- a/tokio/src/fs/open_options.rs +++ b/tokio/src/fs/open_options.rs @@ -165,7 +165,7 @@ impl OpenOptions { /// Sets the option for the append mode. /// /// This option, when true, means that writes will append to a file instead - /// of overwriting previous contents. Note that setting + /// of overwriting previous contents. Note that setting /// `.write(true).append(true)` has the same effect as setting only /// `.append(true)`. /// @@ -292,7 +292,7 @@ impl OpenOptions { /// Sets the option to always create a new file. /// - /// This option indicates whether a new file will be created. No file is + /// This option indicates whether a new file will be created. No file is /// allowed to exist at the target location, also no (dangling) symlink. /// /// This option is useful because it is atomic. Otherwise between checking diff --git a/tokio/src/io/async_fd.rs b/tokio/src/io/async_fd.rs index 96d0518a6e5..848a3c09a9b 100644 --- a/tokio/src/io/async_fd.rs +++ b/tokio/src/io/async_fd.rs @@ -67,7 +67,7 @@ use std::{task::Context, task::Poll}; /// # Examples /// /// This example shows how to turn [`std::net::TcpStream`] asynchronous using -/// `AsyncFd`. It implements the read/write operations both as an `async fn` +/// `AsyncFd`. It implements the read/write operations both as an `async fn` /// and using the IO traits [`AsyncRead`] and [`AsyncWrite`]. /// /// ```no_run diff --git a/tokio/src/io/async_write.rs b/tokio/src/io/async_write.rs index 7ec1a302efa..c2cd15e1dbb 100644 --- a/tokio/src/io/async_write.rs +++ b/tokio/src/io/async_write.rs @@ -28,7 +28,7 @@ use std::task::{Context, Poll}; /// This trait importantly means that the [`write`][stdwrite] method only works in /// the context of a future's task. The object may panic if used outside of a task. /// -/// Note that this trait also represents that the [`Write::flush`][stdflush] method +/// Note that this trait also represents that the [`Write::flush`][stdflush] method /// works very similarly to the `write` method, notably that `Ok(())` means that the /// writer has successfully been flushed, a "would block" error means that the /// current task is ready to receive a notification when flushing can make more diff --git a/tokio/src/io/bsd/poll_aio.rs b/tokio/src/io/bsd/poll_aio.rs index 708ca7484e7..697fd66fbdd 100644 --- a/tokio/src/io/bsd/poll_aio.rs +++ b/tokio/src/io/bsd/poll_aio.rs @@ -70,7 +70,7 @@ impl Source for MioSource { /// /// If [`Aio::poll_ready`] returns ready, but the consumer determines that the /// Source is not completely ready and must return to the Pending state, -/// [`Aio::clear_ready`] may be used. This can be useful with +/// [`Aio::clear_ready`] may be used. This can be useful with /// [`lio_listio`], which may generate a kevent when only a portion of the /// operations have completed. /// @@ -82,10 +82,10 @@ impl Source for MioSource { /// [`lio_listio`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/lio_listio.html // Note: Unlike every other kqueue event source, POSIX AIO registers events not // via kevent(2) but when the aiocb is submitted to the kernel via aio_read, -// aio_write, etc. It needs the kqueue's file descriptor to do that. So +// aio_write, etc. It needs the kqueue's file descriptor to do that. So // AsyncFd can't be used for POSIX AIO. // -// Note that Aio doesn't implement Drop. There's no need. Unlike other +// Note that Aio doesn't implement Drop. There's no need. Unlike other // kqueue sources, simply dropping the object effectively deregisters it. pub struct Aio { io: MioSource, @@ -97,7 +97,7 @@ pub struct Aio { impl Aio { /// Creates a new `Aio` suitable for use with POSIX AIO functions. /// - /// It will be associated with the default reactor. The runtime is usually + /// It will be associated with the default reactor. The runtime is usually /// set implicitly when this function is called from a future driven by a /// Tokio runtime, otherwise runtime can be set explicitly with /// [`Runtime::enter`](crate::runtime::Runtime::enter) function. @@ -107,7 +107,7 @@ impl Aio { /// Creates a new `Aio` suitable for use with [`lio_listio`]. /// - /// It will be associated with the default reactor. The runtime is usually + /// It will be associated with the default reactor. The runtime is usually /// set implicitly when this function is called from a future driven by a /// Tokio runtime, otherwise runtime can be set explicitly with /// [`Runtime::enter`](crate::runtime::Runtime::enter) function. @@ -124,20 +124,20 @@ impl Aio { Ok(Self { io, registration }) } - /// Indicates to Tokio that the source is no longer ready. The internal + /// Indicates to Tokio that the source is no longer ready. The internal /// readiness flag will be cleared, and tokio will wait for the next /// edge-triggered readiness notification from the OS. /// /// It is critical that this method not be called unless your code - /// _actually observes_ that the source is _not_ ready. The OS must + /// _actually observes_ that the source is _not_ ready. The OS must /// deliver a subsequent notification, or this source will block - /// forever. It is equally critical that you `do` call this method if you + /// forever. It is equally critical that you `do` call this method if you /// resubmit the same structure to the kernel and poll it again. /// /// This method is not very useful with AIO readiness, since each `aiocb` - /// structure is typically only used once. It's main use with + /// structure is typically only used once. It's main use with /// [`lio_listio`], which will sometimes send notification when only a - /// portion of its elements are complete. In that case, the caller must + /// portion of its elements are complete. In that case, the caller must /// call `clear_ready` before resubmitting it. /// /// [`lio_listio`]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/lio_listio.html @@ -150,14 +150,14 @@ impl Aio { self.io.0 } - /// Polls for readiness. Either AIO or LIO counts. + /// Polls for readiness. Either AIO or LIO counts. /// /// This method returns: /// * `Poll::Pending` if the underlying operation is not complete, whether - /// or not it completed successfully. This will be true if the OS is + /// or not it completed successfully. This will be true if the OS is /// still processing it, or if it has not yet been submitted to the OS. /// * `Poll::Ready(Ok(_))` if the underlying operation is complete. - /// * `Poll::Ready(Err(_))` if the reactor has been shutdown. This does + /// * `Poll::Ready(Err(_))` if the reactor has been shutdown. This does /// _not_ indicate that the underlying operation encountered an error. /// /// When the method returns `Poll::Pending`, the `Waker` in the provided `Context` diff --git a/tokio/src/io/mod.rs b/tokio/src/io/mod.rs index b35a20dd35b..2fbc0aa57b3 100644 --- a/tokio/src/io/mod.rs +++ b/tokio/src/io/mod.rs @@ -154,7 +154,7 @@ //! These APIs are very similar to the ones provided by `std`, but they also //! implement [`AsyncRead`] and [`AsyncWrite`]. //! -//! Note that the standard input / output APIs **must** be used from the +//! Note that the standard input / output APIs **must** be used from the //! context of the Tokio runtime, as they require Tokio-specific features to //! function. Calling these functions outside of a Tokio runtime will panic. //! diff --git a/tokio/src/io/poll_evented.rs b/tokio/src/io/poll_evented.rs index 73cb8e5809e..16c9b618a26 100644 --- a/tokio/src/io/poll_evented.rs +++ b/tokio/src/io/poll_evented.rs @@ -244,7 +244,7 @@ feature! { match self.io.as_ref().unwrap().write(buf) { Ok(n) => { // if we write only part of our buffer, this is sufficient on unix to show - // that the socket buffer is full. Unfortunately this assumption + // that the socket buffer is full. Unfortunately this assumption // fails for level-triggered selectors (like on Windows or poll even for // UNIX): https://github.com/tokio-rs/tokio/issues/5866 if n > 0 && (!cfg!(windows) && !cfg!(mio_unsupported_force_poll_poll) && n < buf.len()) { diff --git a/tokio/src/io/stdio_common.rs b/tokio/src/io/stdio_common.rs index 4adbfe23606..c2faf378fd1 100644 --- a/tokio/src/io/stdio_common.rs +++ b/tokio/src/io/stdio_common.rs @@ -56,7 +56,7 @@ where // Now there are two possibilities. // If caller gave is binary buffer, we **should not** shrink it // anymore, because excessive shrinking hits performance. - // If caller gave as binary buffer, we **must** additionally + // If caller gave as binary buffer, we **must** additionally // shrink it to strip incomplete char at the end of buffer. // that's why check we will perform now is allowed to have // false-positive. diff --git a/tokio/src/io/util/lines.rs b/tokio/src/io/util/lines.rs index 717f633f950..644182d66bc 100644 --- a/tokio/src/io/util/lines.rs +++ b/tokio/src/io/util/lines.rs @@ -106,7 +106,7 @@ where /// /// When the method returns `Poll::Pending`, the `Waker` in the provided /// `Context` is scheduled to receive a wakeup when more bytes become - /// available on the underlying IO resource. Note that on multiple calls to + /// available on the underlying IO resource. Note that on multiple calls to /// `poll_next_line`, only the `Waker` from the `Context` passed to the most /// recent call is scheduled to receive a wakeup. pub fn poll_next_line( diff --git a/tokio/src/macros/select.rs b/tokio/src/macros/select.rs index d1e59d34736..a4621664b8e 100644 --- a/tokio/src/macros/select.rs +++ b/tokio/src/macros/select.rs @@ -92,7 +92,7 @@ macro_rules! doc { /// When using `select!` in a loop to receive messages from multiple sources, /// you should make sure that the receive call is cancellation safe to avoid /// losing messages. This section goes through various common methods and - /// describes whether they are cancel safe. The lists in this section are not + /// describes whether they are cancel safe. The lists in this section are not /// exhaustive. /// /// The following methods are cancellation safe: diff --git a/tokio/src/net/tcp/listener.rs b/tokio/src/net/tcp/listener.rs index 3f6592abe19..65db636824e 100644 --- a/tokio/src/net/tcp/listener.rs +++ b/tokio/src/net/tcp/listener.rs @@ -171,7 +171,7 @@ impl TcpListener { /// Polls to accept a new incoming connection to this listener. /// /// If there is no connection to accept, `Poll::Pending` is returned and the - /// current task will be notified by a waker. Note that on multiple calls + /// current task will be notified by a waker. Note that on multiple calls /// to `poll_accept`, only the `Waker` from the `Context` passed to the most /// recent call is scheduled to receive a wakeup. pub fn poll_accept(&self, cx: &mut Context<'_>) -> Poll> { @@ -243,7 +243,7 @@ impl TcpListener { /// Turns a [`tokio::net::TcpListener`] into a [`std::net::TcpListener`]. /// /// The returned [`std::net::TcpListener`] will have nonblocking mode set as - /// `true`. Use [`set_nonblocking`] to change the blocking mode if needed. + /// `true`. Use [`set_nonblocking`] to change the blocking mode if needed. /// /// # Examples /// diff --git a/tokio/src/net/tcp/split_owned.rs b/tokio/src/net/tcp/split_owned.rs index 6771d6497a2..d48c74423f3 100644 --- a/tokio/src/net/tcp/split_owned.rs +++ b/tokio/src/net/tcp/split_owned.rs @@ -1,7 +1,7 @@ //! `TcpStream` owned split support. //! //! A `TcpStream` can be split into an `OwnedReadHalf` and a `OwnedWriteHalf` -//! with the `TcpStream::into_split` method. `OwnedReadHalf` implements +//! with the `TcpStream::into_split` method. `OwnedReadHalf` implements //! `AsyncRead` while `OwnedWriteHalf` implements `AsyncWrite`. //! //! Compared to the generic split of `AsyncRead + AsyncWrite`, this specialized @@ -39,7 +39,7 @@ pub struct OwnedReadHalf { /// Owned write half of a [`TcpStream`], created by [`into_split`]. /// /// Note that in the [`AsyncWrite`] implementation of this type, [`poll_shutdown`] will -/// shut down the TCP stream in the write direction. Dropping the write half +/// shut down the TCP stream in the write direction. Dropping the write half /// will also shut down the write half of the TCP stream. /// /// Writing to an `OwnedWriteHalf` is usually done using the convenience methods found diff --git a/tokio/src/net/tcp/stream.rs b/tokio/src/net/tcp/stream.rs index e20473e5cc3..25d9a2a71b7 100644 --- a/tokio/src/net/tcp/stream.rs +++ b/tokio/src/net/tcp/stream.rs @@ -76,7 +76,7 @@ impl TcpStream { /// Opens a TCP connection to a remote host. /// /// `addr` is an address of the remote host. Anything which implements the - /// [`ToSocketAddrs`] trait can be supplied as the address. If `addr` + /// [`ToSocketAddrs`] trait can be supplied as the address. If `addr` /// yields multiple addresses, connect will be attempted with each of the /// addresses until a connection is successful. If none of the addresses /// result in a successful connection, the error returned from the last diff --git a/tokio/src/net/udp.rs b/tokio/src/net/udp.rs index 03a66585047..6932d1ff358 100644 --- a/tokio/src/net/udp.rs +++ b/tokio/src/net/udp.rs @@ -226,7 +226,7 @@ impl UdpSocket { /// Turns a [`tokio::net::UdpSocket`] into a [`std::net::UdpSocket`]. /// /// The returned [`std::net::UdpSocket`] will have nonblocking mode set as - /// `true`. Use [`set_nonblocking`] to change the blocking mode if needed. + /// `true`. Use [`set_nonblocking`] to change the blocking mode if needed. /// /// # Examples /// diff --git a/tokio/src/net/unix/listener.rs b/tokio/src/net/unix/listener.rs index 79b554ee1ab..d189ea27955 100644 --- a/tokio/src/net/unix/listener.rs +++ b/tokio/src/net/unix/listener.rs @@ -179,7 +179,7 @@ impl UnixListener { /// Polls to accept a new incoming connection to this listener. /// /// If there is no connection to accept, `Poll::Pending` is returned and the - /// current task will be notified by a waker. Note that on multiple calls + /// current task will be notified by a waker. Note that on multiple calls /// to `poll_accept`, only the `Waker` from the `Context` passed to the most /// recent call is scheduled to receive a wakeup. pub fn poll_accept(&self, cx: &mut Context<'_>) -> Poll> { diff --git a/tokio/src/net/unix/split_owned.rs b/tokio/src/net/unix/split_owned.rs index d1c6f93ded7..66393fc3e65 100644 --- a/tokio/src/net/unix/split_owned.rs +++ b/tokio/src/net/unix/split_owned.rs @@ -1,7 +1,7 @@ //! `UnixStream` owned split support. //! //! A `UnixStream` can be split into an `OwnedReadHalf` and a `OwnedWriteHalf` -//! with the `UnixStream::into_split` method. `OwnedReadHalf` implements +//! with the `UnixStream::into_split` method. `OwnedReadHalf` implements //! `AsyncRead` while `OwnedWriteHalf` implements `AsyncWrite`. //! //! Compared to the generic split of `AsyncRead + AsyncWrite`, this specialized diff --git a/tokio/src/net/unix/stream.rs b/tokio/src/net/unix/stream.rs index 60d58139699..ce7c09888df 100644 --- a/tokio/src/net/unix/stream.rs +++ b/tokio/src/net/unix/stream.rs @@ -808,7 +808,7 @@ impl UnixStream { /// Turns a [`tokio::net::UnixStream`] into a [`std::os::unix::net::UnixStream`]. /// /// The returned [`std::os::unix::net::UnixStream`] will have nonblocking - /// mode set as `true`. Use [`set_nonblocking`] to change the blocking + /// mode set as `true`. Use [`set_nonblocking`] to change the blocking /// mode if needed. /// /// # Examples diff --git a/tokio/src/net/windows/named_pipe.rs b/tokio/src/net/windows/named_pipe.rs index 0b312f896f1..14a837292b2 100644 --- a/tokio/src/net/windows/named_pipe.rs +++ b/tokio/src/net/windows/named_pipe.rs @@ -1782,7 +1782,7 @@ impl ServerOptions { /// The default pipe mode is [`PipeMode::Byte`]. See [`PipeMode`] for /// documentation of what each mode means. /// - /// This corresponds to specifying `PIPE_TYPE_` and `PIPE_READMODE_` in [`dwPipeMode`]. + /// This corresponds to specifying `PIPE_TYPE_` and `PIPE_READMODE_` in [`dwPipeMode`]. /// /// [`dwPipeMode`]: https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-createnamedpipea pub fn pipe_mode(&mut self, pipe_mode: PipeMode) -> &mut Self { diff --git a/tokio/src/runtime/blocking/pool.rs b/tokio/src/runtime/blocking/pool.rs index de9681d04e0..09745f58c7c 100644 --- a/tokio/src/runtime/blocking/pool.rs +++ b/tokio/src/runtime/blocking/pool.rs @@ -311,7 +311,7 @@ impl Spawner { // Compat: do not panic here, return the join_handle even though it will never resolve Err(SpawnError::ShuttingDown) => join_handle, Err(SpawnError::NoThreads(e)) => { - panic!("OS can't spawn worker thread: {e}") + panic!("OS can't spawn worker thread: {e}"); } } } diff --git a/tokio/src/runtime/builder.rs b/tokio/src/runtime/builder.rs index 16be770985c..1baaea625b1 100644 --- a/tokio/src/runtime/builder.rs +++ b/tokio/src/runtime/builder.rs @@ -686,7 +686,7 @@ impl Builder { /// ``` /// use tokio::runtime::Builder; /// - /// let rt = Builder::new_multi_thread().build().unwrap(); + /// let rt = Builder::new_multi_thread().build().unwrap(); /// /// rt.block_on(async { /// println!("Hello from the Tokio runtime"); diff --git a/tokio/src/runtime/handle.rs b/tokio/src/runtime/handle.rs index 4ccc5880325..9dd110f04ad 100644 --- a/tokio/src/runtime/handle.rs +++ b/tokio/src/runtime/handle.rs @@ -255,7 +255,7 @@ impl Handle { /// use tokio::runtime::Runtime; /// /// // Create the runtime - /// let rt = Runtime::new().unwrap(); + /// let rt = Runtime::new().unwrap(); /// /// // Get a handle from this runtime /// let handle = rt.handle(); diff --git a/tokio/src/runtime/metrics/worker.rs b/tokio/src/runtime/metrics/worker.rs index 29804a08798..0bccfcf0c94 100644 --- a/tokio/src/runtime/metrics/worker.rs +++ b/tokio/src/runtime/metrics/worker.rs @@ -15,10 +15,10 @@ use std::thread::ThreadId; #[derive(Debug, Default)] #[repr(align(128))] pub(crate) struct WorkerMetrics { - /// Number of times the worker parked. + /// Number of times the worker parked. pub(crate) park_count: MetricAtomicU64, - /// Number of times the worker parked and unparked. + /// Number of times the worker parked and unparked. pub(crate) park_unpark_count: MetricAtomicU64, /// Number of times the worker woke then parked again without doing work. diff --git a/tokio/src/runtime/mod.rs b/tokio/src/runtime/mod.rs index 38a0285b3be..9b192ce7622 100644 --- a/tokio/src/runtime/mod.rs +++ b/tokio/src/runtime/mod.rs @@ -68,7 +68,7 @@ //! //! fn main() -> Result<(), Box> { //! // Create the runtime -//! let rt = Runtime::new()?; +//! let rt = Runtime::new()?; //! //! // Spawn the root task //! rt.block_on(async { diff --git a/tokio/src/runtime/runtime.rs b/tokio/src/runtime/runtime.rs index 16f8718ab23..4d14b6b46f7 100644 --- a/tokio/src/runtime/runtime.rs +++ b/tokio/src/runtime/runtime.rs @@ -154,7 +154,7 @@ impl Runtime { /// initialized. /// /// Most applications will not need to call this function directly. Instead, - /// they will use the [`#[tokio::main]` attribute][main]. When a more complex + /// they will use the [`#[tokio::main]` attribute][main]. When a more complex /// configuration is necessary, the [runtime builder] may be used. /// /// See [module level][mod] documentation for more details. @@ -318,7 +318,7 @@ impl Runtime { /// use tokio::runtime::Runtime; /// /// // Create the runtime - /// let rt = Runtime::new().unwrap(); + /// let rt = Runtime::new().unwrap(); /// /// // Execute the future, blocking the current thread until completion /// rt.block_on(async { diff --git a/tokio/src/runtime/scheduler/multi_thread/worker.rs b/tokio/src/runtime/scheduler/multi_thread/worker.rs index 6e69ef74b45..54d1fa9aeba 100644 --- a/tokio/src/runtime/scheduler/multi_thread/worker.rs +++ b/tokio/src/runtime/scheduler/multi_thread/worker.rs @@ -373,7 +373,7 @@ where }, false, ) => { - // We are on an executor, but _not_ on the thread pool. That is + // We are on an executor, but _not_ on the thread pool. That is // _only_ okay if we are in a thread pool runtime's block_on // method: if allow_block_in_place { diff --git a/tokio/src/runtime/scheduler/multi_thread_alt/worker.rs b/tokio/src/runtime/scheduler/multi_thread_alt/worker.rs index b55dc317a77..875a32afafb 100644 --- a/tokio/src/runtime/scheduler/multi_thread_alt/worker.rs +++ b/tokio/src/runtime/scheduler/multi_thread_alt/worker.rs @@ -389,7 +389,7 @@ where }, false, ) => { - // We are on an executor, but _not_ on the thread pool. That is + // We are on an executor, but _not_ on the thread pool. That is // _only_ okay if we are in a thread pool runtime's block_on // method: if allow_block_in_place { diff --git a/tokio/src/runtime/task/harness.rs b/tokio/src/runtime/task/harness.rs index 8479becd80a..55db44b85c3 100644 --- a/tokio/src/runtime/task/harness.rs +++ b/tokio/src/runtime/task/harness.rs @@ -89,7 +89,7 @@ impl RawTask { } /// This call notifies the task. It will not consume any ref-counts, but the - /// caller should hold a ref-count. This will create a new Notified and + /// caller should hold a ref-count. This will create a new Notified and /// submit it if necessary. pub(super) fn wake_by_ref(&self) { use super::state::TransitionToNotifiedByRef; diff --git a/tokio/src/runtime/task/id.rs b/tokio/src/runtime/task/id.rs index 9c3b1403ec2..8429495a121 100644 --- a/tokio/src/runtime/task/id.rs +++ b/tokio/src/runtime/task/id.rs @@ -50,7 +50,7 @@ pub fn id() -> Id { /// Returns the [`Id`] of the currently running task, or `None` if called outside /// of a task. /// -/// This function is similar to [`task::id()`](crate::runtime::task::id()), except +/// This function is similar to [`task::id()`](crate::runtime::task::id()), except /// that it returns `None` rather than panicking if called outside of a task /// context. /// diff --git a/tokio/src/runtime/task/list.rs b/tokio/src/runtime/task/list.rs index 988d422836d..4e75bf9666c 100644 --- a/tokio/src/runtime/task/list.rs +++ b/tokio/src/runtime/task/list.rs @@ -311,7 +311,7 @@ impl LocalOwnedTasks { F: FnOnce(&mut OwnedTasksInner) -> T, { // safety: This type is not Sync, so concurrent calls of this method - // can't happen. Furthermore, all uses of this method in this file make + // can't happen. Furthermore, all uses of this method in this file make // sure that they don't call `with_inner` recursively. self.inner.with_mut(|ptr| unsafe { f(&mut *ptr) }) } diff --git a/tokio/src/runtime/task/mod.rs b/tokio/src/runtime/task/mod.rs index 8248fc0b591..51421f4d02e 100644 --- a/tokio/src/runtime/task/mod.rs +++ b/tokio/src/runtime/task/mod.rs @@ -125,7 +125,7 @@ //! //! ## Non-Send futures //! -//! If a future is not Send, then it is bound to a `LocalOwnedTasks`. The future +//! If a future is not Send, then it is bound to a `LocalOwnedTasks`. The future //! will only ever be polled or dropped given a `LocalNotified` or inside a call //! to `LocalOwnedTasks::shutdown_all`. In either case, it is guaranteed that the //! future is on the right thread. diff --git a/tokio/src/runtime/tests/task_combinations.rs b/tokio/src/runtime/tests/task_combinations.rs index 0f99ed66247..3ad9fbfc8b4 100644 --- a/tokio/src/runtime/tests/task_combinations.rs +++ b/tokio/src/runtime/tests/task_combinations.rs @@ -114,7 +114,7 @@ fn test_combinations() { for ji in ji.iter().copied() { for jh in jh.iter().copied() { for abort in abort.iter().copied() { - // abort via join handle --- abort handles + // abort via join handle --- abort handles // may be dropped at any point for ah in ah.iter().copied() { test_combination( diff --git a/tokio/src/runtime/time/wheel/mod.rs b/tokio/src/runtime/time/wheel/mod.rs index e10e96b213a..3533e25051d 100644 --- a/tokio/src/runtime/time/wheel/mod.rs +++ b/tokio/src/runtime/time/wheel/mod.rs @@ -154,7 +154,7 @@ impl Wheel { _ => { // in this case the poll did not indicate an expiration // _and_ we were not able to find a next expiration in - // the current list of timers. advance to the poll's + // the current list of timers. Advance to the poll's // current time and do nothing else. self.set_elapsed(now); break; @@ -211,8 +211,8 @@ impl Wheel { res } - /// iteratively find entries that are between the wheel's current - /// time and the expiration time. for each in that population either + /// Iteratively find entries that are between the wheel's current + /// time and the expiration time. For each in that population either /// queue it for notification (in the case of the last level) or tier /// it down to the next level (in all other cases). pub(crate) fn process_expiration(&mut self, expiration: &Expiration) { diff --git a/tokio/src/signal/ctrl_c.rs b/tokio/src/signal/ctrl_c.rs index e1e92fa9977..2654d659a0f 100644 --- a/tokio/src/signal/ctrl_c.rs +++ b/tokio/src/signal/ctrl_c.rs @@ -26,7 +26,7 @@ use std::io; /// receives a signal generated by `"CTRL+C"` on the terminal. But, when a /// `ctrl_c` stream is created to listen for this signal, the time it arrives, /// it will be translated to a stream event, and the process will continue to -/// execute. **Even if this `Signal` instance is dropped, subsequent `SIGINT` +/// execute. **Even if this `Signal` instance is dropped, subsequent `SIGINT` /// deliveries will end up captured by Tokio, and the default platform behavior /// will NOT be reset**. /// diff --git a/tokio/src/sync/mpsc/bounded.rs b/tokio/src/sync/mpsc/bounded.rs index beda7fe1bf4..5bba0be40a4 100644 --- a/tokio/src/sync/mpsc/bounded.rs +++ b/tokio/src/sync/mpsc/bounded.rs @@ -111,7 +111,7 @@ pub struct Receiver { /// Creates a bounded mpsc channel for communicating between asynchronous tasks /// with backpressure. /// -/// The channel will buffer up to the provided number of messages. Once the +/// The channel will buffer up to the provided number of messages. Once the /// buffer is full, attempts to send new messages will wait until a message is /// received from the channel. The provided buffer capacity must be at least 1. /// @@ -189,7 +189,7 @@ impl Receiver { /// /// If there are no messages in the channel's buffer, but the channel has /// not yet been closed, this method will sleep until a message is sent or - /// the channel is closed. Note that if [`close`] is called, but there are + /// the channel is closed. Note that if [`close`] is called, but there are /// still outstanding [`Permits`] from before it was closed, the channel is /// not considered closed by `recv` until the permits are released. /// @@ -622,7 +622,7 @@ impl Receiver { /// /// When the method returns `Poll::Pending`, the `Waker` in the provided /// `Context` is scheduled to receive a wakeup when a message is sent on any - /// receiver, or when the channel is closed. Note that on multiple calls to + /// receiver, or when the channel is closed. Note that on multiple calls to /// `poll_recv` or `poll_recv_many`, only the `Waker` from the `Context` /// passed to the most recent call is scheduled to receive a wakeup. /// @@ -646,7 +646,7 @@ impl Receiver { /// /// When the method returns `Poll::Pending`, the `Waker` in the provided /// `Context` is scheduled to receive a wakeup when a message is sent on any - /// receiver, or when the channel is closed. Note that on multiple calls to + /// receiver, or when the channel is closed. Note that on multiple calls to /// `poll_recv` or `poll_recv_many`, only the `Waker` from the `Context` /// passed to the most recent call is scheduled to receive a wakeup. /// @@ -768,7 +768,7 @@ impl Sender { /// capacity, then use the returned [`Permit`] to send the message. /// /// This channel uses a queue to ensure that calls to `send` and `reserve` - /// complete in the order they were requested. Cancelling a call to + /// complete in the order they were requested. Cancelling a call to /// `send` makes you lose your place in the queue. /// /// # Examples @@ -1068,7 +1068,7 @@ impl Sender { /// # Cancel safety /// /// This channel uses a queue to ensure that calls to `send` and `reserve` - /// complete in the order they were requested. Cancelling a call to + /// complete in the order they were requested. Cancelling a call to /// `reserve` makes you lose your place in the queue. /// /// # Examples @@ -1187,7 +1187,7 @@ impl Sender { /// # Cancel safety /// /// This channel uses a queue to ensure that calls to `send` and `reserve` - /// complete in the order they were requested. Cancelling a call to + /// complete in the order they were requested. Cancelling a call to /// `reserve_owned` makes you lose your place in the queue. /// /// # Examples @@ -1406,7 +1406,7 @@ impl Sender { /// This moves the sender _by value_, and returns an owned permit that can /// be used to send a message into the channel. Unlike [`Sender::try_reserve`], /// this method may be used in cases where the permit must be valid for the - /// `'static` lifetime. `Sender`s may be cloned cheaply (`Sender::clone` is + /// `'static` lifetime. `Sender`s may be cloned cheaply (`Sender::clone` is /// essentially a reference count increment, comparable to [`Arc::clone`]), /// so when multiple [`OwnedPermit`]s are needed or the `Sender` cannot be /// moved, it can be cloned prior to calling `try_reserve_owned`. @@ -1473,7 +1473,7 @@ impl Sender { /// /// ``` /// let (tx, rx) = tokio::sync::mpsc::channel::<()>(1); - /// let tx2 = tx.clone(); + /// let tx2 = tx.clone(); /// assert!(tx.same_channel(&tx2)); /// /// let (tx3, rx3) = tokio::sync::mpsc::channel::<()>(1); diff --git a/tokio/src/sync/mpsc/mod.rs b/tokio/src/sync/mpsc/mod.rs index e6601e90a4a..fddcdd4cedc 100644 --- a/tokio/src/sync/mpsc/mod.rs +++ b/tokio/src/sync/mpsc/mod.rs @@ -59,7 +59,7 @@ //! **Unbounded channel**: You should use the kind of channel that matches where //! the receiver is. So for sending a message _from async to sync_, you should //! use [the standard library unbounded channel][std-unbounded] or -//! [crossbeam][crossbeam-unbounded]. Similarly, for sending a message _from sync +//! [crossbeam][crossbeam-unbounded]. Similarly, for sending a message _from sync //! to async_, you should use an unbounded Tokio `mpsc` channel. //! //! Please be aware that the above remarks were written with the `mpsc` channel diff --git a/tokio/src/sync/mpsc/unbounded.rs b/tokio/src/sync/mpsc/unbounded.rs index 47e1b6c7c77..27df586c56b 100644 --- a/tokio/src/sync/mpsc/unbounded.rs +++ b/tokio/src/sync/mpsc/unbounded.rs @@ -409,7 +409,7 @@ impl UnboundedReceiver { /// /// When the method returns `Poll::Pending`, the `Waker` in the provided /// `Context` is scheduled to receive a wakeup when a message is sent on any - /// receiver, or when the channel is closed. Note that on multiple calls to + /// receiver, or when the channel is closed. Note that on multiple calls to /// `poll_recv` or `poll_recv_many`, only the `Waker` from the `Context` /// passed to the most recent call is scheduled to receive a wakeup. /// @@ -433,7 +433,7 @@ impl UnboundedReceiver { /// /// When the method returns `Poll::Pending`, the `Waker` in the provided /// `Context` is scheduled to receive a wakeup when a message is sent on any - /// receiver, or when the channel is closed. Note that on multiple calls to + /// receiver, or when the channel is closed. Note that on multiple calls to /// `poll_recv` or `poll_recv_many`, only the `Waker` from the `Context` /// passed to the most recent call is scheduled to receive a wakeup. /// @@ -635,7 +635,7 @@ impl UnboundedSender { /// /// ``` /// let (tx, rx) = tokio::sync::mpsc::unbounded_channel::<()>(); - /// let tx2 = tx.clone(); + /// let tx2 = tx.clone(); /// assert!(tx.same_channel(&tx2)); /// /// let (tx3, rx3) = tokio::sync::mpsc::unbounded_channel::<()>(); diff --git a/tokio/src/sync/mutex.rs b/tokio/src/sync/mutex.rs index 30f0bdecedb..6fe6afa8970 100644 --- a/tokio/src/sync/mutex.rs +++ b/tokio/src/sync/mutex.rs @@ -405,7 +405,7 @@ impl Mutex { } /// Locks this mutex, causing the current task to yield until the lock has - /// been acquired. When the lock has been acquired, function returns a + /// been acquired. When the lock has been acquired, function returns a /// [`MutexGuard`]. /// /// If the mutex is available to be acquired immediately, then this call @@ -489,7 +489,7 @@ impl Mutex { /// /// #[tokio::main] /// async fn main() { - /// let mutex = Arc::new(Mutex::new(1)); + /// let mutex = Arc::new(Mutex::new(1)); /// let lock = mutex.lock().await; /// /// let mutex1 = Arc::clone(&mutex); @@ -546,7 +546,7 @@ impl Mutex { /// /// #[tokio::main] /// async fn main() { - /// let mutex = Arc::new(Mutex::new(1)); + /// let mutex = Arc::new(Mutex::new(1)); /// let lock = mutex.lock().await; /// /// let mutex1 = Arc::clone(&mutex); @@ -726,7 +726,7 @@ impl Mutex { /// is currently held somewhere else. /// /// This method is identical to [`Mutex::try_lock`], except that the - /// returned guard references the `Mutex` with an [`Arc`] rather than by + /// returned guard references the `Mutex` with an [`Arc`] rather than by /// borrowing it. Therefore, the `Mutex` must be wrapped in an `Arc` to call /// this method, and the guard will live for the `'static` lifetime, as it /// keeps the `Mutex` alive by holding an `Arc`. diff --git a/tokio/src/sync/notify.rs b/tokio/src/sync/notify.rs index 5d344f70411..55e10e3b925 100644 --- a/tokio/src/sync/notify.rs +++ b/tokio/src/sync/notify.rs @@ -36,7 +36,7 @@ type GuardedWaitList = GuardedLinkedList:: /// The synchronization details of `Notify` are similar to /// [`thread::park`][park] and [`Thread::unpark`][unpark] from std. A [`Notify`] /// value contains a single permit. [`notified().await`] waits for the permit to -/// be made available, consumes the permit, and resumes. [`notify_one()`] sets +/// be made available, consumes the permit, and resumes. [`notify_one()`] sets /// the permit, waking a pending task if there is one. /// /// If `notify_one()` is called **before** `notified().await`, then the next diff --git a/tokio/src/sync/once_cell.rs b/tokio/src/sync/once_cell.rs index 7c6e7e2a670..8d0b3f2364e 100644 --- a/tokio/src/sync/once_cell.rs +++ b/tokio/src/sync/once_cell.rs @@ -439,7 +439,7 @@ impl OnceCell { } } - /// Takes ownership of the current value, leaving the cell empty. Returns + /// Takes ownership of the current value, leaving the cell empty. Returns /// `None` if the cell is empty. pub fn take(&mut self) -> Option { std::mem::take(self).into_inner() diff --git a/tokio/src/sync/oneshot.rs b/tokio/src/sync/oneshot.rs index ab29b3e3edd..1eb9635f67d 100644 --- a/tokio/src/sync/oneshot.rs +++ b/tokio/src/sync/oneshot.rs @@ -139,7 +139,7 @@ use std::task::{Context, Poll, Waker}; /// Sends a value to the associated [`Receiver`]. /// -/// A pair of both a [`Sender`] and a [`Receiver`] are created by the +/// A pair of both a [`Sender`] and a [`Receiver`] are created by the /// [`channel`](fn@channel) function. /// /// # Examples @@ -227,7 +227,7 @@ pub struct Sender { /// Receives a value from the associated [`Sender`]. /// -/// A pair of both a [`Sender`] and a [`Receiver`] are created by the +/// A pair of both a [`Sender`] and a [`Receiver`] are created by the /// [`channel`](fn@channel) function. /// /// This channel has no `recv` method because the receiver itself implements the @@ -557,7 +557,7 @@ impl Sender { /// /// This method consumes `self` as only one value may ever be sent on a `oneshot` /// channel. It is not marked async because sending a message to an `oneshot` - /// channel never requires any form of waiting. Because of this, the `send` + /// channel never requires any form of waiting. Because of this, the `send` /// method can be used in both synchronous and asynchronous code without /// problems. /// diff --git a/tokio/src/sync/rwlock.rs b/tokio/src/sync/rwlock.rs index 4f111cd6298..7ca57dbfe40 100644 --- a/tokio/src/sync/rwlock.rs +++ b/tokio/src/sync/rwlock.rs @@ -836,7 +836,7 @@ impl RwLock { /// /// #[tokio::main] /// async fn main() { - /// let rwlock = Arc::new(RwLock::new(1)); + /// let rwlock = Arc::new(RwLock::new(1)); /// let read_lock = rwlock.read().await; /// /// let blocking_task = tokio::task::spawn_blocking({ diff --git a/tokio/src/sync/watch.rs b/tokio/src/sync/watch.rs index 366066797f1..3b4c27120a7 100644 --- a/tokio/src/sync/watch.rs +++ b/tokio/src/sync/watch.rs @@ -46,7 +46,7 @@ //! //! If the receiver intends to await notifications from [`changed`] in a loop, //! [`Receiver::borrow_and_update()`] should be preferred over -//! [`Receiver::borrow()`]. This avoids a potential race where a new value is +//! [`Receiver::borrow()`]. This avoids a potential race where a new value is //! sent between [`changed`] being ready and the value being read. (If //! [`Receiver::borrow()`] is used, the loop may run twice with the same value.) //! diff --git a/tokio/src/task/blocking.rs b/tokio/src/task/blocking.rs index 193c28dfd0f..80ab8f30496 100644 --- a/tokio/src/task/blocking.rs +++ b/tokio/src/task/blocking.rs @@ -93,7 +93,7 @@ cfg_rt! { /// After reaching the upper limit, the tasks are put in a queue. /// The thread limit is very large by default, because `spawn_blocking` is often /// used for various kinds of IO operations that cannot be performed - /// asynchronously. When you run CPU-bound code using `spawn_blocking`, you + /// asynchronously. When you run CPU-bound code using `spawn_blocking`, you /// should keep this large upper limit in mind. When running many CPU-bound /// computations, a semaphore or some other synchronization primitive should be /// used to limit the number of computation executed in parallel. Specialized @@ -112,7 +112,7 @@ cfg_rt! { /// When you shut down the executor, it will wait indefinitely for all blocking operations to /// finish. You can use [`shutdown_timeout`] to stop waiting for them after a /// certain timeout. Be aware that this will still not cancel the tasks — they - /// are simply allowed to keep running after the method returns. It is possible + /// are simply allowed to keep running after the method returns. It is possible /// for a blocking task to be cancelled if it has not yet started running, but this /// is not guaranteed. /// @@ -131,7 +131,7 @@ cfg_rt! { /// by `spawn_blocking`. /// /// Another option is [`SyncIoBridge`] for cases where the synchronous context - /// is operating on byte streams. For example, you might use an asynchronous + /// is operating on byte streams. For example, you might use an asynchronous /// HTTP client such as [hyper] to fetch data, but perform complex parsing /// of the payload body using a library written for synchronous I/O. /// diff --git a/tokio/src/task/local.rs b/tokio/src/task/local.rs index efc8c5a6f39..c21e2fcb96a 100644 --- a/tokio/src/task/local.rs +++ b/tokio/src/task/local.rs @@ -552,7 +552,7 @@ impl LocalSet { /// use tokio::runtime::Runtime; /// use tokio::task; /// - /// let rt = Runtime::new().unwrap(); + /// let rt = Runtime::new().unwrap(); /// let local = task::LocalSet::new(); /// local.block_on(&rt, async { /// let join = task::spawn_local(async { @@ -569,7 +569,7 @@ impl LocalSet { /// use tokio::runtime::Runtime; /// use tokio::task; /// - /// let rt = Runtime::new().unwrap(); + /// let rt = Runtime::new().unwrap(); /// let local = task::LocalSet::new(); /// local.block_on(&rt, async { /// let join = task::spawn_local(async { diff --git a/tokio/src/time/clock.rs b/tokio/src/time/clock.rs index 9b0915a0d1f..cb7cf8bf444 100644 --- a/tokio/src/time/clock.rs +++ b/tokio/src/time/clock.rs @@ -169,7 +169,7 @@ cfg_test_util! { /// This function will make the current time jump forward by the given /// duration in one jump. This means that all `sleep` calls with a deadline /// before the new time will immediately complete "at the same time", and - /// the runtime is free to poll them in any order. Additionally, this + /// the runtime is free to poll them in any order. Additionally, this /// method will not wait for the `sleep` calls it advanced past to complete. /// If you want to do that, you should instead call [`sleep`] and rely on /// the runtime's auto-advance feature. diff --git a/tokio/src/util/metric_atomics.rs b/tokio/src/util/metric_atomics.rs index 1bc59e70f14..9c1ec1c3e0f 100644 --- a/tokio/src/util/metric_atomics.rs +++ b/tokio/src/util/metric_atomics.rs @@ -41,7 +41,7 @@ impl MetricAtomicU64 { cfg_no_64bit_metrics! { pub(crate) fn store(&self, _val: u64, _ordering: Ordering) { } // on platforms without 64-bit atomics, fetch-add returns unit - pub(crate) fn add(&self, _value: u64, _ordering: Ordering) { } + pub(crate) fn add(&self, _value: u64, _ordering: Ordering) { } pub(crate) fn new(_value: u64) -> Self { Self { } } } } diff --git a/tokio/tests/io_poll_aio.rs b/tokio/tests/io_poll_aio.rs index 242887eb60f..f60ed4ded76 100644 --- a/tokio/tests/io_poll_aio.rs +++ b/tokio/tests/io_poll_aio.rs @@ -51,7 +51,7 @@ mod aio { Poll::Pending => Poll::Pending, Poll::Ready(Err(e)) => Poll::Ready(Err(e)), Poll::Ready(Ok(_ev)) => { - // At this point, we could clear readiness. But there's no + // At this point, we could clear readiness. But there's no // point, since we're about to drop the Aio. let p = unsafe { self.map_unchecked_mut(|s| &mut s.0 .0) }; let result = p.aio_return(); @@ -118,7 +118,7 @@ mod aio { Poll::Ready(Ok(ev)) => { // Clearing readiness makes the future non-idempotent; the // caller can't poll it repeatedly after it has already - // returned Ready. But that's ok; most futures behave this + // returned Ready. But that's ok; most futures behave this // way. self.0.clear_ready(ev); let r = unsafe { libc::aio_return(self.0 .0.as_mut().get_unchecked_mut()) }; @@ -197,7 +197,7 @@ mod lio { /// Low-level source based on lio_listio /// - /// An example demonstrating using AIO with `Interest::Lio`. mio_aio 0.8 + /// An example demonstrating using AIO with `Interest::Lio`. mio_aio 0.8 /// doesn't include any bindings for lio_listio, so we've got to go /// low-level. struct LioSource<'a> { @@ -259,8 +259,8 @@ mod lio { Poll::Ready(Ok(ev)) => { // Clearing readiness makes the future non-idempotent; the // caller can't poll it repeatedly after it has already - // returned Ready. But that's ok; most futures behave this - // way. Clearing readiness is especially useful for + // returned Ready. But that's ok; most futures behave this + // way. Clearing readiness is especially useful for // lio_listio, because sometimes some operations will be // ready but not all. self.0.clear_ready(ev);