diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2020-02-02 14:15:53 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-02-02 14:15:53 +0100 |
| commit | 011fb23c581cbb3291765cc98eab501082fdbcd1 (patch) | |
| tree | d8a2be03965e66017cb0d8ea37a7b2f42b2fb1b2 /src | |
| parent | 5951cd3dda738ee6187ecea040738cbad57e04e4 (diff) | |
| parent | d154bef4d3f9ea178493024fd27612dcba3acc58 (diff) | |
| download | rust-011fb23c581cbb3291765cc98eab501082fdbcd1.tar.gz rust-011fb23c581cbb3291765cc98eab501082fdbcd1.zip | |
Rollup merge of #68769 - Centril:unwrap, r=petrochenkov
parser: avoid re-wrapping NtItem r? @petrochenkov
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_parse/parser/item.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/librustc_parse/parser/item.rs b/src/librustc_parse/parser/item.rs index 94b72307dae..b7f299e56ae 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<Attribute>, + mut attrs: Vec<Attribute>, macros_allowed: bool, attributes_allowed: bool, ) -> PResult<'a, Option<P<Item>>> { 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; |
