Skip to content

Commit

Permalink
Suppress must_use on eat calls in rustfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
compiler-errors committed Jul 30, 2024
1 parent e4076e3 commit 4776ac0
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/tools/rustfmt/src/parse/macros/lazy_static.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,17 @@ pub(crate) fn parse_lazy_static(
}
while parser.token.kind != TokenKind::Eof {
// Parse a `lazy_static!` item.
// FIXME: These `eat_*` calls should be converted to `parse_or` to avoid
// silently formatting malformed lazy-statics.
let vis = parse_or!(parse_visibility, rustc_parse::parser::FollowedByType::No);
parser.eat_keyword(kw::Static);
parser.eat_keyword(kw::Ref);
let _ = parser.eat_keyword(kw::Static);
let _ = parser.eat_keyword(kw::Ref);
let id = parse_or!(parse_ident);
parser.eat(&TokenKind::Colon);
let _ = parser.eat(&TokenKind::Colon);
let ty = parse_or!(parse_ty);
parser.eat(&TokenKind::Eq);
let _ = parser.eat(&TokenKind::Eq);
let expr = parse_or!(parse_expr);
parser.eat(&TokenKind::Semi);
let _ = parser.eat(&TokenKind::Semi);
result.push((vis, id, ty, expr));
}

Expand Down

0 comments on commit 4776ac0

Please sign in to comment.