Skip to content

Commit 80d08a3

Browse files
committed
Auto merge of #25991 - Jexell:master, r=alexcrichton
Removed an unnecessary `transmute` and replaced some code with an equivalent method.
2 parents 06c6b3c + 7972a00 commit 80d08a3

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/libcollections/linked_list.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,16 +106,14 @@ impl<T> Rawlink<T> {
106106
/// Convert the `Rawlink` into an Option value
107107
fn resolve_immut<'a>(&self) -> Option<&'a T> {
108108
unsafe {
109-
mem::transmute(self.p.as_ref())
109+
self.p.as_ref()
110110
}
111111
}
112112

113113
/// Convert the `Rawlink` into an Option value
114114
fn resolve<'a>(&mut self) -> Option<&'a mut T> {
115-
if self.p.is_null() {
116-
None
117-
} else {
118-
Some(unsafe { mem::transmute(self.p) })
115+
unsafe {
116+
self.p.as_mut()
119117
}
120118
}
121119

0 commit comments

Comments
 (0)