File tree Expand file tree Collapse file tree 1 file changed +14
-16
lines changed Expand file tree Collapse file tree 1 file changed +14
-16
lines changed Original file line number Diff line number Diff line change @@ -446,21 +446,6 @@ impl GenericBound<'_> {
446446 }
447447 }
448448
449- pub fn get_inner_ty ( & self ) -> Option < & Ty < ' _ > > {
450- match self {
451- GenericBound :: Trait ( data, _) => {
452- let segment = data. trait_ref . path . segments . first ( ) ?;
453- let binding = segment. args ( ) . bindings . first ( ) ?;
454- if let TypeBindingKind :: Equality { term : Term :: Ty ( ty) } = binding. kind {
455- Some ( ty)
456- } else {
457- None
458- }
459- }
460- _ => None ,
461- }
462- }
463-
464449 pub fn span ( & self ) -> Span {
465450 match self {
466451 GenericBound :: Trait ( t, ..) => t. span ,
@@ -671,7 +656,20 @@ impl<'hir> Generics<'hir> {
671656 ) -> Option < ( Span , bool ) > {
672657 self . bounds_for_param ( param_def_id) . flat_map ( |bp| bp. bounds . iter ( ) . rev ( ) ) . find_map (
673658 |bound| {
674- let span_for_parentheses = bound. get_inner_ty ( ) . and_then ( |ty| {
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+ }
668+ }
669+ _ => None ,
670+ } ;
671+
672+ let span_for_parentheses = inner_ty. and_then ( |ty| {
675673 if let TyKind :: TraitObject ( _, _, TraitObjectSyntax :: Dyn ) = ty. kind {
676674 let span = ty. span ;
677675 span. can_be_used_for_suggestions ( ) . then ( || span)
You can’t perform that action at this time.
0 commit comments