Skip to content

Commit f529233

Browse files
committed
fix Tup
1 parent baf09e2 commit f529233

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
@@ -443,9 +443,11 @@ fn ast_ty_search_pat(ty: &ast::Ty) -> (Pat, Pat) {
443443
TyKind::Never => (Pat::Str("!"), Pat::Str("!")),
444444
// Parenthesis are trimmed from the text before the search patterns are matched.
445445
// See: `span_matches_pat`
446-
TyKind::Tup([]) => (Pat::Str(")"), Pat::Str("(")),
447-
TyKind::Tup([ty]) => ast_ty_search_pat(ty),
448-
TyKind::Tup([head, .., tail]) => (ast_ty_search_pat(head).0, ast_ty_search_pat(tail).1),
446+
TyKind::Tup(tup) => match &**tup {
447+
[] => (Pat::Str(")"), Pat::Str("(")),
448+
[ty] => ast_ty_search_pat(ty),
449+
[head, .., tail] => (ast_ty_search_pat(head).0, ast_ty_search_pat(tail).1),
450+
},
449451
TyKind::ImplTrait(..) => (Pat::Str("impl"), Pat::Str("")),
450452
TyKind::Path(qself_path, path) => {
451453
let start = if qself_path.is_some() {

0 commit comments

Comments
 (0)