Fix cargo dev update_lints

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.
This commit is contained in:
Philipp Krones 2024-11-03 14:59:03 +01:00
parent c64f1e3591
commit b27570b19b
No known key found for this signature in database
GPG key ID: 1CA0DF2AF59D68A5

View file

@ -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));
}
}
}