From 7972a000e3bb625ed6daa5db8adc2f7b42e69e64 Mon Sep 17 00:00:00 2001 From: Jexell Date: Wed, 3 Jun 2015 16:14:35 +0100 Subject: [PATCH] Update linked_list.rs Removed an unnecessary `transmute` and replaced some code with an equivalent method. --- src/libcollections/linked_list.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/libcollections/linked_list.rs b/src/libcollections/linked_list.rs index 391439bcdf2f..ca72bb56d73e 100644 --- a/src/libcollections/linked_list.rs +++ b/src/libcollections/linked_list.rs @@ -107,16 +107,14 @@ impl Rawlink { /// Convert the `Rawlink` into an Option value fn resolve_immut<'a>(&self) -> Option<&'a T> { unsafe { - mem::transmute(self.p.as_ref()) + self.p.as_ref() } } /// Convert the `Rawlink` into an Option value fn resolve<'a>(&mut self) -> Option<&'a mut T> { - if self.p.is_null() { - None - } else { - Some(unsafe { mem::transmute(self.p) }) + unsafe { + self.p.as_mut() } }