Skip to content

Commit

Permalink
Replace data.clone() by Arc::clone(&data) in mutex doc.
Browse files Browse the repository at this point in the history
Arc::clone(&from) is considered as more idiomatic because it conveys more explicitly the meaning of the code.
  • Loading branch information
CBenoit committed Nov 16, 2018
1 parent 6b9b97b commit c1221e2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/libstd/sync/mutex.rs
Expand Up @@ -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
Expand Down

0 comments on commit c1221e2

Please sign in to comment.