rollup merge of #19225: reem/any-unnecessary-transmute-copy
transmute_copy is no longer needed and is just slow.
This commit is contained in:
commit
11700cb1d4
2 changed files with 6 additions and 10 deletions
|
|
@ -71,7 +71,7 @@
|
|||
|
||||
#![stable]
|
||||
|
||||
use mem::{transmute, transmute_copy};
|
||||
use mem::{transmute};
|
||||
use option::{Option, Some, None};
|
||||
use raw::TraitObject;
|
||||
use intrinsics::TypeId;
|
||||
|
|
@ -134,7 +134,7 @@ impl<'a> AnyRefExt<'a> for &'a Any {
|
|||
if self.is::<T>() {
|
||||
unsafe {
|
||||
// Get the raw representation of the trait object
|
||||
let to: TraitObject = transmute_copy(&self);
|
||||
let to: TraitObject = transmute(self);
|
||||
|
||||
// Extract the data pointer
|
||||
Some(transmute(to.data))
|
||||
|
|
@ -162,7 +162,7 @@ impl<'a> AnyMutRefExt<'a> for &'a mut Any {
|
|||
if self.is::<T>() {
|
||||
unsafe {
|
||||
// Get the raw representation of the trait object
|
||||
let to: TraitObject = transmute_copy(&self);
|
||||
let to: TraitObject = transmute(self);
|
||||
|
||||
// Extract the data pointer
|
||||
Some(transmute(to.data))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue