From d154bef4d3f9ea178493024fd27612dcba3acc58 Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Fri, 31 Jan 2020 07:24:23 +0100 Subject: [PATCH] parser: avoid re-wrapping NtItem --- src/librustc_parse/parser/item.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/librustc_parse/parser/item.rs b/src/librustc_parse/parser/item.rs index 7f15c403e9a..82600c354e9 100644 --- a/src/librustc_parse/parser/item.rs +++ b/src/librustc_parse/parser/item.rs @@ -70,16 +70,15 @@ impl<'a> Parser<'a> { /// Parses one of the items allowed by the flags. fn parse_item_implementation( &mut self, - attrs: Vec, + mut attrs: Vec, macros_allowed: bool, attributes_allowed: bool, ) -> PResult<'a, Option>> { maybe_whole!(self, NtItem, |item| { - let mut item = item.into_inner(); - let mut attrs = attrs; + let mut item = item; mem::swap(&mut item.attrs, &mut attrs); item.attrs.extend(attrs); - Some(P(item)) + Some(item) }); let lo = self.token.span;