Auto merge of #76128 - poliorcetics:doc-use-arc-clone, r=KodrAus
Use Arc::clone and Rc::clone in documentation This PR replaces uses of `x.clone()` by `Rc::clone(&x)` (or `Arc::clone(&x)`) to better match the documentation for those types. @rustbot modify labels: T-doc
This commit is contained in:
commit
aa81d32165
8 changed files with 23 additions and 23 deletions
|
@ -88,7 +88,7 @@ use crate::sys_common::poison::{self, LockResult, TryLockError, TryLockResult};
|
|||
/// use std::thread;
|
||||
///
|
||||
/// let lock = Arc::new(Mutex::new(0_u32));
|
||||
/// let lock2 = lock.clone();
|
||||
/// let lock2 = Arc::clone(&lock);
|
||||
///
|
||||
/// let _ = thread::spawn(move || -> () {
|
||||
/// // This thread will acquire the mutex first, unwrapping the result of
|
||||
|
@ -259,7 +259,7 @@ impl<T: ?Sized> Mutex<T> {
|
|||
/// use std::thread;
|
||||
///
|
||||
/// let mutex = Arc::new(Mutex::new(0));
|
||||
/// let c_mutex = mutex.clone();
|
||||
/// let c_mutex = Arc::clone(&mutex);
|
||||
///
|
||||
/// thread::spawn(move || {
|
||||
/// *c_mutex.lock().unwrap() = 10;
|
||||
|
@ -295,7 +295,7 @@ impl<T: ?Sized> Mutex<T> {
|
|||
/// use std::thread;
|
||||
///
|
||||
/// let mutex = Arc::new(Mutex::new(0));
|
||||
/// let c_mutex = mutex.clone();
|
||||
/// let c_mutex = Arc::clone(&mutex);
|
||||
///
|
||||
/// thread::spawn(move || {
|
||||
/// let mut lock = c_mutex.try_lock();
|
||||
|
@ -331,7 +331,7 @@ impl<T: ?Sized> Mutex<T> {
|
|||
/// use std::thread;
|
||||
///
|
||||
/// let mutex = Arc::new(Mutex::new(0));
|
||||
/// let c_mutex = mutex.clone();
|
||||
/// let c_mutex = Arc::clone(&mutex);
|
||||
///
|
||||
/// let _ = thread::spawn(move || {
|
||||
/// let _lock = c_mutex.lock().unwrap();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue