servo: Merge #18061 - style: Remove a few unneeded transmutes (from emilio:trans); r=nox
authorEmilio Cobos Álvarez <emilio@crisal.io>
Sun, 13 Aug 2017 10:39:39 -0500
changeset 645670 a6c82043e00a586ef86b8a0a1ea0662e462b0f45
parent 645669 b941b5a3550d34b2bc686cd3311b12c854f201ad
child 645671 639bef7a35a6f9237a7c9faecd27c6940191d869
push id73826
push userbmo:gasolin@mozilla.com
push dateMon, 14 Aug 2017 01:51:50 +0000
reviewersnox
milestone57.0a1
servo: Merge #18061 - style: Remove a few unneeded transmutes (from emilio:trans); r=nox Source-Repo: https://github.com/servo/servo Source-Revision: bec0d02ad3fe399d96c639b86ff46eba0af88793
servo/components/style/stylesheets/origin.rs
--- a/servo/components/style/stylesheets/origin.rs
+++ b/servo/components/style/stylesheets/origin.rs
@@ -1,16 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 ///! [CSS cascade origins](https://drafts.csswg.org/css-cascade/#cascading-origins).
 
 use std::marker::PhantomData;
-use std::mem::transmute;
 
 /// Each style rule has an origin, which determines where it enters the cascade.
 ///
 /// https://drafts.csswg.org/css-cascade/#cascading-origins
 #[derive(Clone, PartialEq, Eq, Copy, Debug)]
 #[cfg_attr(feature = "servo", derive(HeapSizeOf))]
 pub enum Origin {
     /// https://drafts.csswg.org/css-cascade/#cascade-origin-us
@@ -130,17 +129,17 @@ pub struct PerOriginIterMut<'a, T: 'a> {
     _marker: PhantomData<&'a mut PerOrigin<T>>,
 }
 
 impl<'a, T> Iterator for PerOriginIterMut<'a, T> where T: 'a {
     type Item = (&'a mut T, Origin);
 
     fn next(&mut self) -> Option<Self::Item> {
         let result = match self.cur {
-            0 => (unsafe { transmute(&mut (*self.data).author) }, Origin::Author),
-            1 => (unsafe { transmute(&mut (*self.data).user) }, Origin::User),
-            2 => (unsafe { transmute(&mut (*self.data).user_agent) }, Origin::UserAgent),
+            0 => (unsafe { &mut (*self.data).author }, Origin::Author),
+            1 => (unsafe { &mut (*self.data).user }, Origin::User),
+            2 => (unsafe { &mut (*self.data).user_agent }, Origin::UserAgent),
             _ => return None,
         };
         self.cur += 1;
         Some(result)
     }
 }