From 08ed41f339e345286f26bdbc6c67bf9f2975ed07 Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Thu, 1 Jul 2021 02:06:56 +0900 Subject: [PATCH] chore: fix typos (#3907) --- benches/rt_multi_threaded.rs | 2 +- tokio-stream/src/stream_ext.rs | 2 +- tokio-stream/src/wrappers/watch.rs | 2 +- tokio-test/src/lib.rs | 2 +- tokio-test/src/task.rs | 2 +- tokio-util/src/codec/any_delimiter_codec.rs | 2 +- tokio-util/src/codec/decoder.rs | 2 +- tokio-util/src/codec/framed_impl.rs | 6 +++--- tokio-util/src/codec/length_delimited.rs | 2 +- tokio-util/src/codec/lines_codec.rs | 4 ++-- tokio-util/src/either.rs | 2 +- tokio-util/src/sync/cancellation_token.rs | 4 ++-- .../src/sync/intrusive_double_linked_list.rs | 2 +- tokio/docs/reactor-refactor.md | 6 +++--- tokio/src/io/driver/interest.rs | 2 +- tokio/src/io/driver/mod.rs | 2 +- tokio/src/io/driver/scheduled_io.rs | 6 +++--- tokio/src/io/read_buf.rs | 6 +++--- tokio/src/io/stdio_common.rs | 4 ++-- tokio/src/io/util/read_until.rs | 14 +++++++------- tokio/src/io/util/split.rs | 2 +- tokio/src/macros/select.rs | 4 ++-- tokio/src/net/tcp/split.rs | 6 +++--- tokio/src/net/tcp/split_owned.rs | 4 ++-- tokio/src/net/udp.rs | 8 ++++---- tokio/src/net/unix/datagram/socket.rs | 4 ++-- tokio/src/net/unix/split.rs | 2 +- tokio/src/net/unix/ucred.rs | 2 +- tokio/src/runtime/builder.rs | 2 +- tokio/src/runtime/enter.rs | 2 +- tokio/src/runtime/queue.rs | 2 +- tokio/src/runtime/task/core.rs | 6 +++--- tokio/src/runtime/task/harness.rs | 2 +- tokio/src/runtime/thread_pool/idle.rs | 4 ++-- tokio/src/signal/unix/driver.rs | 2 +- tokio/src/sync/once_cell.rs | 6 +++--- tokio/tests/io_copy_bidirectional.rs | 2 +- tokio/tests/sync_rwlock.rs | 4 ++-- tokio/tests/task_abort.rs | 2 +- tokio/tests/task_local_set.rs | 2 +- tokio/tests/time_sleep.rs | 2 +- 41 files changed, 72 insertions(+), 72 deletions(-) diff --git a/benches/rt_multi_threaded.rs b/benches/rt_multi_threaded.rs index 68a6d6a4fa1..af048d9e8cb 100644 --- a/benches/rt_multi_threaded.rs +++ b/benches/rt_multi_threaded.rs @@ -1,4 +1,4 @@ -//! Benchmark implementation details of the theaded scheduler. These benches are +//! Benchmark implementation details of the threaded scheduler. These benches are //! intended to be used as a form of regression testing and not as a general //! purpose benchmark demonstrating real-world performance. diff --git a/tokio-stream/src/stream_ext.rs b/tokio-stream/src/stream_ext.rs index 51532ee1cb6..1157c9ee353 100644 --- a/tokio-stream/src/stream_ext.rs +++ b/tokio-stream/src/stream_ext.rs @@ -515,7 +515,7 @@ pub trait StreamExt: Stream { /// Skip elements from the underlying stream while the provided predicate /// resolves to `true`. /// - /// This function, like [`Iterator::skip_while`], will ignore elemets from the + /// This function, like [`Iterator::skip_while`], will ignore elements from the /// stream until the predicate `f` resolves to `false`. Once one element /// returns false, the rest of the elements will be yielded. /// diff --git a/tokio-stream/src/wrappers/watch.rs b/tokio-stream/src/wrappers/watch.rs index 0ffd1b8193b..64688aa3e62 100644 --- a/tokio-stream/src/wrappers/watch.rs +++ b/tokio-stream/src/wrappers/watch.rs @@ -11,7 +11,7 @@ use tokio::sync::watch::error::RecvError; /// A wrapper around [`tokio::sync::watch::Receiver`] that implements [`Stream`]. /// /// This stream will always start by yielding the current value when the WatchStream is polled, -/// regardles of whether it was the initial value or sent afterwards. +/// regardless of whether it was the initial value or sent afterwards. /// /// # Examples /// diff --git a/tokio-test/src/lib.rs b/tokio-test/src/lib.rs index c5104540f69..4e6b86904c7 100644 --- a/tokio-test/src/lib.rs +++ b/tokio-test/src/lib.rs @@ -10,7 +10,7 @@ attr(deny(warnings, rust_2018_idioms), allow(dead_code, unused_variables)) ))] -//! Tokio and Futures based testing utilites +//! Tokio and Futures based testing utilities pub mod io; diff --git a/tokio-test/src/task.rs b/tokio-test/src/task.rs index fa98bae0b01..f84b4f4c0f8 100644 --- a/tokio-test/src/task.rs +++ b/tokio-test/src/task.rs @@ -180,7 +180,7 @@ impl ThreadWaker { } } - /// Clears any previously received wakes, avoiding potential spurrious + /// Clears any previously received wakes, avoiding potential spurious /// wake notifications. This should only be called immediately before running the /// task. fn clear(&self) { diff --git a/tokio-util/src/codec/any_delimiter_codec.rs b/tokio-util/src/codec/any_delimiter_codec.rs index a09d389f4f7..3dbfd456b0a 100644 --- a/tokio-util/src/codec/any_delimiter_codec.rs +++ b/tokio-util/src/codec/any_delimiter_codec.rs @@ -234,7 +234,7 @@ impl Default for AnyDelimiterCodec { } } -/// An error occured while encoding or decoding a chunk. +/// An error occurred while encoding or decoding a chunk. #[derive(Debug)] pub enum AnyDelimiterCodecError { /// The maximum chunk length was exceeded. diff --git a/tokio-util/src/codec/decoder.rs b/tokio-util/src/codec/decoder.rs index 4b9da0865d3..c5927783d15 100644 --- a/tokio-util/src/codec/decoder.rs +++ b/tokio-util/src/codec/decoder.rs @@ -28,7 +28,7 @@ use std::io; /// It is up to the Decoder to keep track of a restart after an EOF, /// and to decide how to handle such an event by, for example, /// allowing frames to cross EOF boundaries, re-emitting opening frames, or -/// reseting the entire internal state. +/// resetting the entire internal state. /// /// [`Framed`]: crate::codec::Framed /// [`FramedRead`]: crate::codec::FramedRead diff --git a/tokio-util/src/codec/framed_impl.rs b/tokio-util/src/codec/framed_impl.rs index 89f4a06ba7d..f27de028deb 100644 --- a/tokio-util/src/codec/framed_impl.rs +++ b/tokio-util/src/codec/framed_impl.rs @@ -124,7 +124,7 @@ where // to a combination of the `is_readable` and `eof` flags. States persist across // loop entries and most state transitions occur with a return. // - // The intitial state is `reading`. + // The initial state is `reading`. // // | state | eof | is_readable | // |---------|-------|-------------| @@ -155,10 +155,10 @@ where // Both signal that there is no such data by returning `None`. // // If `decode` couldn't read a frame and the upstream source has returned eof, - // `decode_eof` will attemp to decode the remaining bytes as closing frames. + // `decode_eof` will attempt to decode the remaining bytes as closing frames. // // If the underlying AsyncRead is resumable, we may continue after an EOF, - // but must finish emmiting all of it's associated `decode_eof` frames. + // but must finish emitting all of it's associated `decode_eof` frames. // Furthermore, we don't want to emit any `decode_eof` frames on retried // reads after an EOF unless we've actually read more data. if state.is_readable { diff --git a/tokio-util/src/codec/length_delimited.rs b/tokio-util/src/codec/length_delimited.rs index c316c145cc6..94a547d1219 100644 --- a/tokio-util/src/codec/length_delimited.rs +++ b/tokio-util/src/codec/length_delimited.rs @@ -486,7 +486,7 @@ impl LengthDelimitedCodec { // Skip the required bytes src.advance(self.builder.length_field_offset); - // match endianess + // match endianness let n = if self.builder.length_field_is_big_endian { src.get_uint(field_len) } else { diff --git a/tokio-util/src/codec/lines_codec.rs b/tokio-util/src/codec/lines_codec.rs index 4c5c2e6db72..7a0a8f04541 100644 --- a/tokio-util/src/codec/lines_codec.rs +++ b/tokio-util/src/codec/lines_codec.rs @@ -203,12 +203,12 @@ impl Default for LinesCodec { } } -/// An error occured while encoding or decoding a line. +/// An error occurred while encoding or decoding a line. #[derive(Debug)] pub enum LinesCodecError { /// The maximum line length was exceeded. MaxLineLengthExceeded, - /// An IO error occured. + /// An IO error occurred. Io(io::Error), } diff --git a/tokio-util/src/either.rs b/tokio-util/src/either.rs index 7f193de7a9b..9225e53ca68 100644 --- a/tokio-util/src/either.rs +++ b/tokio-util/src/either.rs @@ -67,7 +67,7 @@ pub enum Either { } /// A small helper macro which reduces amount of boilerplate in the actual trait method implementation. -/// It takes an invokation of method as an argument (e.g. `self.poll(cx)`), and redirects it to either +/// It takes an invocation of method as an argument (e.g. `self.poll(cx)`), and redirects it to either /// enum variant held in `self`. macro_rules! delegate_call { ($self:ident.$method:ident($($args:ident),+)) => { diff --git a/tokio-util/src/sync/cancellation_token.rs b/tokio-util/src/sync/cancellation_token.rs index 2488cbf0229..f193f6bc32f 100644 --- a/tokio-util/src/sync/cancellation_token.rs +++ b/tokio-util/src/sync/cancellation_token.rs @@ -775,8 +775,8 @@ impl CancellationTokenState { return Poll::Ready(()); } - // So far the token is not cancelled. However it could be cancelld before - // we get the chance to store the `Waker`. Therfore we need to check + // So far the token is not cancelled. However it could be cancelled before + // we get the chance to store the `Waker`. Therefore we need to check // for cancellation again inside the mutex. let mut guard = self.synchronized.lock().unwrap(); if guard.is_cancelled { diff --git a/tokio-util/src/sync/intrusive_double_linked_list.rs b/tokio-util/src/sync/intrusive_double_linked_list.rs index 083fa31d3ec..0a5ecff9a37 100644 --- a/tokio-util/src/sync/intrusive_double_linked_list.rs +++ b/tokio-util/src/sync/intrusive_double_linked_list.rs @@ -222,7 +222,7 @@ impl LinkedList { } } - /// Returns whether the linked list doesn not contain any node + /// Returns whether the linked list does not contain any node pub fn is_empty(&self) -> bool { if self.head.is_some() { return false; diff --git a/tokio/docs/reactor-refactor.md b/tokio/docs/reactor-refactor.md index a0b54474b71..1c9ace15a8f 100644 --- a/tokio/docs/reactor-refactor.md +++ b/tokio/docs/reactor-refactor.md @@ -228,7 +228,7 @@ It is only possible to implement `AsyncRead` and `AsyncWrite` for resource types themselves and not for `&Resource`. Implementing the traits for `&Resource` would permit concurrent operations to the resource. Because only a single waker is stored per direction, any concurrent usage would result in deadlocks. An -alterate implementation would call for a `Vec` but this would result in +alternate implementation would call for a `Vec` but this would result in memory leaks. ## Enabling reads and writes for `&TcpStream` @@ -268,9 +268,9 @@ select! { } ``` -It is also possible to sotre a `TcpStream` in an `Arc`. +It is also possible to store a `TcpStream` in an `Arc`. ```rust let arc_stream = Arc::new(my_tcp_stream); let n = arc_stream.by_ref().read(buf).await?; -``` \ No newline at end of file +``` diff --git a/tokio/src/io/driver/interest.rs b/tokio/src/io/driver/interest.rs index 9eead082f39..36951cf5a43 100644 --- a/tokio/src/io/driver/interest.rs +++ b/tokio/src/io/driver/interest.rs @@ -58,7 +58,7 @@ impl Interest { self.0.is_writable() } - /// Add together two `Interst` values. + /// Add together two `Interest` values. /// /// This function works from a `const` context. /// diff --git a/tokio/src/io/driver/mod.rs b/tokio/src/io/driver/mod.rs index 52451c6b1c5..3aa0cfbb21c 100644 --- a/tokio/src/io/driver/mod.rs +++ b/tokio/src/io/driver/mod.rs @@ -96,7 +96,7 @@ const ADDRESS: bit::Pack = bit::Pack::least_significant(24); // // The generation prevents a race condition where a slab slot is reused for a // new socket while the I/O driver is about to apply a readiness event. The -// generaton value is checked when setting new readiness. If the generation do +// generation value is checked when setting new readiness. If the generation do // not match, then the readiness event is discarded. const GENERATION: bit::Pack = ADDRESS.then(7); diff --git a/tokio/src/io/driver/scheduled_io.rs b/tokio/src/io/driver/scheduled_io.rs index 2626b40a7df..51780107909 100644 --- a/tokio/src/io/driver/scheduled_io.rs +++ b/tokio/src/io/driver/scheduled_io.rs @@ -84,9 +84,9 @@ cfg_io_readiness! { // The `ScheduledIo::readiness` (`AtomicUsize`) is packed full of goodness. // -// | reserved | generation | driver tick | readinesss | -// |----------+------------+--------------+------------| -// | 1 bit | 7 bits + 8 bits + 16 bits | +// | reserved | generation | driver tick | readiness | +// |----------+------------+--------------+-----------| +// | 1 bit | 7 bits + 8 bits + 16 bits | const READINESS: bit::Pack = bit::Pack::least_significant(16); diff --git a/tokio/src/io/read_buf.rs b/tokio/src/io/read_buf.rs index 38e857d0af5..ad58cbe757b 100644 --- a/tokio/src/io/read_buf.rs +++ b/tokio/src/io/read_buf.rs @@ -45,7 +45,7 @@ impl<'a> ReadBuf<'a> { /// Creates a new `ReadBuf` from a fully uninitialized buffer. /// - /// Use `assume_init` if part of the buffer is known to be already inintialized. + /// Use `assume_init` if part of the buffer is known to be already initialized. #[inline] pub fn uninit(buf: &'a mut [MaybeUninit]) -> ReadBuf<'a> { ReadBuf { @@ -85,7 +85,7 @@ impl<'a> ReadBuf<'a> { #[inline] pub fn take(&mut self, n: usize) -> ReadBuf<'_> { let max = std::cmp::min(self.remaining(), n); - // Saftey: We don't set any of the `unfilled_mut` with `MaybeUninit::uninit`. + // Safety: We don't set any of the `unfilled_mut` with `MaybeUninit::uninit`. unsafe { ReadBuf::uninit(&mut self.unfilled_mut()[..max]) } } @@ -217,7 +217,7 @@ impl<'a> ReadBuf<'a> { /// /// # Panics /// - /// Panics if the filled region of the buffer would become larger than the intialized region. + /// Panics if the filled region of the buffer would become larger than the initialized region. #[inline] pub fn set_filled(&mut self, n: usize) { assert!( diff --git a/tokio/src/io/stdio_common.rs b/tokio/src/io/stdio_common.rs index d21c842f543..56c4520c6a4 100644 --- a/tokio/src/io/stdio_common.rs +++ b/tokio/src/io/stdio_common.rs @@ -52,10 +52,10 @@ where buf = &buf[..crate::io::blocking::MAX_BUF]; - // Now there are two possibilites. + // 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** additionaly + // 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/read_until.rs b/tokio/src/io/util/read_until.rs index 3599cff3f6b..90a0e8a18d5 100644 --- a/tokio/src/io/util/read_until.rs +++ b/tokio/src/io/util/read_until.rs @@ -10,12 +10,12 @@ use std::task::{Context, Poll}; pin_project! { /// Future for the [`read_until`](crate::io::AsyncBufReadExt::read_until) method. - /// The delimeter is included in the resulting vector. + /// The delimiter is included in the resulting vector. #[derive(Debug)] #[must_use = "futures do nothing unless you `.await` or poll them"] pub struct ReadUntil<'a, R: ?Sized> { reader: &'a mut R, - delimeter: u8, + delimiter: u8, buf: &'a mut Vec, // The number of bytes appended to buf. This can be less than buf.len() if // the buffer was not empty when the operation was started. @@ -28,7 +28,7 @@ pin_project! { pub(crate) fn read_until<'a, R>( reader: &'a mut R, - delimeter: u8, + delimiter: u8, buf: &'a mut Vec, ) -> ReadUntil<'a, R> where @@ -36,7 +36,7 @@ where { ReadUntil { reader, - delimeter, + delimiter, buf, read: 0, _pin: PhantomPinned, @@ -46,14 +46,14 @@ where pub(super) fn read_until_internal( mut reader: Pin<&mut R>, cx: &mut Context<'_>, - delimeter: u8, + delimiter: u8, buf: &mut Vec, read: &mut usize, ) -> Poll> { loop { let (done, used) = { let available = ready!(reader.as_mut().poll_fill_buf(cx))?; - if let Some(i) = memchr::memchr(delimeter, available) { + if let Some(i) = memchr::memchr(delimiter, available) { buf.extend_from_slice(&available[..=i]); (true, i + 1) } else { @@ -74,6 +74,6 @@ impl Future for ReadUntil<'_, R> { fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { let me = self.project(); - read_until_internal(Pin::new(*me.reader), cx, *me.delimeter, me.buf, me.read) + read_until_internal(Pin::new(*me.reader), cx, *me.delimiter, me.buf, me.read) } } diff --git a/tokio/src/io/util/split.rs b/tokio/src/io/util/split.rs index 9c2bb058925..7489c242811 100644 --- a/tokio/src/io/util/split.rs +++ b/tokio/src/io/util/split.rs @@ -95,7 +95,7 @@ where let n = ready!(read_until_internal( me.reader, cx, *me.delim, me.buf, me.read, ))?; - // read_until_internal resets me.read to zero once it finds the delimeter + // read_until_internal resets me.read to zero once it finds the delimiter debug_assert_eq!(*me.read, 0); if n == 0 && me.buf.is_empty() { diff --git a/tokio/src/macros/select.rs b/tokio/src/macros/select.rs index 9575a696381..a90ee9eb577 100644 --- a/tokio/src/macros/select.rs +++ b/tokio/src/macros/select.rs @@ -289,7 +289,7 @@ /// loop { /// tokio::select! { /// // If you run this example without `biased;`, the polling order is -/// // psuedo-random, and the assertions on the value of count will +/// // pseudo-random, and the assertions on the value of count will /// // (probably) fail. /// biased; /// @@ -467,7 +467,7 @@ macro_rules! select { let mut is_pending = false; // Choose a starting index to begin polling the futures at. In - // practice, this will either be a psuedo-randomly generrated + // practice, this will either be a pseudo-randomly generated // number by default, or the constant 0 if `biased;` is // supplied. let start = $start; diff --git a/tokio/src/net/tcp/split.rs b/tokio/src/net/tcp/split.rs index 78bd6880bff..8ae70ce13bc 100644 --- a/tokio/src/net/tcp/split.rs +++ b/tokio/src/net/tcp/split.rs @@ -30,7 +30,7 @@ pub struct ReadHalf<'a>(&'a TcpStream); /// Borrowed write half of a [`TcpStream`], created by [`split`]. /// -/// Note that in the [`AsyncWrite`] implemenation of this type, [`poll_shutdown`] will +/// Note that in the [`AsyncWrite`] implementation of this type, [`poll_shutdown`] will /// shut down the TCP stream in the write direction. /// /// Writing to an `WriteHalf` is usually done using the convenience methods found @@ -57,7 +57,7 @@ impl ReadHalf<'_> { /// `Waker` from the `Context` passed to the most recent call is scheduled /// to receive a wakeup. /// - /// See the [`TcpStream::poll_peek`] level documenation for more details. + /// See the [`TcpStream::poll_peek`] level documentation for more details. /// /// # Examples /// @@ -95,7 +95,7 @@ impl ReadHalf<'_> { /// connected, without removing that data from the queue. On success, /// returns the number of bytes peeked. /// - /// See the [`TcpStream::peek`] level documenation for more details. + /// See the [`TcpStream::peek`] level documentation for more details. /// /// [`TcpStream::peek`]: TcpStream::peek /// diff --git a/tokio/src/net/tcp/split_owned.rs b/tokio/src/net/tcp/split_owned.rs index d52c2f6b5d5..1bcb4f2eafe 100644 --- a/tokio/src/net/tcp/split_owned.rs +++ b/tokio/src/net/tcp/split_owned.rs @@ -112,7 +112,7 @@ impl OwnedReadHalf { /// `Waker` from the `Context` passed to the most recent call is scheduled /// to receive a wakeup. /// - /// See the [`TcpStream::poll_peek`] level documenation for more details. + /// See the [`TcpStream::poll_peek`] level documentation for more details. /// /// # Examples /// @@ -150,7 +150,7 @@ impl OwnedReadHalf { /// connected, without removing that data from the queue. On success, /// returns the number of bytes peeked. /// - /// See the [`TcpStream::peek`] level documenation for more details. + /// See the [`TcpStream::peek`] level documentation for more details. /// /// [`TcpStream::peek`]: TcpStream::peek /// diff --git a/tokio/src/net/udp.rs b/tokio/src/net/udp.rs index 0f8158040e1..301a85cc06b 100644 --- a/tokio/src/net/udp.rs +++ b/tokio/src/net/udp.rs @@ -699,7 +699,7 @@ impl UdpSocket { /// [`connect`]: method@Self::connect pub fn poll_recv(&self, cx: &mut Context<'_>, buf: &mut ReadBuf<'_>) -> Poll> { let n = ready!(self.io.registration().poll_read_io(cx, || { - // Safety: will not read the maybe uinitialized bytes. + // Safety: will not read the maybe uninitialized bytes. let b = unsafe { &mut *(buf.unfilled_mut() as *mut [std::mem::MaybeUninit] as *mut [u8]) }; @@ -985,7 +985,7 @@ impl UdpSocket { /// /// # Returns /// - /// If successfull, returns the number of bytes sent + /// If successful, returns the number of bytes sent /// /// Users should ensure that when the remote cannot receive, the /// [`ErrorKind::WouldBlock`] is properly handled. An error can also occur @@ -1100,7 +1100,7 @@ impl UdpSocket { buf: &mut ReadBuf<'_>, ) -> Poll> { let (n, addr) = ready!(self.io.registration().poll_read_io(cx, || { - // Safety: will not read the maybe uinitialized bytes. + // Safety: will not read the maybe uninitialized bytes. let b = unsafe { &mut *(buf.unfilled_mut() as *mut [std::mem::MaybeUninit] as *mut [u8]) }; @@ -1239,7 +1239,7 @@ impl UdpSocket { buf: &mut ReadBuf<'_>, ) -> Poll> { let (n, addr) = ready!(self.io.registration().poll_read_io(cx, || { - // Safety: will not read the maybe uinitialized bytes. + // Safety: will not read the maybe uninitialized bytes. let b = unsafe { &mut *(buf.unfilled_mut() as *mut [std::mem::MaybeUninit] as *mut [u8]) }; diff --git a/tokio/src/net/unix/datagram/socket.rs b/tokio/src/net/unix/datagram/socket.rs index bc1f9237fa6..2d2177803b1 100644 --- a/tokio/src/net/unix/datagram/socket.rs +++ b/tokio/src/net/unix/datagram/socket.rs @@ -974,7 +974,7 @@ impl UnixDatagram { buf: &mut ReadBuf<'_>, ) -> Poll> { let (n, addr) = ready!(self.io.registration().poll_read_io(cx, || { - // Safety: will not read the maybe uinitialized bytes. + // Safety: will not read the maybe uninitialized bytes. let b = unsafe { &mut *(buf.unfilled_mut() as *mut [std::mem::MaybeUninit] as *mut [u8]) }; @@ -1075,7 +1075,7 @@ impl UnixDatagram { /// [`connect`]: method@Self::connect pub fn poll_recv(&self, cx: &mut Context<'_>, buf: &mut ReadBuf<'_>) -> Poll> { let n = ready!(self.io.registration().poll_read_io(cx, || { - // Safety: will not read the maybe uinitialized bytes. + // Safety: will not read the maybe uninitialized bytes. let b = unsafe { &mut *(buf.unfilled_mut() as *mut [std::mem::MaybeUninit] as *mut [u8]) }; diff --git a/tokio/src/net/unix/split.rs b/tokio/src/net/unix/split.rs index 24a711bbda5..97214f7a7cf 100644 --- a/tokio/src/net/unix/split.rs +++ b/tokio/src/net/unix/split.rs @@ -29,7 +29,7 @@ pub struct ReadHalf<'a>(&'a UnixStream); /// Borrowed write half of a [`UnixStream`], created by [`split`]. /// -/// Note that in the [`AsyncWrite`] implemenation of this type, [`poll_shutdown`] will +/// Note that in the [`AsyncWrite`] implementation of this type, [`poll_shutdown`] will /// shut down the UnixStream stream in the write direction. /// /// Writing to an `WriteHalf` is usually done using the convenience methods found diff --git a/tokio/src/net/unix/ucred.rs b/tokio/src/net/unix/ucred.rs index b95a8f66a58..6310183d7ad 100644 --- a/tokio/src/net/unix/ucred.rs +++ b/tokio/src/net/unix/ucred.rs @@ -25,7 +25,7 @@ impl UCred { /// Gets PID (process ID) of the process. /// /// This is only implemented under Linux, Android, iOS, macOS, Solaris and - /// Illumos. On other plaforms this will always return `None`. + /// Illumos. On other platforms this will always return `None`. pub fn pid(&self) -> Option { self.pid } diff --git a/tokio/src/runtime/builder.rs b/tokio/src/runtime/builder.rs index 0249266ee2c..51bf8c843fa 100644 --- a/tokio/src/runtime/builder.rs +++ b/tokio/src/runtime/builder.rs @@ -413,7 +413,7 @@ impl Builder { /// Sets a custom timeout for a thread in the blocking pool. /// /// By default, the timeout for a thread is set to 10 seconds. This can - /// be overriden using .thread_keep_alive(). + /// be overridden using .thread_keep_alive(). /// /// # Example /// diff --git a/tokio/src/runtime/enter.rs b/tokio/src/runtime/enter.rs index 4dd8dd01f59..e91408f382f 100644 --- a/tokio/src/runtime/enter.rs +++ b/tokio/src/runtime/enter.rs @@ -64,7 +64,7 @@ cfg_rt! { // # Warning // // This is hidden for a reason. Do not use without fully understanding -// executors. Misuing can easily cause your program to deadlock. +// executors. Misusing can easily cause your program to deadlock. cfg_rt_multi_thread! { pub(crate) fn exit R, R>(f: F) -> R { // Reset in case the closure panics diff --git a/tokio/src/runtime/queue.rs b/tokio/src/runtime/queue.rs index 3df7bba2944..818ef7bac17 100644 --- a/tokio/src/runtime/queue.rs +++ b/tokio/src/runtime/queue.rs @@ -127,7 +127,7 @@ impl Local { // Concurrently stealing, this will free up capacity, so only // push the new task onto the inject queue // - // If the task failes to be pushed on the injection queue, there + // If the task fails to be pushed on the injection queue, there // is nothing to be done at this point as the task cannot be a // newly spawned task. Shutting down this task is handled by the // worker shutdown process. diff --git a/tokio/src/runtime/task/core.rs b/tokio/src/runtime/task/core.rs index 026a6dcb2f1..428c921fe0d 100644 --- a/tokio/src/runtime/task/core.rs +++ b/tokio/src/runtime/task/core.rs @@ -131,7 +131,7 @@ impl Scheduler { /// Bind a scheduler to the task. /// - /// This only happens on the first poll and must be preceeded by a call to + /// This only happens on the first poll and must be preceded by a call to /// `is_bound` to determine if binding is appropriate or not. /// /// # Safety @@ -220,7 +220,7 @@ impl CoreStage { /// # Safety /// /// The caller must ensure it is safe to mutate the `state` field. This - /// requires ensuring mutal exclusion between any concurrent thread that + /// requires ensuring mutual exclusion between any concurrent thread that /// might modify the future or output field. /// /// The mutual exclusion is implemented by `Harness` and the `Lifecycle` @@ -284,7 +284,7 @@ impl CoreStage { use std::mem; self.stage.with_mut(|ptr| { - // Safety:: the caller ensures mutal exclusion to the field. + // Safety:: the caller ensures mutual exclusion to the field. match mem::replace(unsafe { &mut *ptr }, Stage::Consumed) { Stage::Finished(output) => output, _ => panic!("JoinHandle polled after completion"), diff --git a/tokio/src/runtime/task/harness.rs b/tokio/src/runtime/task/harness.rs index 47bbcc15ffc..a3a14083fd6 100644 --- a/tokio/src/runtime/task/harness.rs +++ b/tokio/src/runtime/task/harness.rs @@ -163,7 +163,7 @@ where return; } - // By transitioning the lifcycle to `Running`, we have permission to + // By transitioning the lifecycle to `Running`, we have permission to // drop the future. let err = cancel_task(&self.core().stage); self.complete(Err(err), true) diff --git a/tokio/src/runtime/thread_pool/idle.rs b/tokio/src/runtime/thread_pool/idle.rs index b77cce5f4c4..2cac30ee846 100644 --- a/tokio/src/runtime/thread_pool/idle.rs +++ b/tokio/src/runtime/thread_pool/idle.rs @@ -42,11 +42,11 @@ impl Idle { /// worker currently sleeping. pub(super) fn worker_to_notify(&self) -> Option { // If at least one worker is spinning, work being notified will - // eventully be found. A searching thread will find **some** work and + // eventually be found. A searching thread will find **some** work and // notify another worker, eventually leading to our work being found. // // For this to happen, this load must happen before the thread - // transitioning `num_searching` to zero. Acquire / Relese does not + // transitioning `num_searching` to zero. Acquire / Release does not // provide sufficient guarantees, so this load is done with `SeqCst` and // will pair with the `fetch_sub(1)` when transitioning out of // searching. diff --git a/tokio/src/signal/unix/driver.rs b/tokio/src/signal/unix/driver.rs index 315f3bd5830..5fe7c354c5f 100644 --- a/tokio/src/signal/unix/driver.rs +++ b/tokio/src/signal/unix/driver.rs @@ -47,7 +47,7 @@ impl Driver { use std::mem::ManuallyDrop; use std::os::unix::io::{AsRawFd, FromRawFd}; - // NB: We give each driver a "fresh" reciever file descriptor to avoid + // NB: We give each driver a "fresh" receiver file descriptor to avoid // the issues described in alexcrichton/tokio-process#42. // // In the past we would reuse the actual receiver file descriptor and diff --git a/tokio/src/sync/once_cell.rs b/tokio/src/sync/once_cell.rs index 8c9a4f62529..ce55d9e3546 100644 --- a/tokio/src/sync/once_cell.rs +++ b/tokio/src/sync/once_cell.rs @@ -229,7 +229,7 @@ impl OnceCell { } else { // After acquire().await we have either acquired a permit while self.value // is still uninitialized, or the current thread is awoken after another thread - // has intialized the value and closed the semaphore, in which case self.initialized + // has initialized the value and closed the semaphore, in which case self.initialized // is true and we don't set the value here match self.semaphore.acquire().await { Ok(_permit) => { @@ -285,7 +285,7 @@ impl OnceCell { } else { // After acquire().await we have either acquired a permit while self.value // is still uninitialized, or the current thread is awoken after another thread - // has intialized the value and closed the semaphore, in which case self.initialized + // has initialized the value and closed the semaphore, in which case self.initialized // is true and we don't set the value here match self.semaphore.acquire().await { Ok(_permit) => { @@ -370,7 +370,7 @@ pub enum SetError { AlreadyInitializedError(T), /// Error resulting from [`OnceCell::set`] calls when the cell is currently being - /// inintialized during the calls to that method. + /// initialized during the calls to that method. /// /// [`OnceCell::set`]: crate::sync::OnceCell::set InitializingError(T), diff --git a/tokio/tests/io_copy_bidirectional.rs b/tokio/tests/io_copy_bidirectional.rs index 17c059725c6..0ce7f85c506 100644 --- a/tokio/tests/io_copy_bidirectional.rs +++ b/tokio/tests/io_copy_bidirectional.rs @@ -42,7 +42,7 @@ where { // We run the test twice, with streams passed to copy_bidirectional in // different orders, in order to ensure that the two arguments are - // interchangable. + // interchangeable. let (a, mut a1) = make_socketpair().await; let (b, mut b1) = make_socketpair().await; diff --git a/tokio/tests/sync_rwlock.rs b/tokio/tests/sync_rwlock.rs index e12052b7b6e..7d05086bf80 100644 --- a/tokio/tests/sync_rwlock.rs +++ b/tokio/tests/sync_rwlock.rs @@ -50,8 +50,8 @@ fn read_exclusive_pending() { assert_pending!(t2.poll()); } -// If the max shared access is reached and subsquent shared access is pending -// should be made available when one of the shared acesses is dropped +// If the max shared access is reached and subsequent shared access is pending +// should be made available when one of the shared accesses is dropped #[test] fn exhaust_reading() { let rwlock = RwLock::with_max_readers(100, 1024); diff --git a/tokio/tests/task_abort.rs b/tokio/tests/task_abort.rs index 1d72ac3a25c..ddeb0ee174f 100644 --- a/tokio/tests/task_abort.rs +++ b/tokio/tests/task_abort.rs @@ -82,7 +82,7 @@ fn test_abort_without_panic_3662() { // `Inner::block_on` of `basic_scheduler.rs`. // // We cause the cleanup to happen by having a poll return Pending once - // so that the scheduler can go into the "auxilliary tasks" mode, at + // so that the scheduler can go into the "auxiliary tasks" mode, at // which point the task is removed from the scheduler. let i = tokio::spawn(async move { tokio::task::yield_now().await; diff --git a/tokio/tests/task_local_set.rs b/tokio/tests/task_local_set.rs index 8513609de4c..58d5109486e 100644 --- a/tokio/tests/task_local_set.rs +++ b/tokio/tests/task_local_set.rs @@ -334,7 +334,7 @@ fn with_timeout(timeout: Duration, f: impl FnOnce() + Send + 'static) { // something we can easily make assertions about, we'll run it in a // thread. When the test thread finishes, it will send a message on a // channel to this thread. We'll wait for that message with a fairly - // generous timeout, and if we don't recieve it, we assume the test + // generous timeout, and if we don't receive it, we assume the test // thread has hung. // // Note that it should definitely complete in under a minute, but just diff --git a/tokio/tests/time_sleep.rs b/tokio/tests/time_sleep.rs index 9c04d22b19d..e3e27b0c918 100644 --- a/tokio/tests/time_sleep.rs +++ b/tokio/tests/time_sleep.rs @@ -349,7 +349,7 @@ async fn drop_from_wake() { assert!( !panicked.load(Ordering::SeqCst), - "paniced when dropping timers" + "panicked when dropping timers" ); #[derive(Clone)]