@@ -408,7 +408,7 @@ pub fn handle_runnables(
408408 continue ;
409409 }
410410
411- res. push ( to_proto:: runnable ( & snap, file_id, & runnable) ?) ;
411+ res. push ( to_proto:: runnable ( & snap, file_id, runnable) ?) ;
412412 }
413413
414414 // Add `cargo check` and `cargo test` for the whole package
@@ -818,7 +818,7 @@ pub fn handle_code_lens(
818818
819819 let action = runnable. action ( ) ;
820820 let range = to_proto:: range ( & line_index, runnable. nav . range ( ) ) ;
821- let r = to_proto:: runnable ( & snap, file_id, & runnable) ?;
821+ let r = to_proto:: runnable ( & snap, file_id, runnable) ?;
822822 if snap. config . lens . run {
823823 let lens = CodeLens {
824824 range,
@@ -830,7 +830,7 @@ pub fn handle_code_lens(
830830
831831 if action. debugee && snap. config . lens . debug {
832832 let debug_lens =
833- CodeLens { range, command : Some ( debug_single_command ( r) ) , data : None } ;
833+ CodeLens { range, command : Some ( debug_single_command ( & r) ) , data : None } ;
834834 lenses. push ( debug_lens) ;
835835 }
836836 }
@@ -1142,7 +1142,7 @@ fn run_single_command(runnable: &lsp_ext::Runnable, title: &str) -> Command {
11421142 }
11431143}
11441144
1145- fn debug_single_command ( runnable : lsp_ext:: Runnable ) -> Command {
1145+ fn debug_single_command ( runnable : & lsp_ext:: Runnable ) -> Command {
11461146 Command {
11471147 title : "Debug" . into ( ) ,
11481148 command : "rust-analyzer.debugSingle" . into ( ) ,
@@ -1183,26 +1183,25 @@ fn show_impl_command_link(
11831183fn to_runnable_action (
11841184 snap : & GlobalStateSnapshot ,
11851185 file_id : FileId ,
1186- runnable : & Runnable ,
1186+ runnable : Runnable ,
11871187) -> Option < lsp_ext:: CommandLinkGroup > {
11881188 let cargo_spec = CargoTargetSpec :: for_file ( & snap, file_id) . ok ( ) ?;
1189- if should_skip_target ( runnable, cargo_spec. as_ref ( ) ) {
1189+ if should_skip_target ( & runnable, cargo_spec. as_ref ( ) ) {
11901190 return None ;
11911191 }
11921192
1193+ let action: & ' static _ = runnable. action ( ) ;
11931194 to_proto:: runnable ( snap, file_id, runnable) . ok ( ) . map ( |r| {
11941195 let mut group = lsp_ext:: CommandLinkGroup :: default ( ) ;
11951196
1196- let action = runnable. action ( ) ;
11971197 if snap. config . hover . run {
11981198 let run_command = run_single_command ( & r, action. run_title ) ;
11991199 group. commands . push ( to_command_link ( run_command, r. label . clone ( ) ) ) ;
12001200 }
12011201
12021202 if snap. config . hover . debug {
1203- let hint = r. label . clone ( ) ;
1204- let dbg_command = debug_single_command ( r) ;
1205- group. commands . push ( to_command_link ( dbg_command, hint) ) ;
1203+ let dbg_command = debug_single_command ( & r) ;
1204+ group. commands . push ( to_command_link ( dbg_command, r. label ) ) ;
12061205 }
12071206
12081207 group
@@ -1222,7 +1221,7 @@ fn prepare_hover_actions(
12221221 . iter ( )
12231222 . filter_map ( |it| match it {
12241223 HoverAction :: Implementaion ( position) => show_impl_command_link ( snap, position) ,
1225- HoverAction :: Runnable ( r) => to_runnable_action ( snap, file_id, r) ,
1224+ HoverAction :: Runnable ( r) => to_runnable_action ( snap, file_id, r. clone ( ) ) ,
12261225 } )
12271226 . collect ( )
12281227}
@@ -1232,10 +1231,7 @@ fn should_skip_target(runnable: &Runnable, cargo_spec: Option<&CargoTargetSpec>)
12321231 RunnableKind :: Bin => {
12331232 // Do not suggest binary run on other target than binary
12341233 match & cargo_spec {
1235- Some ( spec) => match spec. target_kind {
1236- TargetKind :: Bin => false ,
1237- _ => true ,
1238- } ,
1234+ Some ( spec) => spec. target_kind != TargetKind :: Bin ,
12391235 None => true ,
12401236 }
12411237 }
0 commit comments