diff --git a/src/components/gfx/geometry.rs b/src/components/gfx/geometry.rs index 6846c00b691..6195df0bb6a 100644 --- a/src/components/gfx/geometry.rs +++ b/src/components/gfx/geometry.rs @@ -8,7 +8,7 @@ use geom::size::Size2D; use std::num::{NumCast, One, Zero}; -#[deriving(Clone)] +#[deriving(Clone,Eq)] pub struct Au(i32); impl Add for Au { @@ -42,11 +42,6 @@ impl Ord for Au { fn gt(&self, other: &Au) -> bool { **self > **other } } -impl Eq for Au { - fn eq(&self, other: &Au) -> bool { **self == **other } - fn ne(&self, other: &Au) -> bool { **self != **other } -} - impl One for Au { fn one() -> Au { Au(1) } } diff --git a/src/components/gfx/text/util.rs b/src/components/gfx/text/util.rs index 3b074685430..e808d08e339 100644 --- a/src/components/gfx/text/util.rs +++ b/src/components/gfx/text/util.rs @@ -2,6 +2,7 @@ * 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/. */ +#[deriving(Eq)] enum CompressionMode { CompressNone, CompressWhitespace, @@ -9,21 +10,6 @@ enum CompressionMode { DiscardNewline } -impl Eq for CompressionMode { - fn eq(&self, other: &CompressionMode) -> bool { - match (*self, *other) { - (CompressNone, CompressNone) => true, - (CompressWhitespace, CompressWhitespace) => true, - (CompressWhitespaceNewline, CompressWhitespaceNewline) => true, - (DiscardNewline, DiscardNewline) => true, - _ => false - } - } - fn ne(&self, other: &CompressionMode) -> bool { - !(*self).eq(other) - } -} - // ported from Gecko's nsTextFrameUtils::TransformText. // // High level TODOs: diff --git a/src/components/script/dom/node.rs b/src/components/script/dom/node.rs index c573f9912fb..75ce2625c64 100644 --- a/src/components/script/dom/node.rs +++ b/src/components/script/dom/node.rs @@ -28,29 +28,25 @@ use servo_util::tree::{TreeNode, TreeNodeRef, TreeUtils}; /// A phantom type representing the script task's view of this node. Script is able to mutate /// nodes but may not access layout data. +#[deriving(Eq)] pub struct ScriptView; /// A phantom type representing the layout task's view of the node. Layout is not allowed to mutate /// nodes but may access layout data. +#[deriving(Eq)] pub struct LayoutView; +// We shouldn't need Eq for ScriptView and LayoutView; see Rust #7671. + /// This is what a Node looks like if you do not know what kind of node it is. To unpack it, use /// downcast(). /// /// FIXME: This should be replaced with a trait once they can inherit from structs. +#[deriving(Eq)] pub struct AbstractNode { priv obj: *mut Node, } -impl Eq for AbstractNode { - fn eq(&self, other: &AbstractNode) -> bool { - self.obj == other.obj - } - fn ne(&self, other: &AbstractNode) -> bool { - self.obj != other.obj - } -} - /// An HTML node. /// /// `View` describes extra data associated with this node that this task has access to. For