docs: fix some typos (#4632)

Signed-off-by: cuishuang <[email protected]>
This commit is contained in:
cui fliter
2022-04-21 10:16:19 +00:00
committed by GitHub
parent d397e77c90
commit 1472af5bd4
5 changed files with 7 additions and 7 deletions
+3 -3
View File
@@ -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<u8> = 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::<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);
+1 -1
View File
@@ -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());
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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
+1 -1
View File
@@ -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() {