diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/rust-analyzer/src/cargo_target_spec.rs | 6 | ||||
-rw-r--r-- | crates/rust-analyzer/src/handlers.rs | 5 |
2 files changed, 9 insertions, 2 deletions
diff --git a/crates/rust-analyzer/src/cargo_target_spec.rs b/crates/rust-analyzer/src/cargo_target_spec.rs index 3041915e1..ddc028148 100644 --- a/crates/rust-analyzer/src/cargo_target_spec.rs +++ b/crates/rust-analyzer/src/cargo_target_spec.rs | |||
@@ -72,7 +72,11 @@ impl CargoTargetSpec { | |||
72 | extra_args.push("--nocapture".to_string()); | 72 | extra_args.push("--nocapture".to_string()); |
73 | } | 73 | } |
74 | RunnableKind::Bin => { | 74 | RunnableKind::Bin => { |
75 | args.push("run".to_string()); | 75 | let subcommand = match spec { |
76 | Some(CargoTargetSpec { target_kind: TargetKind::Test, .. }) => "test", | ||
77 | _ => "run", | ||
78 | }; | ||
79 | args.push(subcommand.to_string()); | ||
76 | if let Some(spec) = spec { | 80 | if let Some(spec) = spec { |
77 | spec.push_to(&mut args, kind); | 81 | spec.push_to(&mut args, kind); |
78 | } | 82 | } |
diff --git a/crates/rust-analyzer/src/handlers.rs b/crates/rust-analyzer/src/handlers.rs index 33e60b500..8568f7b05 100644 --- a/crates/rust-analyzer/src/handlers.rs +++ b/crates/rust-analyzer/src/handlers.rs | |||
@@ -1399,7 +1399,10 @@ fn should_skip_target(runnable: &Runnable, cargo_spec: Option<&CargoTargetSpec>) | |||
1399 | RunnableKind::Bin => { | 1399 | RunnableKind::Bin => { |
1400 | // Do not suggest binary run on other target than binary | 1400 | // Do not suggest binary run on other target than binary |
1401 | match &cargo_spec { | 1401 | match &cargo_spec { |
1402 | Some(spec) => !matches!(spec.target_kind, TargetKind::Bin | TargetKind::Example), | 1402 | Some(spec) => !matches!( |
1403 | spec.target_kind, | ||
1404 | TargetKind::Bin | TargetKind::Example | TargetKind::Test | ||
1405 | ), | ||
1403 | None => true, | 1406 | None => true, |
1404 | } | 1407 | } |
1405 | } | 1408 | } |