Merge pull request #770 from msmorgan/safe_point_deref
Remove unsafe statement in Point::deref by forwarding to Vector.
This commit is contained in:
commit
f79f1972e8
|
@ -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