diff options
| author | Tamir Duberstein <tamird@gmail.com> | 2015-03-24 16:54:09 -0700 |
|---|---|---|
| committer | Tamir Duberstein <tamird@gmail.com> | 2015-04-14 20:26:03 -0700 |
| commit | 10f15e72e6c265eb43d34dba564d86dbf1c4fb99 (patch) | |
| tree | d7032704f432c471748b1259d03975fef6e80eb0 /src/libsyntax/ext/tt/macro_parser.rs | |
| parent | 29ac04402d53d358a1f6200bea45a301ff05b2d1 (diff) | |
| download | rust-10f15e72e6c265eb43d34dba564d86dbf1c4fb99.tar.gz rust-10f15e72e6c265eb43d34dba564d86dbf1c4fb99.zip | |
Negative case of `len()` -> `is_empty()`
`s/([^\(\s]+\.)len\(\) [(?:!=)>] 0/!$1is_empty()/g`
Diffstat (limited to 'src/libsyntax/ext/tt/macro_parser.rs')
| -rw-r--r-- | src/libsyntax/ext/tt/macro_parser.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index dcbf3c2c892..9c3a556b210 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -457,7 +457,7 @@ pub fn parse(sess: &ParseSess, return Failure(sp, "unexpected end of macro invocation".to_string()); } } else { - if (bb_eis.len() > 0 && next_eis.len() > 0) + if (!bb_eis.is_empty() && !next_eis.is_empty()) || bb_eis.len() > 1 { let nts = bb_eis.iter().map(|ei| { match ei.top_elts.get_tt(ei.idx) { @@ -475,9 +475,9 @@ pub fn parse(sess: &ParseSess, } else if bb_eis.is_empty() && next_eis.is_empty() { return Failure(sp, format!("no rules expected the token `{}`", pprust::token_to_string(&tok)).to_string()); - } else if next_eis.len() > 0 { + } else if !next_eis.is_empty() { /* Now process the next token */ - while next_eis.len() > 0 { + while !next_eis.is_empty() { cur_eis.push(next_eis.pop().unwrap()); } rdr.next_token(); @@ -504,7 +504,7 @@ pub fn parse(sess: &ParseSess, } } - assert!(cur_eis.len() > 0); + assert!(!cur_eis.is_empty()); } } |
