Skip to content

Commit 05ae505

Browse files
pietroalbinikennytm
authored andcommitted
Rollup merge of rust-lang#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.
2 parents c0d48ce + c1221e2 commit 05ae505

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)