about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDavid Tolnay <dtolnay@gmail.com>2020-06-13 10:11:02 -0700
committerDavid Tolnay <dtolnay@gmail.com>2020-06-13 10:11:02 -0700
commitc010e711ca5ec02012afb83c0d99aec9d26a9eea (patch)
tree40056b5b5ab4e458661a373717bd9ed804183a4c
parent34b3ff06e101f60cb69268ee83c93c177b63c322 (diff)
downloadrust-c010e711ca5ec02012afb83c0d99aec9d26a9eea.tar.gz
rust-c010e711ca5ec02012afb83c0d99aec9d26a9eea.zip
Rewrap comments in Mutex example
-rw-r--r--src/libstd/sync/mutex.rs22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/libstd/sync/mutex.rs b/src/libstd/sync/mutex.rs
index 37c8125b098..8478457eabf 100644
--- a/src/libstd/sync/mutex.rs
+++ b/src/libstd/sync/mutex.rs
@@ -108,8 +108,8 @@ use crate::sys_common::poison::{self, LockResult, TryLockError, TryLockResult};
 /// *guard += 1;
 /// ```
 ///
-/// It is sometimes necessary to manually drop the mutex guard
-/// to unlock it sooner than the end of the enclosing scope.
+/// It is sometimes necessary to manually drop the mutex guard to unlock it
+/// sooner than the end of the enclosing scope.
 ///
 /// ```
 /// use std::sync::{Arc, Mutex};
@@ -139,18 +139,18 @@ use crate::sys_common::poison::{self, LockResult, TryLockError, TryLockResult};
 /// // This is the result of some important and long-ish work.
 /// let result = data.iter().fold(0, |acc, x| acc + x * 2);
 /// data.push(result);
-/// // We drop the `data` explicitly because it's not necessary anymore
-/// // and the thread still has work to do. This allow other threads to
-/// // start working on the data immediately, without waiting
-/// // for the rest of the unrelated work to be done here.
+/// // We drop the `data` explicitly because it's not necessary anymore and the
+/// // thread still has work to do. This allow other threads to start working on
+/// // the data immediately, without waiting for the rest of the unrelated work
+/// // to be done here.
 /// //
 /// // It's even more important here than in the threads because we `.join` the
-/// // threads after that. If we had not dropped the mutex guard, a thread could be
-/// // waiting forever for it, causing a deadlock.
+/// // threads after that. If we had not dropped the mutex guard, a thread could
+/// // be waiting forever for it, causing a deadlock.
 /// drop(data);
-/// // Here the mutex guard is not assigned to a variable and so, even if the scope
-/// // does not end after this line, the mutex is still released:
-/// // there is no deadlock.
+/// // Here the mutex guard is not assigned to a variable and so, even if the
+/// // scope does not end after this line, the mutex is still released: there is
+/// // no deadlock.
 /// *res_mutex.lock().unwrap() += result;
 ///
 /// threads.into_iter().for_each(|thread| {