From 1472af5bd4e441ed68648660603cffdae55fbdbd Mon Sep 17 00:00:00 2001 From: cui fliter Date: Thu, 21 Apr 2022 18:16:19 +0800 Subject: [PATCH] docs: fix some typos (#4632) Signed-off-by: cuishuang --- tokio/src/io/stdio_common.rs | 6 +++--- tokio/src/process/mod.rs | 2 +- tokio/src/runtime/metrics/runtime.rs | 2 +- tokio/src/runtime/metrics/worker.rs | 2 +- tokio/src/runtime/thread_pool/worker.rs | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tokio/src/io/stdio_common.rs b/tokio/src/io/stdio_common.rs index 7e4a198a8..2715ba792 100644 --- a/tokio/src/io/stdio_common.rs +++ b/tokio/src/io/stdio_common.rs @@ -42,7 +42,7 @@ where // for further code. Since `AsyncWrite` can always shrink // buffer at its discretion, excessive (i.e. in tests) shrinking // does not break correctness. - // 2. If buffer is small, it will not be shrinked. + // 2. If buffer is small, it will not be shrunk. // That's why, it's "textness" will not change, so we don't have // to fixup it. if cfg!(not(any(target_os = "windows", test))) || buf.len() <= crate::io::blocking::MAX_BUF @@ -193,7 +193,7 @@ mod tests { fn test_pseudo_text() { // In this test we write a piece of binary data, whose beginning is // text though. We then validate that even in this corner case buffer - // was not shrinked too much. + // was not shrunk too much. let checked_count = super::MAGIC_CONST * super::MAX_BYTES_PER_CHAR; let mut data: Vec = str::repeat("a", checked_count).into(); data.extend(std::iter::repeat(0b1010_1010).take(MAX_BUF - checked_count + 1)); @@ -212,7 +212,7 @@ mod tests { writer.write_history.iter().copied().sum::(), data.len() ); - // Check that at most MAX_BYTES_PER_CHAR + 1 (i.e. 5) bytes were shrinked + // Check that at most MAX_BYTES_PER_CHAR + 1 (i.e. 5) bytes were shrunk // from the buffer: one because it was outside of MAX_BUF boundary, and // up to one "utf8 code point". assert!(data.len() - writer.write_history[0] <= super::MAX_BYTES_PER_CHAR + 1); diff --git a/tokio/src/process/mod.rs b/tokio/src/process/mod.rs index 4e1a21dd4..719fdeee6 100644 --- a/tokio/src/process/mod.rs +++ b/tokio/src/process/mod.rs @@ -111,7 +111,7 @@ //! let mut cmd = Command::new("sort"); //! //! // Specifying that we want pipe both the output and the input. -//! // Similarily to capturing the output, by configuring the pipe +//! // Similarly to capturing the output, by configuring the pipe //! // to stdin it can now be used as an asynchronous writer. //! cmd.stdout(Stdio::piped()); //! cmd.stdin(Stdio::piped()); diff --git a/tokio/src/runtime/metrics/runtime.rs b/tokio/src/runtime/metrics/runtime.rs index 1acf14ba1..26a0118a4 100644 --- a/tokio/src/runtime/metrics/runtime.rs +++ b/tokio/src/runtime/metrics/runtime.rs @@ -386,7 +386,7 @@ impl RuntimeMetrics { /// Returns the number of tasks currently scheduled in the runtime's /// injection queue. /// - /// Tasks that are spanwed or notified from a non-runtime thread are + /// Tasks that are spawned or notified from a non-runtime thread are /// scheduled using the runtime's injection queue. This metric returns the /// **current** number of tasks pending in the injection queue. As such, the /// returned value may increase or decrease as new tasks are scheduled and diff --git a/tokio/src/runtime/metrics/worker.rs b/tokio/src/runtime/metrics/worker.rs index c9b85e48e..ec58de6b3 100644 --- a/tokio/src/runtime/metrics/worker.rs +++ b/tokio/src/runtime/metrics/worker.rs @@ -1,7 +1,7 @@ use crate::loom::sync::atomic::Ordering::Relaxed; use crate::loom::sync::atomic::{AtomicU64, AtomicUsize}; -/// Retreive runtime worker metrics. +/// Retrieve runtime worker metrics. /// /// **Note**: This is an [unstable API][unstable]. The public API of this type /// may break in 1.x releases. See [the documentation on unstable diff --git a/tokio/src/runtime/thread_pool/worker.rs b/tokio/src/runtime/thread_pool/worker.rs index 7668bb7ca..9b456570d 100644 --- a/tokio/src/runtime/thread_pool/worker.rs +++ b/tokio/src/runtime/thread_pool/worker.rs @@ -616,7 +616,7 @@ impl Core { /// Prepares the worker state for parking. /// - /// Returns true if the transition happend, false if there is work to do first. + /// Returns true if the transition happened, false if there is work to do first. fn transition_to_parked(&mut self, worker: &Worker) -> bool { // Workers should not park if they have work to do if self.lifo_slot.is_some() || self.run_queue.has_tasks() {