Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
simplify parse_inner_attributes
  • Loading branch information
Centril committed Mar 10, 2020
commit 883e90dd81b207cc5d9e85c02f628432b7f8d65d
8 changes: 2 additions & 6 deletions src/librustc_parse/parser/attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,12 +201,8 @@ impl<'a> Parser<'a> {
let mut attrs: Vec<ast::Attribute> = 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);
Expand Down