diff options
| author | Jexell <Jexell@users.noreply.github.com> | 2015-06-03 16:14:35 +0100 |
|---|---|---|
| committer | Jexell <Jexell@users.noreply.github.com> | 2015-06-03 16:14:35 +0100 |
| commit | 7972a000e3bb625ed6daa5db8adc2f7b42e69e64 (patch) | |
| tree | 1b1f88387f511206e714b467832de1546aa2f3c2 /src | |
| parent | 8f209d5a3e07b01de3a670689c4929870b40db7d (diff) | |
| download | rust-7972a000e3bb625ed6daa5db8adc2f7b42e69e64.tar.gz rust-7972a000e3bb625ed6daa5db8adc2f7b42e69e64.zip | |
Update linked_list.rs
Removed an unnecessary `transmute` and replaced some code with an equivalent method.
Diffstat (limited to 'src')
| -rw-r--r-- | src/libcollections/linked_list.rs | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/libcollections/linked_list.rs b/src/libcollections/linked_list.rs index 391439bcdf2..ca72bb56d73 100644 --- a/src/libcollections/linked_list.rs +++ b/src/libcollections/linked_list.rs @@ -107,16 +107,14 @@ impl<T> Rawlink<T> { /// 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() } } |
