File tree Expand file tree Collapse file tree 1 file changed +16
-14
lines changed Expand file tree Collapse file tree 1 file changed +16
-14
lines changed Original file line number Diff line number Diff line change @@ -662,22 +662,24 @@ impl<'hir> Generics<'hir> {
662662 & self ,
663663 param_def_id : LocalDefId ,
664664 ) -> Option < ( Span , bool ) > {
665- self . bounds_for_param ( param_def_id) . flat_map ( |bp| bp. bounds . iter ( ) . rev ( ) ) . find_map (
666- |bound| {
667- let inner_ty = match bound {
668- GenericBound :: Trait ( data, _) => {
669- let segment = data. trait_ref . path . segments . first ( ) ?;
670- let binding = segment. args ( ) . bindings . first ( ) ?;
671- if let TypeBindingKind :: Equality { term : Term :: Ty ( ty) } = binding. kind {
672- Some ( ty)
673- } else {
674- None
675- }
665+ fn get_inner_ty < ' a , ' b > ( bound : & ' a GenericBound < ' b > ) -> Option < & ' a Ty < ' b > > {
666+ match bound {
667+ GenericBound :: Trait ( data, _) => {
668+ let segment = data. trait_ref . path . segments . first ( ) ?;
669+ let binding = segment. args ( ) . bindings . first ( ) ?;
670+ if let TypeBindingKind :: Equality { term : Term :: Ty ( ty) } = binding. kind {
671+ Some ( ty)
672+ } else {
673+ None
676674 }
677- _ => None ,
678- } ;
675+ }
676+ _ => None ,
677+ }
678+ }
679679
680- let span_for_parentheses = inner_ty. and_then ( |ty| {
680+ self . bounds_for_param ( param_def_id) . flat_map ( |bp| bp. bounds . iter ( ) . rev ( ) ) . find_map (
681+ |bound| {
682+ let span_for_parentheses = get_inner_ty ( bound) . and_then ( |ty| {
681683 if let TyKind :: TraitObject ( _, _, TraitObjectSyntax :: Dyn ) = ty. kind {
682684 let span = ty. span ;
683685 span. can_be_used_for_suggestions ( ) . then ( || span)
You can’t perform that action at this time.
0 commit comments