Skip to content

Commit 0ac9d83

Browse files
committed
fix TraitObject
1 parent d86d760 commit 0ac9d83

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

clippy_utils/src/check_proc_macro.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ fn ty_search_pat(ty: &Ty<'_>) -> (Pat, Pat) {
412412
}
413413

414414
fn ast_ty_search_pat(ty: &ast::Ty) -> (Pat, Pat) {
415-
use ast::{FnRetTy, MutTy, TyKind};
415+
use ast::{FnRetTy, MutTy, TraitObjectSyntax, TyKind};
416416

417417
match &ty.kind {
418418
TyKind::Slice(..) | TyKind::Array(..) => (Pat::Str("["), Pat::Str("]")),
@@ -486,10 +486,14 @@ fn ast_ty_search_pat(ty: &ast::Ty) -> (Pat, Pat) {
486486
(start, end)
487487
},
488488
TyKind::Infer => (Pat::Str("_"), Pat::Str("_")),
489-
TyKind::TraitObject(_, tagged_ptr) if let TraitObjectSyntax::Dyn = tagged_ptr.tag() => {
490-
(Pat::Str("dyn"), Pat::Str(""))
489+
TyKind::TraitObject(_, trait_obj_syntax) => {
490+
if let TraitObjectSyntax::Dyn = trait_obj_syntax {
491+
(Pat::Str("dyn"), Pat::Str(""))
492+
} else {
493+
// NOTE: `TraitObject` is incomplete. It will always return true then.
494+
(Pat::Str(""), Pat::Str(""))
495+
}
491496
},
492-
// NOTE: `TraitObject` is incomplete. It will always return true then.
493497
_ => (Pat::Str(""), Pat::Str("")),
494498
}
495499
}

0 commit comments

Comments
 (0)