about summary refs log tree commit diff
path: root/src/test/mir-opt/lower_array_len.array_len.SimplifyLocals.diff
diff options
context:
space:
mode:
authorDorian Scheidt <dorian.scheidt@gmail.com>2022-08-17 11:57:14 -0500
committerDorian Scheidt <dorian.scheidt@gmail.com>2022-08-17 12:26:07 -0500
commit85b9568e2d7cc3c4b9a9d420ab3d4b91037bc6a5 (patch)
tree48d48e7ab3525addccd860e7551b1987e83bb90e /src/test/mir-opt/lower_array_len.array_len.SimplifyLocals.diff
parentbaa2cccb24023a246d4258b08ff4064c9169e67e (diff)
downloadrust-85b9568e2d7cc3c4b9a9d420ab3d4b91037bc6a5.tar.gz
rust-85b9568e2d7cc3c4b9a9d420ab3d4b91037bc6a5.zip
feat: Run test mod from anywhere in parent file
The "Run" feature of rust-analyzer is super useful, especially for running
individual tests or test-modules during development.

One common pattern in rust development is to develop tests in the same file as
production code, inside a module (usually called `test` or `tests`) marked with
`#[cfg(test)]`.  Unforunately, this pattern is not well supported by r-a today,
as a test module won't show up as a runnable unless the cursor is inside it.

In my experience, it is quite common to want to run the tests associated with
some production code immediately after editing it, not only after editing the
tests themselves. As such it would be better if test modules were available
from the "Run" menu even when the cursor is outside the test module.

This change updates the filtration logic for runnables in
`handlers::handle_runnables` to special case `RunnableKind::TestMod`, making
test modules available regardless of the cursor location. Other `RunnableKind`s
are unnaffected.

Fixes #9589
Diffstat (limited to 'src/test/mir-opt/lower_array_len.array_len.SimplifyLocals.diff')
0 files changed, 0 insertions, 0 deletions