about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-04-16 03:22:21 +0000
committerbors <bors@rust-lang.org>2015-04-16 03:22:21 +0000
commit288809c8f35d9b37f2e4f5c3ac168f56dbc3bbc4 (patch)
tree2606f4c9c39c215161feb41a74348d7e07d79c1c /src/libsyntax/parse
parente40449e0d545561c73a9b9b324b5971b533a87b7 (diff)
parentc55ae1dc3094912c935fb95cf915841af0259305 (diff)
downloadrust-288809c8f35d9b37f2e4f5c3ac168f56dbc3bbc4.tar.gz
rust-288809c8f35d9b37f2e4f5c3ac168f56dbc3bbc4.zip
Auto merge of #23682 - tamird:DRY-is-empty, r=alexcrichton
r? @alexcrichton 
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/lexer/comments.rs4
-rw-r--r--src/libsyntax/parse/parser.rs18
2 files changed, 11 insertions, 11 deletions
diff --git a/src/libsyntax/parse/lexer/comments.rs b/src/libsyntax/parse/lexer/comments.rs
index 277f5365db3..bda01d5a654 100644
--- a/src/libsyntax/parse/lexer/comments.rs
+++ b/src/libsyntax/parse/lexer/comments.rs
@@ -63,7 +63,7 @@ pub fn strip_doc_comment_decoration(comment: &str) -> String {
         let mut i = 0;
         let mut j = lines.len();
         // first line of all-stars should be omitted
-        if lines.len() > 0 &&
+        if !lines.is_empty() &&
                 lines[0].chars().all(|c| c == '*') {
             i += 1;
         }
@@ -294,7 +294,7 @@ fn read_block_comment(rdr: &mut StringReader,
                 }
             }
         }
-        if curr_line.len() != 0 {
+        if !curr_line.is_empty() {
             trim_whitespace_prefix_and_push_line(&mut lines,
                                                  curr_line,
                                                  col);
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index bef2068f0dd..0515d1ae945 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -449,7 +449,7 @@ impl<'a> Parser<'a> {
                     (format!("expected one of {}, found `{}`",
                              expect,
                              actual))
-                } else if expected.len() == 0 {
+                } else if expected.is_empty() {
                     (format!("unexpected token: `{}`",
                              actual))
                 } else {
@@ -1244,7 +1244,7 @@ impl<'a> Parser<'a> {
 
         // In type grammar, `+` is treated like a binary operator,
         // and hence both L and R side are required.
-        if bounds.len() == 0 {
+        if bounds.is_empty() {
             let last_span = self.last_span;
             self.span_err(last_span,
                           "at least one type parameter bound \
@@ -2191,7 +2191,7 @@ impl<'a> Parser<'a> {
                                                  &[token::CloseDelim(token::Brace)]));
                             }
 
-                            if fields.len() == 0 && base.is_none() {
+                            if fields.is_empty() && base.is_none() {
                                 let last_span = self.last_span;
                                 self.span_err(last_span,
                                               "structure literal must either \
@@ -2254,7 +2254,7 @@ impl<'a> Parser<'a> {
                         (Vec::new(), Vec::new(), Vec::new())
                     };
 
-                    if bindings.len() > 0 {
+                    if !bindings.is_empty() {
                         let last_span = self.last_span;
                         self.span_err(last_span, "type bindings are only permitted on trait paths");
                     }
@@ -3024,7 +3024,7 @@ impl<'a> Parser<'a> {
                 try!(self.expect(&token::Comma));
 
                 if self.token == token::CloseDelim(token::Bracket)
-                        && (before_slice || after.len() != 0) {
+                        && (before_slice || !after.is_empty()) {
                     break
                 }
             }
@@ -3914,7 +3914,7 @@ impl<'a> Parser<'a> {
                         let hi = self.span.hi;
                         let span = mk_sp(lo, hi);
 
-                        if bounds.len() == 0 {
+                        if bounds.is_empty() {
                             self.span_err(span,
                                           "each predicate in a `where` clause must have \
                                            at least one bound in it");
@@ -4572,7 +4572,7 @@ impl<'a> Parser<'a> {
                 fields.push(try!(self.parse_struct_decl_field(true)));
             }
 
-            if fields.len() == 0 {
+            if fields.is_empty() {
                 return Err(self.fatal(&format!("unit-like struct definition should be \
                     written as `struct {};`",
                     token::get_ident(class_name.clone()))));
@@ -4611,7 +4611,7 @@ impl<'a> Parser<'a> {
                     Ok(spanned(lo, p.span.hi, struct_field_))
                 }));
 
-            if fields.len() == 0 {
+            if fields.is_empty() {
                 return Err(self.fatal(&format!("unit-like struct definition should be \
                     written as `struct {};`",
                     token::get_ident(class_name.clone()))));
@@ -5023,7 +5023,7 @@ impl<'a> Parser<'a> {
                 all_nullary = false;
                 let start_span = self.span;
                 let struct_def = try!(self.parse_struct_def());
-                if struct_def.fields.len() == 0 {
+                if struct_def.fields.is_empty() {
                     self.span_err(start_span,
                         &format!("unit-like struct variant should be written \
                                  without braces, as `{},`",