Skip to content

Commit c7b7588

Browse files
committed
fix TraitObject
1 parent f529233 commit c7b7588

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
@@ -415,7 +415,7 @@ fn ty_search_pat(ty: &Ty<'_>) -> (Pat, Pat) {
415415
}
416416

417417
fn ast_ty_search_pat(ty: &ast::Ty) -> (Pat, Pat) {
418-
use ast::{FnRetTy, MutTy, TyKind};
418+
use ast::{FnRetTy, MutTy, TraitObjectSyntax, TyKind};
419419

420420
match &ty.kind {
421421
TyKind::Slice(..) | TyKind::Array(..) => (Pat::Str("["), Pat::Str("]")),
@@ -496,10 +496,14 @@ fn ast_ty_search_pat(ty: &ast::Ty) -> (Pat, Pat) {
496496
(start, end)
497497
},
498498
TyKind::Infer => (Pat::Str("_"), Pat::Str("_")),
499-
TyKind::TraitObject(_, tagged_ptr) if let TraitObjectSyntax::Dyn = tagged_ptr.tag() => {
500-
(Pat::Str("dyn"), Pat::Str(""))
499+
TyKind::TraitObject(_, trait_obj_syntax) => {
500+
if let TraitObjectSyntax::Dyn = trait_obj_syntax {
501+
(Pat::Str("dyn"), Pat::Str(""))
502+
} else {
503+
// NOTE: `TraitObject` is incomplete. It will always return true then.
504+
(Pat::Str(""), Pat::Str(""))
505+
}
501506
},
502-
// NOTE: `TraitObject` is incomplete. It will always return true then.
503507
_ => (Pat::Str(""), Pat::Str("")),
504508
}
505509
}

0 commit comments

Comments
 (0)