File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -81,13 +81,7 @@ impl VisitMut for AddLifetimeToImplTrait {
81
81
}
82
82
83
83
fn visit_type_reference_mut ( & mut self , ty : & mut TypeReference ) {
84
- if let Type :: ImplTrait ( _) = * ty. elem {
85
- let elem = mem:: replace ( & mut * ty. elem , Type :: Verbatim ( TokenStream :: new ( ) ) ) ;
86
- * ty. elem = Type :: Paren ( TypeParen {
87
- paren_token : token:: Paren ( ty. and_token . span ) ,
88
- elem : Box :: new ( elem) ,
89
- } ) ;
90
- }
84
+ parenthesize_impl_trait ( & mut ty. elem , ty. and_token . span ) ;
91
85
visit_mut:: visit_type_reference_mut ( self , ty) ;
92
86
}
93
87
@@ -97,3 +91,13 @@ impl VisitMut for AddLifetimeToImplTrait {
97
91
// fn outer(arg: [u8; { fn inner(_: impl Trait) {}; 0 }]);
98
92
}
99
93
}
94
+
95
+ fn parenthesize_impl_trait ( elem : & mut Type , paren_span : Span ) {
96
+ if let Type :: ImplTrait ( _) = * elem {
97
+ let placeholder = Type :: Verbatim ( TokenStream :: new ( ) ) ;
98
+ * elem = Type :: Paren ( TypeParen {
99
+ paren_token : token:: Paren ( paren_span) ,
100
+ elem : Box :: new ( mem:: replace ( elem, placeholder) ) ,
101
+ } ) ;
102
+ }
103
+ }
You can’t perform that action at this time.
0 commit comments