From b27570b19bec19a3eef642ed8b0419ca7b74e42f Mon Sep 17 00:00:00 2001 From: Philipp Krones Date: Sun, 3 Nov 2024 14:59:03 +0100 Subject: [PATCH] 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. --- clippy_dev/src/update_lints.rs | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/clippy_dev/src/update_lints.rs b/clippy_dev/src/update_lints.rs index d6ed36d52f4..795456ad3c5 100644 --- a/clippy_dev/src/update_lints.rs +++ b/clippy_dev/src/update_lints.rs @@ -762,13 +762,19 @@ fn parse_contents(contents: &str, module: &str, lints: &mut Vec) { 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)); } } }