diff options
| author | Andre Bogus <bogusandre@gmail.com> | 2017-05-13 21:40:06 +0200 |
|---|---|---|
| committer | Andre Bogus <bogusandre@gmail.com> | 2017-05-15 23:56:09 +0200 |
| commit | 958c67d9c8ca74370e2052fd8a3d209b8184d1f4 (patch) | |
| tree | 8f89d2dddd401827953e94e8c3e8a0086a8fb068 /src/libsyntax/parse | |
| parent | a9c163ebe9deeaf74699fc8642d919cdb2b5e617 (diff) | |
| download | rust-958c67d9c8ca74370e2052fd8a3d209b8184d1f4.tar.gz rust-958c67d9c8ca74370e2052fd8a3d209b8184d1f4.zip | |
adressed comments by @kennytm and @petrochenkov
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/classify.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/parse/mod.rs | 1 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 6 |
3 files changed, 4 insertions, 5 deletions
diff --git a/src/libsyntax/parse/classify.rs b/src/libsyntax/parse/classify.rs index c2755cf0591..0c6f09ba766 100644 --- a/src/libsyntax/parse/classify.rs +++ b/src/libsyntax/parse/classify.rs @@ -48,8 +48,8 @@ pub fn expr_is_simple_block(e: &ast::Expr) -> bool { pub fn stmt_ends_with_semi(stmt: &ast::StmtKind) -> bool { match *stmt { ast::StmtKind::Local(_) => true, - ast::StmtKind::Item(_) => false, ast::StmtKind::Expr(ref e) => expr_requires_semi_to_be_stmt(e), + ast::StmtKind::Item(_) | ast::StmtKind::Semi(..) | ast::StmtKind::Mac(..) => false, } diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index 4fcf7614622..1eff819d755 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -341,7 +341,6 @@ pub fn raw_str_lit(lit: &str) -> String { debug!("raw_str_lit: given {}", escape_default(lit)); let mut res = String::with_capacity(lit.len()); - // FIXME #8372: This could be a for-loop if it didn't borrow the iterator let mut chars = lit.chars().peekable(); while let Some(c) = chars.next() { if c == '\r' { diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 28c57e0855f..4741f896d3c 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -1546,7 +1546,7 @@ impl<'a> Parser<'a> { pub fn is_named_argument(&mut self) -> bool { let offset = match self.token { token::BinOp(token::And) | - token::AndAnd | + token::AndAnd => 1, _ if self.token.is_keyword(keywords::Mut) => 1, _ => 0 }; @@ -2569,7 +2569,7 @@ impl<'a> Parser<'a> { s.print_usize(float.trunc() as usize)?; s.pclose()?; word(&mut s.s, ".")?; - word(&mut s.s, fstr.splitn(2, '.').last().unwrap()) + word(&mut s.s, fstr.splitn(2, ".").last().unwrap()) }); err.span_suggestion( lo.to(self.prev_span), @@ -4917,7 +4917,7 @@ impl<'a> Parser<'a> { } } } else { - if let ast::ImplPolarity::Negative = polarity { + if polarity == ast::ImplPolarity::Negative { // This is a negated type implementation // `impl !MyType {}`, which is not allowed. self.span_err(neg_span, "inherent implementation can't be negated"); |
