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/error.rs | |
| 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/error.rs')
| -rw-r--r-- | src/libstd/error.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libstd/error.rs b/src/libstd/error.rs index 4d08f08bb6e..f0f481d3721 100644 --- a/src/libstd/error.rs +++ b/src/libstd/error.rs @@ -192,7 +192,7 @@ impl Error + 'static { let to: TraitObject = transmute(self); // Extract the data pointer - Some(transmute(to.data)) + Some(&*(to.data as *const T)) } } else { None @@ -210,7 +210,7 @@ impl Error + 'static { let to: TraitObject = transmute(self); // Extract the data pointer - Some(transmute(to.data)) + Some(&mut *(to.data as *const T as *mut T)) } } else { None |
