File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
crates/ide_assists/src/handlers Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -229,15 +229,17 @@ fn self_type(ast_func: &ast::Fn) -> Option<ast::Type> {
229
229
230
230
/// Output the real name of `Self` like `MyType<T>`, without the lifetimes.
231
231
fn self_type_without_lifetimes ( ast_func : & ast:: Fn ) -> Option < String > {
232
- let path_segment =
233
- ast:: PathType :: cast ( self_type ( ast_func) ?. syntax ( ) . clone ( ) ) ?. path ( ) ?. segment ( ) ?;
232
+ let path_segment = match self_type ( ast_func) ? {
233
+ ast:: Type :: PathType ( path_type) => path_type. path ( ) ?. segment ( ) ?,
234
+ _ => return None ,
235
+ } ;
234
236
let mut name = path_segment. name_ref ( ) ?. to_string ( ) ;
235
237
let generics = path_segment
236
238
. generic_arg_list ( ) ?
237
239
. generic_args ( )
238
240
. filter ( |generic| matches ! ( generic, ast:: GenericArg :: TypeArg ( _) ) )
239
241
. map ( |generic| generic. to_string ( ) ) ;
240
- let generics: String = Itertools :: intersperse ( generics, ", " . to_string ( ) ) . collect ( ) ;
242
+ let generics: String = generics. format ( ", " ) . to_string ( ) ;
241
243
if !generics. is_empty ( ) {
242
244
name. push ( '<' ) ;
243
245
name. push_str ( & generics) ;
@@ -325,7 +327,7 @@ fn arguments_from_params(param_list: &ast::ParamList) -> String {
325
327
} ,
326
328
_ => "_" . to_string ( ) ,
327
329
} ) ;
328
- Itertools :: intersperse ( args_iter, ", " . to_string ( ) ) . collect ( )
330
+ args_iter. format ( ", " ) . to_string ( )
329
331
}
330
332
331
333
/// Helper function to build a function call. `None` if expected `self_name` was not provided
You can’t perform that action at this time.
0 commit comments