Skip to content

Commit

Permalink
docs: fix some typos (#4632)
Browse files Browse the repository at this point in the history
Signed-off-by: cuishuang <imcusg@gmail.com>
  • Loading branch information
cuishuang committed Apr 21, 2022
1 parent d397e77 commit 1472af5
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions tokio/src/io/stdio_common.rs
Expand Up @@ -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
Expand Down Expand Up @@ -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<u8> = str::repeat("a", checked_count).into();
data.extend(std::iter::repeat(0b1010_1010).take(MAX_BUF - checked_count + 1));
Expand All @@ -212,7 +212,7 @@ mod tests {
writer.write_history.iter().copied().sum::<usize>(),
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);
Expand Down
2 changes: 1 addition & 1 deletion tokio/src/process/mod.rs
Expand Up @@ -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());
Expand Down
2 changes: 1 addition & 1 deletion tokio/src/runtime/metrics/runtime.rs
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion 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
Expand Down
2 changes: 1 addition & 1 deletion tokio/src/runtime/thread_pool/worker.rs
Expand Up @@ -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() {
Expand Down

0 comments on commit 1472af5

Please sign in to comment.