diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-08-15 19:32:35 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-15 19:32:35 +0200 |
| commit | bb63d75ac1477eb361bfee764709f5d54e08cec8 (patch) | |
| tree | 4d22981027b1eaabd56035ab21627248c65e2624 /src/tools/clippy | |
| parent | 3075644a3db0e529e5e9e74cf5ea74a0a638d1fe (diff) | |
| parent | 7923b20dd9587743372b3fdf7b48eae220200f6e (diff) | |
| download | rust-bb63d75ac1477eb361bfee764709f5d54e08cec8.tar.gz rust-bb63d75ac1477eb361bfee764709f5d54e08cec8.zip | |
Rollup merge of #129065 - nnethercote:PartialEq-TokenKind, r=spastorino
Use `impl PartialEq<TokenKind> for Token` more. This lets us compare a `Token` with a `TokenKind`. It's used a lot, but can be used even more, avoiding the need for some `.kind` uses. r? `@spastorino`
Diffstat (limited to 'src/tools/clippy')
| -rw-r--r-- | src/tools/clippy/clippy_dev/src/new_lint.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/tools/clippy/clippy_dev/src/new_lint.rs b/src/tools/clippy/clippy_dev/src/new_lint.rs index de91233d196..87117832fb9 100644 --- a/src/tools/clippy/clippy_dev/src/new_lint.rs +++ b/src/tools/clippy/clippy_dev/src/new_lint.rs @@ -470,7 +470,7 @@ fn setup_mod_file(path: &Path, lint: &LintData<'_>) -> io::Result<&'static str> }); // Find both the last lint declaration (declare_clippy_lint!) and the lint pass impl - while let Some(LintDeclSearchResult { content, .. }) = iter.find(|result| result.token_kind == TokenKind::Ident) { + while let Some(LintDeclSearchResult { content, .. }) = iter.find(|result| result.token == TokenKind::Ident) { let mut iter = iter .by_ref() .filter(|t| !matches!(t.token_kind, TokenKind::Whitespace | TokenKind::LineComment { .. })); @@ -480,7 +480,7 @@ fn setup_mod_file(path: &Path, lint: &LintData<'_>) -> io::Result<&'static str> // matches `!{` match_tokens!(iter, Bang OpenBrace); if let Some(LintDeclSearchResult { range, .. }) = - iter.find(|result| result.token_kind == TokenKind::CloseBrace) + iter.find(|result| result.token == TokenKind::CloseBrace) { last_decl_curly_offset = Some(range.end); } |
