Skip to content

Commit 6b75e3d

Browse files
committedAug 30, 2020
Move to Arc::clone(&x) over x.clone() in library/core
1 parent 81e85ce commit 6b75e3d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed
 

‎library/core/src/pin.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ impl<P: Deref> Pin<P> {
541541
/// use std::pin::Pin;
542542
///
543543
/// fn move_pinned_rc<T>(mut x: Rc<T>) {
544-
/// let pinned = unsafe { Pin::new_unchecked(x.clone()) };
544+
/// let pinned = unsafe { Pin::new_unchecked(Rc::clone(&x)) };
545545
/// {
546546
/// let p: Pin<&T> = pinned.as_ref();
547547
/// // This should mean the pointee can never move again.

‎library/core/src/sync/atomic.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
//! fn main() {
7777
//! let spinlock = Arc::new(AtomicUsize::new(1));
7878
//!
79-
//! let spinlock_clone = spinlock.clone();
79+
//! let spinlock_clone = Arc::clone(&spinlock);
8080
//! let thread = thread::spawn(move|| {
8181
//! spinlock_clone.store(0, Ordering::SeqCst);
8282
//! });

0 commit comments

Comments
 (0)
Please sign in to comment.