Skip to content

Commit 387ac06

Browse files
committed
make Weak::ptr_eqs into methods
1 parent 374c63e commit 387ac06

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

src/liballoc/rc.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -1515,18 +1515,18 @@ impl<T: ?Sized> Weak<T> {
15151515
///
15161516
/// ```
15171517
/// #![feature(weak_ptr_eq)]
1518-
/// use std::rc::{Rc, Weak};
1518+
/// use std::rc::Rc;
15191519
///
15201520
/// let first_rc = Rc::new(5);
15211521
/// let first = Rc::downgrade(&first_rc);
15221522
/// let second = Rc::downgrade(&first_rc);
15231523
///
1524-
/// assert!(Weak::ptr_eq(&first, &second));
1524+
/// assert!(first.ptr_eq(&second));
15251525
///
15261526
/// let third_rc = Rc::new(5);
15271527
/// let third = Rc::downgrade(&third_rc);
15281528
///
1529-
/// assert!(!Weak::ptr_eq(&first, &third));
1529+
/// assert!(!first.ptr_eq(&third));
15301530
/// ```
15311531
///
15321532
/// Comparing `Weak::new`.
@@ -1537,16 +1537,16 @@ impl<T: ?Sized> Weak<T> {
15371537
///
15381538
/// let first = Weak::new();
15391539
/// let second = Weak::new();
1540-
/// assert!(Weak::ptr_eq(&first, &second));
1540+
/// assert!(first.ptr_eq(&second));
15411541
///
15421542
/// let third_rc = Rc::new(());
15431543
/// let third = Rc::downgrade(&third_rc);
1544-
/// assert!(!Weak::ptr_eq(&first, &third));
1544+
/// assert!(!first.ptr_eq(&third));
15451545
/// ```
15461546
#[inline]
15471547
#[unstable(feature = "weak_ptr_eq", issue = "55981")]
1548-
pub fn ptr_eq(this: &Self, other: &Self) -> bool {
1549-
this.ptr.as_ptr() == other.ptr.as_ptr()
1548+
pub fn ptr_eq(&self, other: &Self) -> bool {
1549+
self.ptr.as_ptr() == other.ptr.as_ptr()
15501550
}
15511551
}
15521552

src/liballoc/sync.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -1349,18 +1349,18 @@ impl<T: ?Sized> Weak<T> {
13491349
///
13501350
/// ```
13511351
/// #![feature(weak_ptr_eq)]
1352-
/// use std::sync::{Arc, Weak};
1352+
/// use std::sync::Arc;
13531353
///
13541354
/// let first_rc = Arc::new(5);
13551355
/// let first = Arc::downgrade(&first_rc);
13561356
/// let second = Arc::downgrade(&first_rc);
13571357
///
1358-
/// assert!(Weak::ptr_eq(&first, &second));
1358+
/// assert!(first.ptr_eq(&second));
13591359
///
13601360
/// let third_rc = Arc::new(5);
13611361
/// let third = Arc::downgrade(&third_rc);
13621362
///
1363-
/// assert!(!Weak::ptr_eq(&first, &third));
1363+
/// assert!(!first.ptr_eq(&third));
13641364
/// ```
13651365
///
13661366
/// Comparing `Weak::new`.
@@ -1371,16 +1371,16 @@ impl<T: ?Sized> Weak<T> {
13711371
///
13721372
/// let first = Weak::new();
13731373
/// let second = Weak::new();
1374-
/// assert!(Weak::ptr_eq(&first, &second));
1374+
/// assert!(first.ptr_eq(&second));
13751375
///
13761376
/// let third_rc = Arc::new(());
13771377
/// let third = Arc::downgrade(&third_rc);
1378-
/// assert!(!Weak::ptr_eq(&first, &third));
1378+
/// assert!(!first.ptr_eq(&third));
13791379
/// ```
13801380
#[inline]
13811381
#[unstable(feature = "weak_ptr_eq", issue = "55981")]
1382-
pub fn ptr_eq(this: &Self, other: &Self) -> bool {
1383-
this.ptr.as_ptr() == other.ptr.as_ptr()
1382+
pub fn ptr_eq(&self, other: &Self) -> bool {
1383+
self.ptr.as_ptr() == other.ptr.as_ptr()
13841384
}
13851385
}
13861386

0 commit comments

Comments
 (0)