未验证 提交 c1221e20 编写于 作者: B Benoît C 提交者: GitHub

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.
上级 6b9b97bd
......@@ -69,7 +69,7 @@
///
/// 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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册