diff options
| author | Tobias Bucher <tobiasbucher5991@gmail.com> | 2015-07-24 03:04:55 +0200 |
|---|---|---|
| committer | Tobias Bucher <tobiasbucher5991@gmail.com> | 2015-08-09 22:05:22 +0200 |
| commit | 22ec5f4af7b5a85ad375d672ed727571b49f3cad (patch) | |
| tree | eea29f1286398aaaa9d55f23163ddcc49b033eeb /src/libstd/sync | |
| parent | febdc3b201bcce1546c88e3be1b956d3f90d3059 (diff) | |
| download | rust-22ec5f4af7b5a85ad375d672ed727571b49f3cad.tar.gz rust-22ec5f4af7b5a85ad375d672ed727571b49f3cad.zip | |
Replace many uses of `mem::transmute` with more specific functions
The replacements are functions that usually use a single `mem::transmute` in their body and restrict input and output via more concrete types than `T` and `U`. Worth noting are the `transmute` functions for slices and the `from_utf8*` family for mutable slices. Additionally, `mem::transmute` was often used for casting raw pointers, when you can already cast raw pointers just fine with `as`.
Diffstat (limited to 'src/libstd/sync')
| -rw-r--r-- | src/libstd/sync/mpsc/select.rs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/libstd/sync/mpsc/select.rs b/src/libstd/sync/mpsc/select.rs index 1d31ac165f6..c46e61cf414 100644 --- a/src/libstd/sync/mpsc/select.rs +++ b/src/libstd/sync/mpsc/select.rs @@ -62,7 +62,6 @@ use core::prelude::v1::*; use core::cell::{Cell, UnsafeCell}; use core::marker; -use core::mem; use core::ptr; use core::usize; @@ -281,7 +280,7 @@ impl<'rx, T: Send> Handle<'rx, T> { pub unsafe fn add(&mut self) { if self.added { return } let selector = &mut *self.selector; - let me: *mut Handle<'static, ()> = mem::transmute(&*self); + let me = self as *mut Handle<'rx, T> as *mut Handle<'static, ()>; if selector.head.is_null() { selector.head = me; @@ -302,7 +301,7 @@ impl<'rx, T: Send> Handle<'rx, T> { if !self.added { return } let selector = &mut *self.selector; - let me: *mut Handle<'static, ()> = mem::transmute(&*self); + let me = self as *mut Handle<'rx, T> as *mut Handle<'static, ()>; if self.prev.is_null() { assert_eq!(selector.head, me); |
