Skip to content

Commit 405de6a

Browse files
committed
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.
1 parent fb97f06 commit 405de6a

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

clippy_dev/src/update_lints.rs

+13-7
Original file line numberDiff line numberDiff line change
@@ -762,13 +762,19 @@ fn parse_contents(contents: &str, module: &str, lints: &mut Vec<Lint>) {
762762
Literal{..}(desc)
763763
);
764764

765-
if let Some(LintDeclSearchResult {
766-
token_kind: TokenKind::CloseBrace,
767-
range,
768-
..
769-
}) = iter.next()
770-
{
771-
lints.push(Lint::new(name, group, desc, module, start..range.end));
765+
if let Some(end) = iter.find_map(|t| {
766+
if let LintDeclSearchResult {
767+
token_kind: TokenKind::CloseBrace,
768+
range,
769+
..
770+
} = t
771+
{
772+
Some(range.end)
773+
} else {
774+
None
775+
}
776+
}) {
777+
lints.push(Lint::new(name, group, desc, module, start..end));
772778
}
773779
}
774780
}

0 commit comments

Comments
 (0)