diff options
author | bors-servo <release+servo@mozilla.com> | 2014-03-25 14:46:37 -0400 |
---|---|---|
committer | bors-servo <release+servo@mozilla.com> | 2014-03-25 14:46:37 -0400 |
commit | f34a64049a8b6dede424d35345db63bc60b5e423 (patch) | |
tree | 26e544754e4c46f958dad6e6363c806941043064 /src/components/script/dom/node.rs | |
parent | a8e1059f44993a28a765c22efc324a43a9115bc4 (diff) | |
parent | 94e4ab3eafd24b88a9bdd7dce88c7fe084176668 (diff) | |
download | servo-f34a64049a8b6dede424d35345db63bc60b5e423.tar.gz servo-f34a64049a8b6dede424d35345db63bc60b5e423.zip |
auto merge of #1978 : huonw/servo/less-transmute, r=Ms2ger
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() } } |