Unnamed repository; edit this file 'description' to name the repository.
fix: show Run lens for fn main in bench targets
`request.rs` was passing `binary_target = true` for
TargetKind::Bin, Example, and Test, but not for Bench, so a
`fn main()` in `benches/foo.rs` (typical with
`harness = false`) was suppressed by `should_skip_runnable`
in the annotations layer. Mirror `target_spec.rs:255` by
including Bench in both the code-lens config check and
`should_skip_target`.
Closes rust-lang/rust-analyzer#21948.
Signed-off-by: Onyeka Obi <[email protected]>
| -rw-r--r-- | crates/rust-analyzer/src/handlers/request.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/crates/rust-analyzer/src/handlers/request.rs b/crates/rust-analyzer/src/handlers/request.rs index ca6a2e70b0..5bc0f5f0a7 100644 --- a/crates/rust-analyzer/src/handlers/request.rs +++ b/crates/rust-analyzer/src/handlers/request.rs @@ -1662,7 +1662,10 @@ pub(crate) fn handle_code_lens( .map(|spec| { matches!( spec.target_kind(), - TargetKind::Bin | TargetKind::Example | TargetKind::Test + TargetKind::Bin + | TargetKind::Example + | TargetKind::Test + | TargetKind::Bench ) }) .unwrap_or(false), @@ -2345,7 +2348,7 @@ fn should_skip_target(runnable: &Runnable, cargo_spec: Option<&TargetSpec>) -> b match &cargo_spec { Some(spec) => !matches!( spec.target_kind(), - TargetKind::Bin | TargetKind::Example | TargetKind::Test + TargetKind::Bin | TargetKind::Example | TargetKind::Test | TargetKind::Bench ), None => true, } |