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.
This commit is contained in:
Benoît C 2018-11-16 15:34:12 -05:00 committed by GitHub
parent 6b9b97bd9b
commit c1221e2072
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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