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 @@ -442,21 +442,6 @@ impl GenericBound<'_> {
442442 }
443443 }
444444
445- pub fn get_inner_ty ( & self ) -> Option < & Ty < ' _ > > {
446- match self {
447- GenericBound :: Trait ( data, _) => {
448- let segment = data. trait_ref . path . segments . first ( ) ?;
449- let binding = segment. args ( ) . bindings . first ( ) ?;
450- if let TypeBindingKind :: Equality { term : Term :: Ty ( ty) } = binding. kind {
451- Some ( ty)
452- } else {
453- None
454- }
455- }
456- _ => None ,
457- }
458- }
459-
460445 pub fn span ( & self ) -> Span {
461446 match self {
462447 GenericBound :: Trait ( t, ..) => t. span ,
@@ -679,7 +664,20 @@ impl<'hir> Generics<'hir> {
679664 ) -> Option < ( Span , bool ) > {
680665 self . bounds_for_param ( param_def_id) . flat_map ( |bp| bp. bounds . iter ( ) . rev ( ) ) . find_map (
681666 |bound| {
682- let span_for_parentheses = bound. get_inner_ty ( ) . and_then ( |ty| {
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+ }
676+ }
677+ _ => None ,
678+ } ;
679+
680+ let span_for_parentheses = inner_ty. and_then ( |ty| {
683681 if let TyKind :: TraitObject ( _, _, TraitObjectSyntax :: Dyn ) = ty. kind {
684682 let span = ty. span ;
685683 span. can_be_used_for_suggestions ( ) . then ( || span)
You can’t perform that action at this time.
0 commit comments