From 883e90dd81b207cc5d9e85c02f628432b7f8d65d Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Thu, 5 Mar 2020 03:24:58 +0100 Subject: [PATCH] simplify parse_inner_attributes --- src/librustc_parse/parser/attr.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/librustc_parse/parser/attr.rs b/src/librustc_parse/parser/attr.rs index bdd78e671a8..1e7f5b662f3 100644 --- a/src/librustc_parse/parser/attr.rs +++ b/src/librustc_parse/parser/attr.rs @@ -201,12 +201,8 @@ impl<'a> Parser<'a> { let mut attrs: Vec = vec![]; loop { match self.token.kind { - token::Pound => { - // Don't even try to parse if it's not an inner attribute. - if !self.look_ahead(1, |t| t == &token::Not) { - break; - } - + // Only try to parse if it is an inner attribute (has `!`). + token::Pound if self.look_ahead(1, |t| t == &token::Not) => { let attr = self.parse_attribute(true)?; assert_eq!(attr.style, ast::AttrStyle::Inner); attrs.push(attr);