@@ -418,22 +418,15 @@ fn assoc_fn_target_info(
418418 adt : hir:: Adt ,
419419 fn_name : & str ,
420420) -> Option < TargetInfo > {
421- let mut target_module = None ;
422- let mut adt_name = None ;
423- let ( target, file, insert_offset) = {
424- let target_module: & mut Option < Module > = & mut target_module;
425- let adt_name: & mut Option < hir:: Name > = & mut adt_name;
426- let current_module = ctx. sema . scope ( call. syntax ( ) ) ?. module ( ) ;
427- let module = adt. module ( ctx. sema . db ) ;
428- * target_module = if current_module == module { None } else { Some ( module) } ;
429- if current_module. krate ( ) != module. krate ( ) {
430- return None ;
431- }
432- let ( impl_, file) = get_adt_source ( ctx, & adt, fn_name) ?;
433- let ( target, insert_offset) = get_method_target ( ctx, & module, & impl_) ?;
434- * adt_name = if impl_. is_none ( ) { Some ( adt. name ( ctx. sema . db ) ) } else { None } ;
435- Some ( ( target, file, insert_offset) )
436- } ?;
421+ let current_module = ctx. sema . scope ( call. syntax ( ) ) ?. module ( ) ;
422+ let module = adt. module ( ctx. sema . db ) ;
423+ let target_module = if current_module == module { None } else { Some ( module) } ;
424+ if current_module. krate ( ) != module. krate ( ) {
425+ return None ;
426+ }
427+ let ( impl_, file) = get_adt_source ( ctx, & adt, fn_name) ?;
428+ let ( target, insert_offset) = get_method_target ( ctx, & module, & impl_) ?;
429+ let adt_name = if impl_. is_none ( ) { Some ( adt. name ( ctx. sema . db ) ) } else { None } ;
437430 Some ( TargetInfo { target_module, adt_name, target, file, insert_offset } )
438431}
439432
0 commit comments