@@ -340,55 +340,10 @@ impl<'a, 'tcx> TypeVisitor<'tcx> for MarkUsedGenericParams<'a, 'tcx> {
340
340
}
341
341
ty:: Param ( param) => {
342
342
debug ! ( ?param) ;
343
- self . unused_parameters . clear ( param. index ) ;
343
+ self . unused_parameters . mark_used ( param. index ) ;
344
344
ControlFlow :: CONTINUE
345
345
}
346
346
_ => ty. super_visit_with ( self ) ,
347
347
}
348
348
}
349
349
}
350
-
351
- /// Visitor used to check if a generic parameter is used.
352
- struct HasUsedGenericParams < ' a > {
353
- unused_parameters : & ' a FiniteBitSet < u32 > ,
354
- }
355
-
356
- impl < ' a , ' tcx > TypeVisitor < ' tcx > for HasUsedGenericParams < ' a > {
357
- type BreakTy = ( ) ;
358
-
359
- #[ instrument( level = "debug" , skip( self ) ) ]
360
- fn visit_const ( & mut self , c : Const < ' tcx > ) -> ControlFlow < Self :: BreakTy > {
361
- if !c. has_non_region_param ( ) {
362
- return ControlFlow :: CONTINUE ;
363
- }
364
-
365
- match c. kind ( ) {
366
- ty:: ConstKind :: Param ( param) => {
367
- if self . unused_parameters . contains ( param. index ) . unwrap_or ( false ) {
368
- ControlFlow :: CONTINUE
369
- } else {
370
- ControlFlow :: BREAK
371
- }
372
- }
373
- _ => c. super_visit_with ( self ) ,
374
- }
375
- }
376
-
377
- #[ instrument( level = "debug" , skip( self ) ) ]
378
- fn visit_ty ( & mut self , ty : Ty < ' tcx > ) -> ControlFlow < Self :: BreakTy > {
379
- if !ty. has_non_region_param ( ) {
380
- return ControlFlow :: CONTINUE ;
381
- }
382
-
383
- match ty. kind ( ) {
384
- ty:: Param ( param) => {
385
- if self . unused_parameters . contains ( param. index ) . unwrap_or ( false ) {
386
- ControlFlow :: CONTINUE
387
- } else {
388
- ControlFlow :: BREAK
389
- }
390
- }
391
- _ => ty. super_visit_with ( self ) ,
392
- }
393
- }
394
- }
0 commit comments