Skip to content

Commit 869449d

Browse files
committed
Clean up Retained code a bit
1 parent a076001 commit 869449d

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/rc/retained.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,15 @@ impl<T> Retained<T> {
7171
///
7272
/// TODO: Something about there not being any mutable references.
7373
#[inline]
74-
pub const unsafe fn new(ptr: NonNull<T>) -> Self {
75-
Retained {
74+
pub unsafe fn new(ptr: NonNull<T>) -> Self {
75+
Self {
7676
ptr,
7777
phantom: PhantomData,
7878
}
7979
}
8080

8181
#[inline]
82-
pub const fn as_ptr(&self) -> *mut T {
82+
pub fn as_ptr(&self) -> *mut T {
8383
self.ptr.as_ptr()
8484
}
8585

@@ -96,7 +96,7 @@ impl<T> Retained<T> {
9696
// SAFETY: The caller upholds that the pointer is valid
9797
let rtn = runtime::objc_retain(ptr.as_ptr() as *mut Object);
9898
debug_assert_eq!(rtn, ptr.as_ptr() as *mut Object);
99-
Retained {
99+
Self {
100100
ptr,
101101
phantom: PhantomData,
102102
}
@@ -167,12 +167,12 @@ impl<T> Deref for Retained<T> {
167167

168168
impl<T: PartialEq> PartialEq for Retained<T> {
169169
#[inline]
170-
fn eq(&self, other: &Retained<T>) -> bool {
170+
fn eq(&self, other: &Self) -> bool {
171171
&**self == &**other
172172
}
173173

174174
#[inline]
175-
fn ne(&self, other: &Retained<T>) -> bool {
175+
fn ne(&self, other: &Self) -> bool {
176176
&**self != &**other
177177
}
178178
}
@@ -193,7 +193,7 @@ impl<T: fmt::Debug> fmt::Debug for Retained<T> {
193193

194194
impl<T> fmt::Pointer for Retained<T> {
195195
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
196-
fmt::Pointer::fmt(&self.as_ptr(), f)
196+
fmt::Pointer::fmt(&self.ptr.as_ptr(), f)
197197
}
198198
}
199199

0 commit comments

Comments
 (0)