@@ -5,7 +5,7 @@ use proc_macro2::TokenStream;
55use quote:: quote;
66use std:: borrow:: Cow ;
77use syn:: visit_mut:: { visit_type_mut, VisitMut } ;
8- use syn:: { Expr , ExprLit , ExprPath , Lifetime , Lit , Type } ;
8+ use syn:: { Expr , ExprLit , ExprPath , Lit , Type } ;
99
1010/// A Python expression
1111///
@@ -268,26 +268,10 @@ fn clean_type(mut t: Type, self_type: Option<&Type>) -> Type {
268268 if let Some ( self_type) = self_type {
269269 replace_self ( & mut t, self_type) ;
270270 }
271- elide_lifetimes ( & mut t) ;
271+ crate :: utils :: elide_lifetimes ( & mut t) ;
272272 t
273273}
274274
275- /// Replaces all explicit lifetimes in `self` with elided (`'_`) lifetimes
276- ///
277- /// This is useful if `Self` is used in `const` context, where explicit
278- /// lifetimes are not allowed (yet).
279- fn elide_lifetimes ( ty : & mut Type ) {
280- struct ElideLifetimesVisitor ;
281-
282- impl VisitMut for ElideLifetimesVisitor {
283- fn visit_lifetime_mut ( & mut self , l : & mut Lifetime ) {
284- * l = Lifetime :: new ( "'_" , l. span ( ) ) ;
285- }
286- }
287-
288- ElideLifetimesVisitor . visit_type_mut ( ty) ;
289- }
290-
291275// Replace Self in types with the given type
292276fn replace_self ( ty : & mut Type , self_target : & Type ) {
293277 struct SelfReplacementVisitor < ' a > {
0 commit comments