Skip to content

Commit

Permalink
Fix cargo dev update_lints
Browse files Browse the repository at this point in the history
Now that lints can add @eval_always at the end of their definition, the lint
declaration might not end right after the description. The `update_lints`
command can skip everything that comes after that.
  • Loading branch information
flip1995 committed Nov 3, 2024
1 parent d8cf379 commit 7c5d752
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions clippy_dev/src/update_lints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -762,13 +762,19 @@ fn parse_contents(contents: &str, module: &str, lints: &mut Vec<Lint>) {
Literal{..}(desc)
);

if let Some(LintDeclSearchResult {
token_kind: TokenKind::CloseBrace,
range,
..
}) = iter.next()
{
lints.push(Lint::new(name, group, desc, module, start..range.end));
if let Some(end) = iter.find_map(|t| {
if let LintDeclSearchResult {
token_kind: TokenKind::CloseBrace,
range,
..
} = t
{
Some(range.end)
} else {
None
}
}) {
lints.push(Lint::new(name, group, desc, module, start..end));
}
}
}
Expand Down

0 comments on commit 7c5d752

Please sign in to comment.