Skip to content

Commit

Permalink
auto merge of #9200 : lkuper/rust/libsyntax-cleanup, r=luqmana
Browse files Browse the repository at this point in the history
  • Loading branch information
bors committed Sep 15, 2013
2 parents 0dbd509 + 6ba2cb8 commit a2231dc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 55 deletions.
39 changes: 0 additions & 39 deletions src/libsyntax/ast_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -519,20 +519,11 @@ impl Visitor<()> for IdVisitor {
visit::walk_stmt(self, statement, env)
}

// XXX: Default
fn visit_arm(&mut self, arm: &Arm, env: ()) {
visit::walk_arm(self, arm, env)
}

fn visit_pat(&mut self, pattern: @Pat, env: ()) {
(self.visit_callback)(pattern.id);
visit::walk_pat(self, pattern, env)
}

// XXX: Default
fn visit_decl(&mut self, declaration: @Decl, env: ()) {
visit::walk_decl(self, declaration, env)
}

fn visit_expr(&mut self, expression: @Expr, env: ()) {
{
Expand All @@ -545,11 +536,6 @@ impl Visitor<()> for IdVisitor {
visit::walk_expr(self, expression, env)
}

// XXX: Default
fn visit_expr_post(&mut self, _: @Expr, _: ()) {
// Empty!
}

fn visit_ty(&mut self, typ: &Ty, env: ()) {
(self.visit_callback)(typ.id);
match typ.node {
Expand Down Expand Up @@ -612,31 +598,6 @@ impl Visitor<()> for IdVisitor {
}
}

// XXX: Default
fn visit_ty_method(&mut self, type_method: &TypeMethod, env: ()) {
visit::walk_ty_method(self, type_method, env)
}

// XXX: Default
fn visit_trait_method(&mut self, trait_method: &trait_method, env: ()) {
visit::walk_trait_method(self, trait_method, env)
}

// XXX: Default
fn visit_struct_def(&mut self,
struct_definition: @struct_def,
identifier: Ident,
generics: &Generics,
node_id: NodeId,
env: ()) {
visit::walk_struct_def(self,
struct_definition,
identifier,
generics,
node_id,
env)
}

fn visit_struct_field(&mut self, struct_field: @struct_field, env: ()) {
(self.visit_callback)(struct_field.node.id);
visit::walk_struct_field(self, struct_field, env)
Expand Down
18 changes: 2 additions & 16 deletions src/libsyntax/codemap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ pub trait Pos {
}

/// A byte offset
#[deriving(Clone, Eq, IterBytes)]
#[deriving(Clone, Eq, IterBytes, Ord)]
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,IterBytes)]
#[deriving(Eq,IterBytes, Ord)]
pub struct CharPos(uint);

// XXX: Lots of boilerplate in these impls, but so far my attempts to fix
Expand All @@ -46,13 +46,6 @@ impl Pos for BytePos {
fn to_uint(&self) -> uint { **self }
}

impl cmp::Ord for BytePos {
fn lt(&self, other: &BytePos) -> bool { **self < **other }
fn le(&self, other: &BytePos) -> bool { **self <= **other }
fn ge(&self, other: &BytePos) -> bool { **self >= **other }
fn gt(&self, other: &BytePos) -> bool { **self > **other }
}

impl Add<BytePos, BytePos> for BytePos {
fn add(&self, rhs: &BytePos) -> BytePos {
BytePos(**self + **rhs)
Expand All @@ -70,13 +63,6 @@ impl Pos for CharPos {
fn to_uint(&self) -> uint { **self }
}

impl cmp::Ord for CharPos {
fn lt(&self, other: &CharPos) -> bool { **self < **other }
fn le(&self, other: &CharPos) -> bool { **self <= **other }
fn ge(&self, other: &CharPos) -> bool { **self >= **other }
fn gt(&self, other: &CharPos) -> bool { **self > **other }
}

impl Add<CharPos,CharPos> for CharPos {
fn add(&self, rhs: &CharPos) -> CharPos {
CharPos(**self + **rhs)
Expand Down

0 comments on commit a2231dc

Please sign in to comment.