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 @@ -654,22 +654,24 @@ impl<'hir> Generics<'hir> {
654654 & self ,
655655 param_def_id : LocalDefId ,
656656 ) -> Option < ( Span , bool ) > {
657- self . bounds_for_param ( param_def_id) . flat_map ( |bp| bp. bounds . iter ( ) . rev ( ) ) . find_map (
658- |bound| {
659- let inner_ty = match bound {
660- GenericBound :: Trait ( data, _) => {
661- let segment = data. trait_ref . path . segments . first ( ) ?;
662- let binding = segment. args ( ) . bindings . first ( ) ?;
663- if let TypeBindingKind :: Equality { term : Term :: Ty ( ty) } = binding. kind {
664- Some ( ty)
665- } else {
666- None
667- }
657+ fn get_inner_ty < ' a , ' b > ( bound : & ' a GenericBound < ' b > ) -> Option < & ' a Ty < ' b > > {
658+ match bound {
659+ GenericBound :: Trait ( data, _) => {
660+ let segment = data. trait_ref . path . segments . first ( ) ?;
661+ let binding = segment. args ( ) . bindings . first ( ) ?;
662+ if let TypeBindingKind :: Equality { term : Term :: Ty ( ty) } = binding. kind {
663+ Some ( ty)
664+ } else {
665+ None
668666 }
669- _ => None ,
670- } ;
667+ }
668+ _ => None ,
669+ }
670+ }
671671
672- let span_for_parentheses = inner_ty. and_then ( |ty| {
672+ self . bounds_for_param ( param_def_id) . flat_map ( |bp| bp. bounds . iter ( ) . rev ( ) ) . find_map (
673+ |bound| {
674+ let span_for_parentheses = get_inner_ty ( bound) . and_then ( |ty| {
673675 if let TyKind :: TraitObject ( _, _, TraitObjectSyntax :: Dyn ) = ty. kind {
674676 let span = ty. span ;
675677 span. can_be_used_for_suggestions ( ) . then ( || span)
You can’t perform that action at this time.
0 commit comments