Skip to content

Commit d86d760

Browse files
committed
fix Tup
1 parent 4c6da13 commit d86d760

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

clippy_utils/src/check_proc_macro.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -440,9 +440,11 @@ fn ast_ty_search_pat(ty: &ast::Ty) -> (Pat, Pat) {
440440
TyKind::Never => (Pat::Str("!"), Pat::Str("!")),
441441
// Parenthesis are trimmed from the text before the search patterns are matched.
442442
// See: `span_matches_pat`
443-
TyKind::Tup([]) => (Pat::Str(")"), Pat::Str("(")),
444-
TyKind::Tup([ty]) => ast_ty_search_pat(ty),
445-
TyKind::Tup([head, .., tail]) => (ast_ty_search_pat(head).0, ast_ty_search_pat(tail).1),
443+
TyKind::Tup(tup) => match &**tup {
444+
[] => (Pat::Str(")"), Pat::Str("(")),
445+
[ty] => ast_ty_search_pat(ty),
446+
[head, .., tail] => (ast_ty_search_pat(head).0, ast_ty_search_pat(tail).1),
447+
},
446448
TyKind::ImplTrait(..) => (Pat::Str("impl"), Pat::Str("")),
447449
TyKind::Path(qself_path, path) => {
448450
let start = if qself_path.is_some() {

0 commit comments

Comments
 (0)