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) Literal{..}(desc)
); );
if let Some(LintDeclSearchResult { if let Some(end) = iter.find_map(|t| {
token_kind: TokenKind::CloseBrace, if let LintDeclSearchResult {
range, token_kind: TokenKind::CloseBrace,
.. range,
}) = iter.next() ..
{ } = t
lints.push(Lint::new(name, group, desc, module, start..range.end)); {
Some(range.end)
} else {
None
}
}) {
lints.push(Lint::new(name, group, desc, module, start..end));
} }
} }
} }