1
Fork 0

Fix indents.

This commit is contained in:
Jeffrey Seyfried 2016-09-22 22:44:59 +00:00
parent 1e1804db18
commit 2c85733521

View file

@ -1231,7 +1231,7 @@ impl<'a> Parser<'a> {
self.parse_token_tree()?;
break;
}
_ => self.bump()
_ => self.bump(),
}
}
@ -1266,20 +1266,18 @@ impl<'a> Parser<'a> {
}
token::OpenDelim(token::Brace) => {
debug!("parse_trait_methods(): parsing provided method");
let (inner_attrs, body) =
self.parse_inner_attrs_and_block()?;
let (inner_attrs, body) = self.parse_inner_attrs_and_block()?;
attrs.extend(inner_attrs.iter().cloned());
Some(body)
}
_ => {
let token_str = self.this_token_to_string();
return Err(self.fatal(&format!("expected `;` or `{{`, found `{}`",
token_str)[..]))
return Err(self.fatal(&format!("expected `;` or `{{`, found `{}`", token_str)));
}
};
(ident, ast::TraitItemKind::Method(sig, body))
};
Ok(TraitItem {
id: ast::DUMMY_NODE_ID,
ident: name,
@ -3574,7 +3572,6 @@ impl<'a> Parser<'a> {
if let token::Lifetime(ident) = self.token {
return Err(self.fatal(&format!("unexpected lifetime `{}` in pattern", ident)));
}
let subpat = self.parse_pat()?;
pat = PatKind::Ref(subpat, mutbl);
}
@ -3592,9 +3589,8 @@ impl<'a> Parser<'a> {
self.expect(&token::CloseDelim(token::Bracket))?;
pat = PatKind::Vec(before, slice, after);
}
_ => {
// At this point, token != _, &, &&, (, [
if self.eat_keyword(keywords::Mut) {
_ => if self.eat_keyword(keywords::Mut) {
// Parse mut ident @ pat
pat = self.parse_pat_ident(BindingMode::ByValue(Mutability::Mutable))?;
} else if self.eat_keyword(keywords::Ref) {
@ -3605,9 +3601,8 @@ impl<'a> Parser<'a> {
// Parse box pat
let subpat = self.parse_pat()?;
pat = PatKind::Box(subpat);
} else if self.token.is_path_start() {
// Parse pattern starting with a path
if self.token.is_ident() && self.look_ahead(1, |t| match *t {
} else if self.token.is_ident() && self.token.is_path_start() &&
self.look_ahead(1, |t| match *t {
token::OpenDelim(token::Paren) | token::OpenDelim(token::Brace) |
token::DotDotDot | token::ModSep | token::Not => false,
_ => true,
@ -3617,11 +3612,11 @@ impl<'a> Parser<'a> {
// they are dealt with later in resolve
let binding_mode = BindingMode::ByValue(Mutability::Immutable);
pat = self.parse_pat_ident(binding_mode)?;
} else {
} else if self.token.is_path_start() {
// Parse pattern starting with a path
let (qself, path) = if self.eat_lt() {
// Parse a qualified path
let (qself, path) =
self.parse_qualified_path(PathStyle::Expr)?;
let (qself, path) = self.parse_qualified_path(PathStyle::Expr)?;
(Some(qself), path)
} else {
// Parse an unqualified path
@ -3632,12 +3627,11 @@ impl<'a> Parser<'a> {
// Parse macro invocation
self.bump();
let delim = self.expect_open_delim()?;
let tts = self.parse_seq_to_end(
&token::CloseDelim(delim),
SeqSep::none(), |p| p.parse_token_tree())?;
let mac = Mac_ { path: path, tts: tts };
pat = PatKind::Mac(codemap::Spanned {node: mac,
span: mk_sp(lo, self.last_span.hi)});
let tts = self.parse_seq_to_end(&token::CloseDelim(delim),
SeqSep::none(),
|p| p.parse_token_tree())?;
let mac = spanned(lo, self.last_span.hi, Mac_ { path: path, tts: tts });
pat = PatKind::Mac(mac);
}
token::DotDotDot => {
// Parse range
@ -3672,10 +3666,7 @@ impl<'a> Parser<'a> {
self.expect(&token::CloseDelim(token::Paren))?;
pat = PatKind::TupleStruct(path, fields, ddpos)
}
_ => {
pat = PatKind::Path(qself, path);
}
}
_ => pat = PatKind::Path(qself, path),
}
} else {
// Try to parse everything else as literal with optional minus
@ -3696,7 +3687,6 @@ impl<'a> Parser<'a> {
}
}
}
}
let hi = self.last_span.hi;
Ok(P(ast::Pat {