about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorPietro Albini <pietro@pietroalbini.org>2018-11-18 23:24:56 +0100
committerkennytm <kennytm@gmail.com>2018-11-19 22:06:35 +0800
commit05ae505a4c438b80268680747713c84ebad662f3 (patch)
tree0009c1b9aac60614602331feb030710a03804562 /src/libstd
parentc0d48ce39a62292f370f756cac45c2a77687a2a1 (diff)
parentc1221e2072beebe90d6bbe8be99a51be1e6d11ea (diff)
downloadrust-05ae505a4c438b80268680747713c84ebad662f3.tar.gz
rust-05ae505a4c438b80268680747713c84ebad662f3.zip
Rollup merge of #56011 - CBenoit:master, r=QuietMisdreavus
Replace data.clone() by Arc::clone(&data) in mutex doc.

Arc::clone(&from) is considered as more idiomatic because it conveys more explicitly the meaning of the code.
Since this clone is visible in the official documentation, I thought it could be better to use the more idiomatic version.
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/sync/mutex.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libstd/sync/mutex.rs b/src/libstd/sync/mutex.rs
index 54bfd8122b4..ec9207ea45b 100644
--- a/src/libstd/sync/mutex.rs
+++ b/src/libstd/sync/mutex.rs
@@ -69,7 +69,7 @@ use sys_common::poison::{self, TryLockError, TryLockResult, LockResult};
 ///
 /// let (tx, rx) = channel();
 /// for _ in 0..N {
-///     let (data, tx) = (data.clone(), tx.clone());
+///     let (data, tx) = (Arc::clone(&data), tx.clone());
 ///     thread::spawn(move || {
 ///         // The shared state can only be accessed once the lock is held.
 ///         // Our non-atomic increment is safe because we're the only thread