Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 883e90d

Browse files
committed
simplify parse_inner_attributes
1 parent c303c44 commit 883e90d

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/librustc_parse/parser/attr.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -201,12 +201,8 @@ impl<'a> Parser<'a> {
201201
let mut attrs: Vec<ast::Attribute> = vec![];
202202
loop {
203203
match self.token.kind {
204-
token::Pound => {
205-
// Don't even try to parse if it's not an inner attribute.
206-
if !self.look_ahead(1, |t| t == &token::Not) {
207-
break;
208-
}
209-
204+
// Only try to parse if it is an inner attribute (has `!`).
205+
token::Pound if self.look_ahead(1, |t| t == &token::Not) => {
210206
let attr = self.parse_attribute(true)?;
211207
assert_eq!(attr.style, ast::AttrStyle::Inner);
212208
attrs.push(attr);

0 commit comments

Comments
 (0)