From b6740060f60fa016ac1c3d420c9ac919d31f6997 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 18 Feb 2020 12:15:12 +0100 Subject: Refactor --- crates/ra_lsp_server/src/cargo_target_spec.rs | 4 +--- crates/ra_lsp_server/src/main_loop/handlers.rs | 3 ++- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'crates') diff --git a/crates/ra_lsp_server/src/cargo_target_spec.rs b/crates/ra_lsp_server/src/cargo_target_spec.rs index 5fd1e7b6b..56d3f0de4 100644 --- a/crates/ra_lsp_server/src/cargo_target_spec.rs +++ b/crates/ra_lsp_server/src/cargo_target_spec.rs @@ -6,11 +6,9 @@ use ra_project_model::{self, ProjectWorkspace, TargetKind}; use crate::{world::WorldSnapshot, Result}; pub(crate) fn runnable_args( - world: &WorldSnapshot, - file_id: FileId, + spec: Option, kind: &RunnableKind, ) -> Result> { - let spec = CargoTargetSpec::for_file(world, file_id)?; let mut res = Vec::new(); match kind { RunnableKind::Test { test_id } => { diff --git a/crates/ra_lsp_server/src/main_loop/handlers.rs b/crates/ra_lsp_server/src/main_loop/handlers.rs index ae51141cb..833f31d96 100644 --- a/crates/ra_lsp_server/src/main_loop/handlers.rs +++ b/crates/ra_lsp_server/src/main_loop/handlers.rs @@ -921,7 +921,8 @@ fn to_lsp_runnable( file_id: FileId, runnable: Runnable, ) -> Result { - let args = runnable_args(world, file_id, &runnable.kind)?; + let spec: Option = CargoTargetSpec::for_file(world, file_id)?; + let args = runnable_args(spec, &runnable.kind)?; let line_index = world.analysis().file_line_index(file_id)?; let label = match &runnable.kind { RunnableKind::Test { test_id } => format!("test {}", test_id), -- cgit v1.2.3