diff options
| author | Corey Richardson <corey@octayn.net> | 2013-05-18 22:02:45 -0400 |
|---|---|---|
| committer | Corey Richardson <corey@octayn.net> | 2013-05-19 08:16:02 -0400 |
| commit | cc57ca012a1f49875e19b1b089c91928dc339979 (patch) | |
| tree | 9f10c27962dbb7c844bc3abb7e20119d75f02aa6 /src/libsyntax | |
| parent | 3acf37897a4ca7f019ed8894ec3878801377773d (diff) | |
| download | rust-cc57ca012a1f49875e19b1b089c91928dc339979.tar.gz rust-cc57ca012a1f49875e19b1b089c91928dc339979.zip | |
Use assert_eq! rather than assert! where possible
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/codemap.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/parse/mod.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/print/pp.rs | 6 | ||||
| -rw-r--r-- | src/libsyntax/print/pprust.rs | 2 |
4 files changed, 7 insertions, 7 deletions
diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs index 44a368738fd..61921fbf090 100644 --- a/src/libsyntax/codemap.rs +++ b/src/libsyntax/codemap.rs @@ -319,7 +319,7 @@ pub impl FileMap { fn next_line(&self, pos: BytePos) { // the new charpos must be > the last one (or it's the first one). let lines = &mut *self.lines; - assert!((lines.len() == 0) || (lines[lines.len() - 1] < pos)); + assert!((lines.len() == 0) || (lines[lines.len() - 1] < pos)) lines.push(pos); } @@ -458,7 +458,7 @@ pub impl CodeMap { pub fn span_to_snippet(&self, sp: span) -> ~str { let begin = self.lookup_byte_offset(sp.lo); let end = self.lookup_byte_offset(sp.hi); - assert!(begin.fm.start_pos == end.fm.start_pos); + assert_eq!(begin.fm.start_pos, end.fm.start_pos); return str::slice(*begin.fm.src, begin.pos.to_uint(), end.pos.to_uint()).to_owned(); } diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index 9a8a6620652..fa52f3dde3d 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -381,7 +381,7 @@ mod test { i.intern("c"); i.intern("d"); i.intern("return"); - assert!(i.get(ast::ident{repr:101,ctxt:0}) == @~"b"); + assert_eq!(i.get(ast::ident{repr:101,ctxt:0}), @~"b"); i } diff --git a/src/libsyntax/print/pp.rs b/src/libsyntax/print/pp.rs index 38c58612f43..52495522613 100644 --- a/src/libsyntax/print/pp.rs +++ b/src/libsyntax/print/pp.rs @@ -111,7 +111,7 @@ pub fn tok_str(t: token) -> ~str { pub fn buf_str(toks: ~[token], szs: ~[int], left: uint, right: uint, lim: uint) -> ~str { let n = toks.len(); - assert!(n == szs.len()); + assert_eq!(n, szs.len()); let mut i = left; let mut L = lim; let mut s = ~"["; @@ -400,7 +400,7 @@ pub impl Printer { match x { BREAK(b) => self.left_total += b.blank_space, STRING(_, len) => { - assert!((len == L)); self.left_total += len; + assert_eq!(len, L); self.left_total += len; } _ => () } @@ -526,7 +526,7 @@ pub impl Printer { } STRING(s, len) => { debug!("print STRING(%s)", *s); - assert!((L == len)); + assert_eq!(L, len); // assert!(L <= space); self.space -= len; self.print_str(*s); diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index ea1682978a4..b2db752af11 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -2067,7 +2067,7 @@ pub fn maybe_print_comment(s: @ps, pos: BytePos) { pub fn print_comment(s: @ps, cmnt: &comments::cmnt) { match cmnt.style { comments::mixed => { - assert!(cmnt.lines.len() == 1u); + assert_eq!(cmnt.lines.len(), 1u); zerobreak(s.s); word(s.s, cmnt.lines[0]); zerobreak(s.s); |
