@@ -394,7 +394,7 @@ fn non_elidable_self_type<'tcx>(cx: &LateContext<'tcx>, func: &FnDecl<'tcx>, ide
394394 let mut visitor = RefVisitor :: new ( cx) ;
395395 visitor. visit_ty_unambig ( self_ty) ;
396396
397- ! visitor. all_lts ( ) . is_empty ( )
397+ visitor. all_lts ( ) . next ( ) . is_some ( )
398398 } else {
399399 false
400400 }
@@ -444,12 +444,8 @@ impl<'a, 'tcx> RefVisitor<'a, 'tcx> {
444444 }
445445 }
446446
447- fn all_lts ( & self ) -> Vec < Lifetime > {
448- self . lts
449- . iter ( )
450- . chain ( self . nested_elision_site_lts . iter ( ) )
451- . copied ( )
452- . collect :: < Vec < _ > > ( )
447+ fn all_lts ( & self ) -> impl Iterator < Item = Lifetime > {
448+ self . lts . iter ( ) . chain ( self . nested_elision_site_lts . iter ( ) ) . copied ( )
453449 }
454450
455451 fn abort ( & self ) -> bool {
@@ -472,7 +468,7 @@ impl<'tcx> Visitor<'tcx> for RefVisitor<'_, 'tcx> {
472468 {
473469 let mut sub_visitor = RefVisitor :: new ( self . cx ) ;
474470 sub_visitor. visit_trait_ref ( trait_ref) ;
475- self . nested_elision_site_lts . append ( & mut sub_visitor. all_lts ( ) ) ;
471+ self . nested_elision_site_lts . extend ( sub_visitor. all_lts ( ) ) ;
476472 } else {
477473 walk_poly_trait_ref ( self , poly_tref) ;
478474 }
@@ -483,7 +479,7 @@ impl<'tcx> Visitor<'tcx> for RefVisitor<'_, 'tcx> {
483479 TyKind :: FnPtr ( & FnPtrTy { decl, .. } ) => {
484480 let mut sub_visitor = RefVisitor :: new ( self . cx ) ;
485481 sub_visitor. visit_fn_decl ( decl) ;
486- self . nested_elision_site_lts . append ( & mut sub_visitor. all_lts ( ) ) ;
482+ self . nested_elision_site_lts . extend ( sub_visitor. all_lts ( ) ) ;
487483 } ,
488484 TyKind :: TraitObject ( bounds, lt) => {
489485 if !lt. is_elided ( ) {
@@ -509,7 +505,7 @@ fn has_where_lifetimes<'tcx>(cx: &LateContext<'tcx>, generics: &'tcx Generics<'_
509505 let mut visitor = RefVisitor :: new ( cx) ;
510506 // walk the type F, it may not contain LT refs
511507 walk_unambig_ty ( & mut visitor, pred. bounded_ty ) ;
512- if ! visitor. all_lts ( ) . is_empty ( ) {
508+ if visitor. all_lts ( ) . next ( ) . is_some ( ) {
513509 return true ;
514510 }
515511 // if the bounds define new lifetimes, they are fine to occur
0 commit comments