diff options
| author | Andrew Paseltiner <apaseltiner@gmail.com> | 2013-03-26 08:04:54 -0400 |
|---|---|---|
| committer | Andrew Paseltiner <apaseltiner@gmail.com> | 2013-03-27 22:04:23 -0400 |
| commit | f02ee42a869fea6fbfcea27b79fb71fbd5a055ec (patch) | |
| tree | ed6a17927a2a9bfd7b337338ffb9572d6e188ede /src/libsyntax/codemap.rs | |
| parent | f7f6013a625cefcf914ed890c297a87dacf7bb91 (diff) | |
| download | rust-f02ee42a869fea6fbfcea27b79fb71fbd5a055ec.tar.gz rust-f02ee42a869fea6fbfcea27b79fb71fbd5a055ec.zip | |
derive Eq and Clone impls where applicable
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 } |
