@@ -16,8 +16,7 @@ use syntax::{
1616} ;
1717
1818use crate :: {
19- utils:: convert_reference_type,
20- utils:: { find_struct_impl, render_snippet, Cursor } ,
19+ utils:: { convert_reference_type, find_struct_impl, render_snippet, Cursor } ,
2120 AssistContext , AssistId , AssistKind , Assists ,
2221} ;
2322
@@ -107,7 +106,7 @@ fn fn_target_info(
107106 match path. qualifier ( ) {
108107 Some ( qualifier) => match ctx. sema . resolve_path ( & qualifier) {
109108 Some ( hir:: PathResolution :: Def ( hir:: ModuleDef :: Module ( module) ) ) => {
110- get_fn_target_info ( ctx, & Some ( module) , call. clone ( ) )
109+ get_fn_target_info ( ctx, Some ( module) , call. clone ( ) )
111110 }
112111 Some ( hir:: PathResolution :: Def ( hir:: ModuleDef :: Adt ( adt) ) ) => {
113112 if let hir:: Adt :: Enum ( _) = adt {
@@ -125,7 +124,7 @@ fn fn_target_info(
125124 }
126125 _ => None ,
127126 } ,
128- _ => get_fn_target_info ( ctx, & None , call. clone ( ) ) ,
127+ _ => get_fn_target_info ( ctx, None , call. clone ( ) ) ,
129128 }
130129}
131130
@@ -396,16 +395,16 @@ fn make_return_type(
396395
397396fn get_fn_target_info (
398397 ctx : & AssistContext < ' _ > ,
399- target_module : & Option < Module > ,
398+ target_module : Option < Module > ,
400399 call : CallExpr ,
401400) -> Option < TargetInfo > {
402401 let ( target, file, insert_offset) = get_fn_target ( ctx, target_module, call) ?;
403- Some ( TargetInfo :: new ( * target_module, None , target, file, insert_offset) )
402+ Some ( TargetInfo :: new ( target_module, None , target, file, insert_offset) )
404403}
405404
406405fn get_fn_target (
407406 ctx : & AssistContext < ' _ > ,
408- target_module : & Option < Module > ,
407+ target_module : Option < Module > ,
409408 call : CallExpr ,
410409) -> Option < ( GeneratedFunctionTarget , FileId , TextSize ) > {
411410 let mut file = ctx. file_id ( ) ;
@@ -640,10 +639,11 @@ fn next_space_for_fn_in_module(
640639}
641640
642641fn next_space_for_fn_in_impl ( impl_ : & ast:: Impl ) -> Option < GeneratedFunctionTarget > {
643- if let Some ( last_item) = impl_. assoc_item_list ( ) . and_then ( |it| it. assoc_items ( ) . last ( ) ) {
642+ let assoc_item_list = impl_. assoc_item_list ( ) ?;
643+ if let Some ( last_item) = assoc_item_list. assoc_items ( ) . last ( ) {
644644 Some ( GeneratedFunctionTarget :: BehindItem ( last_item. syntax ( ) . clone ( ) ) )
645645 } else {
646- Some ( GeneratedFunctionTarget :: InEmptyItemList ( impl_ . assoc_item_list ( ) ? . syntax ( ) . clone ( ) ) )
646+ Some ( GeneratedFunctionTarget :: InEmptyItemList ( assoc_item_list. syntax ( ) . clone ( ) ) )
647647 }
648648}
649649
0 commit comments