aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2012-11-27 15:32:39 -0800
committerPatrick Walton <pcwalton@mimiga.net>2012-11-27 15:32:39 -0800
commitb04c68091d658104885eba81ba0983006b44d0dc (patch)
treed2bcce2f266fc2d5b9e48685820946e2e222db6b /src
parent29e46273f98023d00876db5e05db1f4c035e4dd1 (diff)
downloadservo-b04c68091d658104885eba81ba0983006b44d0dc.tar.gz
servo-b04c68091d658104885eba81ba0983006b44d0dc.zip
servo: Update for Eq trait with explicit self
Diffstat (limited to 'src')
m---------src/rust-css0
m---------src/rust-geom0
m---------src/rust-http-client0
-rw-r--r--src/servo-gfx/font.rs20
-rw-r--r--src/servo-gfx/geometry.rs12
-rw-r--r--src/servo-gfx/resource/image_cache_task.rs6
-rw-r--r--src/servo-gfx/resource/resource_task.rs9
-rw-r--r--src/servo-gfx/surface.rs6
-rw-r--r--src/servo-gfx/text/glyph.rs32
-rw-r--r--src/servo-gfx/text/util.rs8
-rw-r--r--src/servo/dom/cow.rs4
11 files changed, 54 insertions, 43 deletions
diff --git a/src/rust-css b/src/rust-css
-Subproject 05de2b7203ece02c28b39242e572ee50c94a7aa
+Subproject 0578eb42ae1ef2f303918c4197a09ef69e8a07c
diff --git a/src/rust-geom b/src/rust-geom
-Subproject 06cff4a8b761e07a6b8f0a74e3c2feb40358ec6
+Subproject 9dddb337cc9dea2f4f871b34f9766608cd07cb8
diff --git a/src/rust-http-client b/src/rust-http-client
-Subproject 2f3c63579c01f9e3cb07f03fd172a7a812da728
+Subproject 9421b6c7353a0ae109faf44163b437f2787f52a
diff --git a/src/servo-gfx/font.rs b/src/servo-gfx/font.rs
index 14a1190c130..a9cd0bce16a 100644
--- a/src/servo-gfx/font.rs
+++ b/src/servo-gfx/font.rs
@@ -108,10 +108,8 @@ enum CSSFontWeight {
FontWeight900,
}
pub impl CSSFontWeight : cmp::Eq {
- pure fn eq(other: &CSSFontWeight) -> bool {
- (self as uint) == (*other as uint)
- }
- pure fn ne(other: &CSSFontWeight) -> bool { !self.eq(other) }
+ pure fn eq(&self, other: &CSSFontWeight) -> bool { (*self as uint) == (*other as uint) }
+ pure fn ne(&self, other: &CSSFontWeight) -> bool { !(*self).eq(other) }
}
pub impl CSSFontWeight {
@@ -140,7 +138,7 @@ pub struct FontStyle {
// TODO(Issue #181): use deriving for trivial cmp::Eq implementations
pub impl FontStyle : cmp::Eq {
- pure fn eq(other: &FontStyle) -> bool {
+ pure fn eq(&self, other: &FontStyle) -> bool {
use std::cmp::FuzzyEq;
self.pt_size.fuzzy_eq(&other.pt_size) &&
@@ -149,7 +147,7 @@ pub impl FontStyle : cmp::Eq {
self.oblique == other.oblique &&
self.families == other.families
}
- pure fn ne(other: &FontStyle) -> bool { !self.eq(other) }
+ pure fn ne(&self, other: &FontStyle) -> bool { !(*self).eq(other) }
}
pub type SpecifiedFontStyle = FontStyle;
@@ -175,11 +173,11 @@ pub struct FontDescriptor {
// TODO(Issue #181): use deriving for trivial cmp::Eq implementations
pub impl FontDescriptor : cmp::Eq {
- pure fn eq(other: &FontDescriptor) -> bool {
+ pure fn eq(&self, other: &FontDescriptor) -> bool {
self.style == other.style &&
self.selector == other.selector
}
- pure fn ne(other: &FontDescriptor) -> bool { !self.eq(other) }
+ pure fn ne(&self, other: &FontDescriptor) -> bool { !(*self).eq(other) }
}
pub impl FontDescriptor {
@@ -199,14 +197,14 @@ pub enum FontSelector {
// TODO(Issue #181): use deriving for trivial cmp::Eq implementations
pub impl FontSelector : cmp::Eq {
- pure fn eq(other: &FontSelector) -> bool {
- match (&self, other) {
+ pure fn eq(&self, other: &FontSelector) -> bool {
+ match (self, other) {
(&SelectorPlatformIdentifier(a), &SelectorPlatformIdentifier(b)) => a == b,
(&SelectorStubDummy, &SelectorStubDummy) => true,
_ => false
}
}
- pure fn ne(other: &FontSelector) -> bool { !self.eq(other) }
+ pure fn ne(&self, other: &FontSelector) -> bool { !(*self).eq(other) }
}
// This struct is the result of mapping a specified FontStyle into the
diff --git a/src/servo-gfx/geometry.rs b/src/servo-gfx/geometry.rs
index d2953250efa..748c80d3391 100644
--- a/src/servo-gfx/geometry.rs
+++ b/src/servo-gfx/geometry.rs
@@ -21,15 +21,15 @@ impl Au : Num {
}
impl Au : cmp::Ord {
- pure fn lt(other: &Au) -> bool { *self < **other }
- pure fn le(other: &Au) -> bool { *self <= **other }
- pure fn ge(other: &Au) -> bool { *self >= **other }
- pure fn gt(other: &Au) -> bool { *self > **other }
+ pure fn lt(&self, other: &Au) -> bool { **self < **other }
+ pure fn le(&self, other: &Au) -> bool { **self <= **other }
+ pure fn ge(&self, other: &Au) -> bool { **self >= **other }
+ pure fn gt(&self, other: &Au) -> bool { **self > **other }
}
impl Au : cmp::Eq {
- pure fn eq(other: &Au) -> bool { *self == **other }
- pure fn ne(other: &Au) -> bool { *self != **other }
+ pure fn eq(&self, other: &Au) -> bool { **self == **other }
+ pure fn ne(&self, other: &Au) -> bool { **self != **other }
}
pub pure fn min(x: Au, y: Au) -> Au { if x < y { x } else { y } }
diff --git a/src/servo-gfx/resource/image_cache_task.rs b/src/servo-gfx/resource/image_cache_task.rs
index 0e6399da05a..eb605b6e05e 100644
--- a/src/servo-gfx/resource/image_cache_task.rs
+++ b/src/servo-gfx/resource/image_cache_task.rs
@@ -58,7 +58,7 @@ impl ImageResponseMsg {
}
impl ImageResponseMsg: cmp::Eq {
- pure fn eq(other: &ImageResponseMsg) -> bool {
+ pure fn eq(&self, other: &ImageResponseMsg) -> bool {
// FIXME: Bad copies
match (self.clone(), other.clone()) {
(ImageReady(*), ImageReady(*)) => fail ~"unimplemented comparison",
@@ -70,8 +70,8 @@ impl ImageResponseMsg: cmp::Eq {
| (ImageFailed, _) => false
}
}
- pure fn ne(other: &ImageResponseMsg) -> bool {
- return !self.eq(other);
+ pure fn ne(&self, other: &ImageResponseMsg) -> bool {
+ return !(*self).eq(other);
}
}
diff --git a/src/servo-gfx/resource/resource_task.rs b/src/servo-gfx/resource/resource_task.rs
index d6a19939c21..d490214a9d6 100644
--- a/src/servo-gfx/resource/resource_task.rs
+++ b/src/servo-gfx/resource/resource_task.rs
@@ -24,8 +24,9 @@ pub enum ProgressMsg {
}
impl ProgressMsg: cmp::Eq {
- pure fn eq(other: &ProgressMsg) -> bool {
- match (copy self, copy *other) {
+ pure fn eq(&self, other: &ProgressMsg) -> bool {
+ // FIXME: Bad copies
+ match (copy *self, copy *other) {
(Payload(a), Payload(b)) => a == b,
(Done(a), Done(b)) => a == b,
@@ -33,8 +34,8 @@ impl ProgressMsg: cmp::Eq {
| (Done(*), _) => false
}
}
- pure fn ne(other: &ProgressMsg) -> bool {
- return !self.eq(other);
+ pure fn ne(&self, other: &ProgressMsg) -> bool {
+ return !(*self).eq(other);
}
}
diff --git a/src/servo-gfx/surface.rs b/src/servo-gfx/surface.rs
index be1b5438ce3..012cb5eaf83 100644
--- a/src/servo-gfx/surface.rs
+++ b/src/servo-gfx/surface.rs
@@ -6,12 +6,12 @@ pub enum format {
}
impl format: cmp::Eq {
- pure fn eq(other: &format) -> bool {
- match (self, *other) {
+ pure fn eq(&self, other: &format) -> bool {
+ match (*self, *other) {
(fo_rgba_8888, fo_rgba_8888) => true,
}
}
- pure fn ne(other: &format) -> bool {
+ pure fn ne(&self, other: &format) -> bool {
return !self.eq(other);
}
}
diff --git a/src/servo-gfx/text/glyph.rs b/src/servo-gfx/text/glyph.rs
index f698d520f92..76f5594b066 100644
--- a/src/servo-gfx/text/glyph.rs
+++ b/src/servo-gfx/text/glyph.rs
@@ -39,16 +39,16 @@ enum BreakType {
}
impl BreakType : Eq {
- pure fn eq(other: &BreakType) -> bool {
- match (self, *other) {
+ pure fn eq(&self, other: &BreakType) -> bool {
+ match (*self, *other) {
(BreakTypeNone, BreakTypeNone) => true,
(BreakTypeNormal, BreakTypeNormal) => true,
(BreakTypeHyphen, BreakTypeHyphen) => true,
(_,_) => false,
}
}
- pure fn ne(other: &BreakType) -> bool {
- !self.eq(other)
+ pure fn ne(&self, other: &BreakType) -> bool {
+ !(*self).eq(other)
}
}
@@ -288,15 +288,27 @@ struct DetailedGlyphRecord {
}
impl DetailedGlyphRecord : Ord {
- pure fn lt(other: &DetailedGlyphRecord) -> bool { self.entry_offset < other.entry_offset }
- pure fn le(other: &DetailedGlyphRecord) -> bool { self.entry_offset <= other.entry_offset }
- pure fn ge(other: &DetailedGlyphRecord) -> bool { self.entry_offset >= other.entry_offset }
- pure fn gt(other: &DetailedGlyphRecord) -> bool { self.entry_offset > other.entry_offset }
+ pure fn lt(&self, other: &DetailedGlyphRecord) -> bool {
+ self.entry_offset < other.entry_offset
+ }
+ pure fn le(&self, other: &DetailedGlyphRecord) -> bool {
+ self.entry_offset <= other.entry_offset
+ }
+ pure fn ge(&self, other: &DetailedGlyphRecord) -> bool {
+ self.entry_offset >= other.entry_offset
+ }
+ pure fn gt(&self, other: &DetailedGlyphRecord) -> bool {
+ self.entry_offset > other.entry_offset
+ }
}
impl DetailedGlyphRecord : Eq {
- pure fn eq(other : &DetailedGlyphRecord) -> bool { self.entry_offset == other.entry_offset }
- pure fn ne(other : &DetailedGlyphRecord) -> bool { self.entry_offset != other.entry_offset }
+ pure fn eq(&self, other : &DetailedGlyphRecord) -> bool {
+ self.entry_offset == other.entry_offset
+ }
+ pure fn ne(&self, other : &DetailedGlyphRecord) -> bool {
+ self.entry_offset != other.entry_offset
+ }
}
// Manages the lookup table for detailed glyphs. Sorting is deferred
diff --git a/src/servo-gfx/text/util.rs b/src/servo-gfx/text/util.rs
index 61bfa4db21f..52dbdf5a55c 100644
--- a/src/servo-gfx/text/util.rs
+++ b/src/servo-gfx/text/util.rs
@@ -6,8 +6,8 @@ enum CompressionMode {
}
impl CompressionMode : cmp::Eq {
- pure fn eq(other: &CompressionMode) -> bool {
- match (self, *other) {
+ pure fn eq(&self, other: &CompressionMode) -> bool {
+ match (*self, *other) {
(CompressNone, CompressNone) => true,
(CompressWhitespace, CompressWhitespace) => true,
(CompressWhitespaceNewline, CompressWhitespaceNewline) => true,
@@ -15,8 +15,8 @@ impl CompressionMode : cmp::Eq {
_ => false
}
}
- pure fn ne(other: &CompressionMode) -> bool {
- !self.eq(other)
+ pure fn ne(&self, other: &CompressionMode) -> bool {
+ !(*self).eq(other)
}
}
diff --git a/src/servo/dom/cow.rs b/src/servo/dom/cow.rs
index b90b027ea81..32c7ea1080c 100644
--- a/src/servo/dom/cow.rs
+++ b/src/servo/dom/cow.rs
@@ -134,8 +134,8 @@ impl<T:Send,A> Handle<T,A> {
}
impl <T: Send,A> Handle<T,A> : cmp::Eq {
- pure fn eq(other: &Handle<T,A>) -> bool { *self == **other }
- pure fn ne(other: &Handle<T,A>) -> bool { *self != **other }
+ pure fn eq(&self, other: &Handle<T,A>) -> bool { **self == **other }
+ pure fn ne(&self, other: &Handle<T,A>) -> bool { **self != **other }
}
// Private methods