diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2013-04-09 01:31:23 -0400 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2013-04-14 01:15:46 -0400 |
| commit | d9595d1737677dd61d9f52f674c34f13d708e39c (patch) | |
| tree | 304855240a098090a217dc325c4ca377b31d9ba2 /src/libcore/ptr.rs | |
| parent | 4bfa3c6663ad6facdbdb8bd533442b050085f753 (diff) | |
| download | rust-d9595d1737677dd61d9f52f674c34f13d708e39c.tar.gz rust-d9595d1737677dd61d9f52f674c34f13d708e39c.zip | |
core: remove unnecessary unsafe blocks/functions
Diffstat (limited to 'src/libcore/ptr.rs')
| -rw-r--r-- | src/libcore/ptr.rs | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index 70bdb6f41d8..14e17de4fbd 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -55,17 +55,13 @@ pub fn addr_of<T>(val: &T) -> *T { unsafe { rusti::addr_of(*val) } } /// Calculate the offset from a pointer #[inline(always)] pub fn offset<T>(ptr: *T, count: uint) -> *T { - unsafe { - (ptr as uint + count * sys::size_of::<T>()) as *T - } + (ptr as uint + count * sys::size_of::<T>()) as *T } /// Calculate the offset from a const pointer #[inline(always)] pub fn const_offset<T>(ptr: *const T, count: uint) -> *const T { - unsafe { - (ptr as uint + count * sys::size_of::<T>()) as *T - } + (ptr as uint + count * sys::size_of::<T>()) as *T } /// Calculate the offset from a mut pointer |
