diff options
| author | bors <bors@rust-lang.org> | 2013-03-27 20:27:52 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-03-27 20:27:52 -0700 |
| commit | 4954d3e50177c46d260a5340ff91bfada8590ef0 (patch) | |
| tree | 89f39e479f137db06f87abecbe3aaedb66e4a7a3 /src/libsyntax/codemap.rs | |
| parent | 88963367707c65ad9e84eb2f9f01a5874e90dd96 (diff) | |
| parent | f02ee42a869fea6fbfcea27b79fb71fbd5a055ec (diff) | |
| download | rust-4954d3e50177c46d260a5340ff91bfada8590ef0.tar.gz rust-4954d3e50177c46d260a5340ff91bfada8590ef0.zip | |
auto merge of #5575 : apasel422/rust/simplify-impls, r=thestinger
Diffstat (limited to 'src/libsyntax/codemap.rs')
| -rw-r--r-- | src/libsyntax/codemap.rs | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs index c082f4c0838..b086670956e 100644 --- a/src/libsyntax/codemap.rs +++ b/src/libsyntax/codemap.rs @@ -35,10 +35,12 @@ pub trait Pos { } /// A byte offset +#[deriving(Eq)] pub struct BytePos(uint); /// A character offset. Because of multibyte utf8 characters, a byte offset /// is not equivalent to a character offset. The CodeMap will convert BytePos /// values to CharPos values as necessary. +#[deriving(Eq)] pub struct CharPos(uint); // XXX: Lots of boilerplate in these impls, but so far my attempts to fix @@ -49,11 +51,6 @@ impl Pos for BytePos { fn to_uint(&self) -> uint { **self } } -impl cmp::Eq for BytePos { - fn eq(&self, other: &BytePos) -> bool { **self == **other } - fn ne(&self, other: &BytePos) -> bool { !(*self).eq(other) } -} - impl cmp::Ord for BytePos { fn lt(&self, other: &BytePos) -> bool { **self < **other } fn le(&self, other: &BytePos) -> bool { **self <= **other } @@ -84,11 +81,6 @@ impl Pos for CharPos { fn to_uint(&self) -> uint { **self } } -impl cmp::Eq for CharPos { - fn eq(&self, other: &CharPos) -> bool { **self == **other } - fn ne(&self, other: &CharPos) -> bool { !(*self).eq(other) } -} - impl cmp::Ord for CharPos { fn lt(&self, other: &CharPos) -> bool { **self < **other } fn le(&self, other: &CharPos) -> bool { **self <= **other } |
