Remove Spanned from {ast,hir}::FieldPat

This commit is contained in:
Vadim Petrochenkov 2019-08-15 02:35:36 +03:00
parent 433b1e36e1
commit a6182711ef
24 changed files with 72 additions and 92 deletions

View file

@ -488,7 +488,7 @@ impl<'a> Parser<'a> {
}
/// Parses the fields of a struct-like pattern.
fn parse_pat_fields(&mut self) -> PResult<'a, (Vec<Spanned<FieldPat>>, bool)> {
fn parse_pat_fields(&mut self) -> PResult<'a, (Vec<FieldPat>, bool)> {
let mut fields = Vec::new();
let mut etc = false;
let mut ate_comma = true;
@ -620,11 +620,7 @@ impl<'a> Parser<'a> {
.emit();
}
fn parse_pat_field(
&mut self,
lo: Span,
attrs: Vec<Attribute>
) -> PResult<'a, Spanned<FieldPat>> {
fn parse_pat_field(&mut self, lo: Span, attrs: Vec<Attribute>) -> PResult<'a, FieldPat> {
// Check if a colon exists one ahead. This means we're parsing a fieldname.
let hi;
let (subpat, fieldname, is_shorthand) = if self.look_ahead(1, |t| t == &token::Colon) {
@ -659,15 +655,13 @@ impl<'a> Parser<'a> {
(subpat, fieldname, true)
};
Ok(Spanned {
Ok(FieldPat {
ident: fieldname,
pat: subpat,
is_shorthand,
attrs: attrs.into(),
id: ast::DUMMY_NODE_ID,
span: lo.to(hi),
node: FieldPat {
ident: fieldname,
pat: subpat,
is_shorthand,
attrs: attrs.into(),
id: ast::DUMMY_NODE_ID,
}
})
}