Skip to content

Commit c1221e2

Browse files
authored
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.
1 parent 6b9b97b commit c1221e2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/libstd/sync/mutex.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ use sys_common::poison::{self, TryLockError, TryLockResult, LockResult};
6969
///
7070
/// let (tx, rx) = channel();
7171
/// for _ in 0..N {
72-
/// let (data, tx) = (data.clone(), tx.clone());
72+
/// let (data, tx) = (Arc::clone(&data), tx.clone());
7373
/// thread::spawn(move || {
7474
/// // The shared state can only be accessed once the lock is held.
7575
/// // Our non-atomic increment is safe because we're the only thread

0 commit comments

Comments
 (0)