Bug 1518992 - Remove unnecessary mem::transmute in MediaListKey r=xidorn
authorCameron McCormack <cam@mcc.id.au>
Thu, 10 Jan 2019 06:01:03 +0000
changeset 510452 a5450f478cd96e5f552a37d6f89c63e671958bdd
parent 510451 47c259e23cfe3de3786766c67d41023db6a7ea85
child 510453 b27229f70e017818a9f8cf5ef8cf476e4a006c0f
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersxidorn
bugs1518992
milestone66.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1518992 - Remove unnecessary mem::transmute in MediaListKey r=xidorn Differential Revision: https://phabricator.services.mozilla.com/D16147
servo/components/style/invalidation/media_queries.rs
--- a/servo/components/style/invalidation/media_queries.rs
+++ b/servo/components/style/invalidation/media_queries.rs
@@ -33,20 +33,18 @@ impl MediaListKey {
     }
 }
 
 /// A trait to get a given `MediaListKey` for a given item that can hold a
 /// `MediaList`.
 pub trait ToMediaListKey: Sized {
     /// Get a `MediaListKey` for this item. This key needs to uniquely identify
     /// the item.
-    #[allow(unsafe_code)]
     fn to_media_list_key(&self) -> MediaListKey {
-        use std::mem;
-        MediaListKey(unsafe { mem::transmute(self as *const Self) })
+        MediaListKey(self as *const Self as usize)
     }
 }
 
 impl ToMediaListKey for Stylesheet {}
 impl ToMediaListKey for ImportRule {}
 impl ToMediaListKey for MediaRule {}
 
 /// A struct that holds the result of a media query evaluation pass for the