diff options
| author | Philipp Krones <hello@philkrones.com> | 2024-11-03 14:59:03 +0100 |
|---|---|---|
| committer | Philipp Krones <hello@philkrones.com> | 2024-11-07 17:27:46 +0100 |
| commit | b27570b19bec19a3eef642ed8b0419ca7b74e42f (patch) | |
| tree | 2cfe34d32b2d6f877c5ca4a468def83268d4b989 | |
| parent | c64f1e359192473acb38b2ac33aa98055f373405 (diff) | |
| download | rust-b27570b19bec19a3eef642ed8b0419ca7b74e42f.tar.gz rust-b27570b19bec19a3eef642ed8b0419ca7b74e42f.zip | |
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.
| -rw-r--r-- | clippy_dev/src/update_lints.rs | 20 |
1 files 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<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)); } } } |
