diff --git a/tokio/src/sync/mpsc/block.rs b/tokio/src/sync/mpsc/block.rs index adc3b57e3..cf86922bd 100644 --- a/tokio/src/sync/mpsc/block.rs +++ b/tokio/src/sync/mpsc/block.rs @@ -170,7 +170,7 @@ impl Block { // 2. The `UnsafeCell` always give us a valid pointer to the value. let value = self.values[offset].with(|ptr| unsafe { ptr::read(ptr) }); - // Safety: the redy bit is set, so the value has been initialized. + // Safety: the ready bit is set, so the value has been initialized. Some(Read::Value(unsafe { value.assume_init() })) } diff --git a/tokio/src/sync/tests/loom_mpsc.rs b/tokio/src/sync/tests/loom_mpsc.rs index 039b87a77..620a9638a 100644 --- a/tokio/src/sync/tests/loom_mpsc.rs +++ b/tokio/src/sync/tests/loom_mpsc.rs @@ -171,20 +171,20 @@ fn try_recv() { assert_ok!(ctx.tx.clone().try_send(())); } - let mut ths = Vec::new(); + let mut threads = Vec::new(); for _ in 0..TASKS { let ctx = ctx.clone(); - ths.push(thread::spawn(move || { + threads.push(thread::spawn(move || { run(&ctx); })); } run(&ctx); - for th in ths { - th.join().unwrap(); + for thread in threads { + thread.join().unwrap(); } }); } diff --git a/tokio/src/sync/tests/loom_notify.rs b/tokio/src/sync/tests/loom_notify.rs index e58a78ff1..081cfd21f 100644 --- a/tokio/src/sync/tests/loom_notify.rs +++ b/tokio/src/sync/tests/loom_notify.rs @@ -81,12 +81,12 @@ fn notify_multi() { loom::model(|| { let notify = Arc::new(Notify::new()); - let mut ths = vec![]; + let mut threads = vec![]; for _ in 0..2 { let notify = notify.clone(); - ths.push(thread::spawn(move || { + threads.push(thread::spawn(move || { block_on(async { notify.notified().await; notify.notify_one(); @@ -96,8 +96,8 @@ fn notify_multi() { notify.notify_one(); - for th in ths.drain(..) { - th.join().unwrap(); + for thread in threads.drain(..) { + thread.join().unwrap(); } block_on(async { diff --git a/tokio/src/sync/tests/loom_semaphore_batch.rs b/tokio/src/sync/tests/loom_semaphore_batch.rs index 27a459521..f5e701877 100644 --- a/tokio/src/sync/tests/loom_semaphore_batch.rs +++ b/tokio/src/sync/tests/loom_semaphore_batch.rs @@ -164,13 +164,13 @@ fn batch() { b.check(|| { let semaphore = Arc::new(Semaphore::new(10)); let active = Arc::new(AtomicUsize::new(0)); - let mut ths = vec![]; + let mut threads = vec![]; for _ in 0..2 { let semaphore = semaphore.clone(); let active = active.clone(); - ths.push(thread::spawn(move || { + threads.push(thread::spawn(move || { for n in &[4, 10, 8] { block_on(semaphore.acquire(*n)).unwrap(); @@ -188,8 +188,8 @@ fn batch() { })); } - for th in ths.into_iter() { - th.join().unwrap(); + for thread in threads.into_iter() { + thread.join().unwrap(); } assert_eq!(10, semaphore.available_permits()); diff --git a/tokio/src/time/sleep.rs b/tokio/src/time/sleep.rs index f0bbf5c2f..b2dcf5c59 100644 --- a/tokio/src/time/sleep.rs +++ b/tokio/src/time/sleep.rs @@ -449,7 +449,7 @@ impl Future for Sleep { // // - AtCapacity: this is a pathological case where far too many // sleep instances have been scheduled. - // - Shutdown: No timer has been setup, which is a mis-use error. + // - Shutdown: No timer has been setup, which is a misuse error. // // Both cases are extremely rare, and pretty accurately fit into // "logic errors", so we just panic in this case. A user couldn't diff --git a/tokio/tests/net_unix_pipe.rs b/tokio/tests/net_unix_pipe.rs index 7169b5b61..f95eb1998 100644 --- a/tokio/tests/net_unix_pipe.rs +++ b/tokio/tests/net_unix_pipe.rs @@ -259,11 +259,11 @@ async fn from_file_detects_wrong_access_mode() -> io::Result<()> { let _reader = pipe::OpenOptions::new().open_receiver(&fifo)?; // Check if Receiver detects write-only access mode. - let wronly = std::fs::OpenOptions::new() + let write_only = std::fs::OpenOptions::new() .write(true) .custom_flags(libc::O_NONBLOCK) .open(&fifo)?; - let err = assert_err!(pipe::Receiver::from_file(wronly)); + let err = assert_err!(pipe::Receiver::from_file(write_only)); assert_eq!(err.kind(), io::ErrorKind::InvalidInput); // Check if Sender detects read-only access mode. @@ -298,9 +298,9 @@ async fn from_file_sets_nonblock() -> io::Result<()> { assert!(is_nonblocking(&reader)?); // Check if Sender sets the pipe in non-blocking mode. - let wronly = std::fs::OpenOptions::new().write(true).open(&fifo)?; - assert!(!is_nonblocking(&wronly)?); - let writer = pipe::Sender::from_file(wronly)?; + let write_only = std::fs::OpenOptions::new().write(true).open(&fifo)?; + assert!(!is_nonblocking(&write_only)?); + let writer = pipe::Sender::from_file(write_only)?; assert!(is_nonblocking(&writer)?); Ok(()) diff --git a/tokio/tests/rt_basic.rs b/tokio/tests/rt_basic.rs index 23845bda5..665dce3c9 100644 --- a/tokio/tests/rt_basic.rs +++ b/tokio/tests/rt_basic.rs @@ -365,13 +365,13 @@ mod unstable { .unwrap(); let rt = Arc::new(rt); - let mut ths = vec![]; + let mut threads = vec![]; let (tx, rx) = mpsc::channel(); for _ in 0..N { let rt = rt.clone(); let tx = tx.clone(); - ths.push(std::thread::spawn(move || { + threads.push(std::thread::spawn(move || { rt.block_on(async { tx.send(()).unwrap(); futures::future::pending::<()>().await; @@ -387,8 +387,8 @@ mod unstable { panic!("boom"); }); - for th in ths { - assert!(th.join().is_err()); + for thread in threads { + assert!(thread.join().is_err()); } }