Skip to content

Commit

Permalink
Rollup merge of rust-lang#56011 - CBenoit:master, r=QuietMisdreavus
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
pietroalbini authored Nov 18, 2018
2 parents f6d7109 + c1221e2 commit db982d7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/libstd/sync/mutex.rs
Original file line number Diff line number Diff line change
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 db982d7

Please sign in to comment.