Remove unsafe statement in Point::deref by forwarding to Vector.
Since both impls are #[inline], this should have no performance impact.
This commit is contained in:
parent
c1eaac2fae
commit
c6d5d8a1a6
|
@ -1,4 +1,3 @@
|
||||||
use std::mem;
|
|
||||||
use std::ops::{Deref, DerefMut};
|
use std::ops::{Deref, DerefMut};
|
||||||
|
|
||||||
use crate::base::allocator::Allocator;
|
use crate::base::allocator::Allocator;
|
||||||
|
@ -22,7 +21,7 @@ macro_rules! deref_impl(
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn deref(&self) -> &Self::Target {
|
fn deref(&self) -> &Self::Target {
|
||||||
unsafe { mem::transmute(self) }
|
&*self.coords
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +29,7 @@ macro_rules! deref_impl(
|
||||||
where DefaultAllocator: Allocator<N, $D> {
|
where DefaultAllocator: Allocator<N, $D> {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn deref_mut(&mut self) -> &mut Self::Target {
|
fn deref_mut(&mut self) -> &mut Self::Target {
|
||||||
unsafe { mem::transmute(self) }
|
&mut *self.coords
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue