@@ -80,7 +80,7 @@ pub(super) fn opt_const_param_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Option<
80
80
. and_then ( |args| {
81
81
args. args
82
82
. iter ( )
83
- . filter ( |arg| ! matches ! ( arg, GenericArg :: Lifetime ( _ ) ) )
83
+ . filter ( |arg| arg. is_ty_or_const ( ) )
84
84
. position ( |arg| arg. id ( ) == hir_id)
85
85
} )
86
86
. unwrap_or_else ( || {
@@ -113,7 +113,7 @@ pub(super) fn opt_const_param_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Option<
113
113
. and_then ( |args| {
114
114
args. args
115
115
. iter ( )
116
- . filter ( |arg| ! matches ! ( arg, GenericArg :: Lifetime ( _ ) ) )
116
+ . filter ( |arg| arg. is_ty_or_const ( ) )
117
117
. position ( |arg| arg. id ( ) == hir_id)
118
118
} )
119
119
. unwrap_or_else ( || {
@@ -169,7 +169,7 @@ pub(super) fn opt_const_param_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Option<
169
169
. filter_map ( |seg| seg. args . map ( |args| ( args. args , seg) ) )
170
170
. find_map ( |( args, seg) | {
171
171
args. iter ( )
172
- . filter ( |arg| ! matches ! ( arg, GenericArg :: Lifetime ( _ ) ) )
172
+ . filter ( |arg| arg. is_ty_or_const ( ) )
173
173
. position ( |arg| arg. id ( ) == hir_id)
174
174
. map ( |index| ( index, seg) )
175
175
} ) ;
@@ -232,12 +232,11 @@ pub(super) fn opt_const_param_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Option<
232
232
} ;
233
233
234
234
debug ! ( ?parent_node) ;
235
- debug ! ( ?generics) ;
236
- debug ! ( ?arg_idx) ;
235
+ debug ! ( ?generics, ?arg_idx) ;
237
236
generics
238
237
. params
239
238
. iter ( )
240
- . filter ( |param| ! matches ! ( param. kind, ty :: GenericParamDefKind :: Lifetime { .. } ) )
239
+ . filter ( |param| param. kind . is_ty_or_const ( ) )
241
240
. nth ( match generics. has_self && generics. parent . is_none ( ) {
242
241
true => arg_idx + 1 ,
243
242
false => arg_idx,
0 commit comments