Skip to content

Commit dde0dca

Browse files
authored
Rollup merge of rust-lang#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`
2 parents 6d08b08 + f72b3db commit dde0dca

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

clippy_dev/src/new_lint.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,7 @@ fn setup_mod_file(path: &Path, lint: &LintData<'_>) -> io::Result<&'static str>
470470
});
471471

472472
// Find both the last lint declaration (declare_clippy_lint!) and the lint pass impl
473-
while let Some(LintDeclSearchResult { content, .. }) = iter.find(|result| result.token_kind == TokenKind::Ident) {
473+
while let Some(LintDeclSearchResult { content, .. }) = iter.find(|result| result.token == TokenKind::Ident) {
474474
let mut iter = iter
475475
.by_ref()
476476
.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>
480480
// matches `!{`
481481
match_tokens!(iter, Bang OpenBrace);
482482
if let Some(LintDeclSearchResult { range, .. }) =
483-
iter.find(|result| result.token_kind == TokenKind::CloseBrace)
483+
iter.find(|result| result.token == TokenKind::CloseBrace)
484484
{
485485
last_decl_curly_offset = Some(range.end);
486486
}

0 commit comments

Comments
 (0)