Update linked_list.rs
Removed an unnecessary `transmute` and replaced some code with an equivalent method.
This commit is contained in:
parent
8f209d5a3e
commit
7972a000e3
@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user