diff options
author | Huon Wilson <dbau.pp+github@gmail.com> | 2014-03-25 22:23:55 +1100 |
---|---|---|
committer | Huon Wilson <dbau.pp+github@gmail.com> | 2014-03-25 22:23:55 +1100 |
commit | 94e4ab3eafd24b88a9bdd7dce88c7fe084176668 (patch) | |
tree | a8c3a3b458690f8a85aafb3029b6d799db82195a /src/components/script/dom/node.rs | |
parent | 3401a568f276c55f90ec050df605492b900f79ac (diff) | |
download | servo-94e4ab3eafd24b88a9bdd7dce88c7fe084176668.tar.gz servo-94e4ab3eafd24b88a9bdd7dce88c7fe084176668.zip |
Remove some unnecessary transmutes.
These can either be done by implicit `&` -> `*` coercions, explicit `*`
-> `*` casts, or an explicit `&*x` `*` -> `&` re-borrow (which is still
unsafe, but significantly more controlled compared to a `transmute`).
Diffstat (limited to 'src/components/script/dom/node.rs')
-rw-r--r-- | src/components/script/dom/node.rs | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/components/script/dom/node.rs b/src/components/script/dom/node.rs index 29c59c1aad7..8bece8fdff9 100644 --- a/src/components/script/dom/node.rs +++ b/src/components/script/dom/node.rs @@ -123,8 +123,7 @@ bitfield!(NodeFlags, get_in_hover_state, set_is_in_hover_state, 0x02) impl Drop for Node { fn drop(&mut self) { unsafe { - let this: &mut Node = cast::transmute(self); - this.reap_layout_data() + self.reap_layout_data() } } } @@ -203,7 +202,7 @@ impl LayoutDataRef { } /// A trait that represents abstract layout data. -/// +/// /// FIXME(pcwalton): Very very unsafe!!! We need to send these back to the layout task to be /// destroyed when this node is finalized. pub trait TLayoutData {} @@ -338,7 +337,7 @@ impl NodeHelpers for JS<Node> { fn parent_node(&self) -> Option<JS<Node>> { self.get().parent_node.clone() } - + fn first_child(&self) -> Option<JS<Node>> { self.get().first_child.clone() } @@ -1826,8 +1825,7 @@ impl Node { } pub unsafe fn get_hover_state_for_layout(&self) -> bool { - let unsafe_this: *Node = cast::transmute::<&Node,*Node>(self); - (*unsafe_this).flags.get_in_hover_state() + self.flags.get_in_hover_state() } } |