@@ -2,8 +2,8 @@ use proc_macro2::{Span, TokenStream};
2
2
use std:: mem;
3
3
use syn:: visit_mut:: { self , VisitMut } ;
4
4
use syn:: {
5
- parse_quote_spanned, token, Expr , GenericArgument , Lifetime , Receiver , Type , TypeImplTrait ,
6
- TypeParen , TypeReference ,
5
+ parse_quote_spanned, token, Expr , GenericArgument , Lifetime , Receiver , ReturnType , Type ,
6
+ TypeBareFn , TypeImplTrait , TypeParen , TypePtr , TypeReference ,
7
7
} ;
8
8
9
9
pub struct CollectLifetimes {
@@ -85,6 +85,18 @@ impl VisitMut for AddLifetimeToImplTrait {
85
85
visit_mut:: visit_type_reference_mut ( self , ty) ;
86
86
}
87
87
88
+ fn visit_type_ptr_mut ( & mut self , ty : & mut TypePtr ) {
89
+ parenthesize_impl_trait ( & mut ty. elem , ty. star_token . span ) ;
90
+ visit_mut:: visit_type_ptr_mut ( self , ty) ;
91
+ }
92
+
93
+ fn visit_type_bare_fn_mut ( & mut self , ty : & mut TypeBareFn ) {
94
+ if let ReturnType :: Type ( arrow, return_type) = & mut ty. output {
95
+ parenthesize_impl_trait ( return_type, arrow. spans [ 0 ] ) ;
96
+ }
97
+ visit_mut:: visit_type_bare_fn_mut ( self , ty) ;
98
+ }
99
+
88
100
fn visit_expr_mut ( & mut self , _e : & mut Expr ) {
89
101
// Do not recurse into impl Traits inside of an array length expression.
90
102
//
0 commit comments