Open
Description
Problem
This is somewhat related to what #10958 requests, but the target and use-case are different.
I need to run the unit tests in several workspaces. The only way I am aware of that can achieve this is via
cargo test --bins --lib
The problem is that I am running this command over arbitrary-structured workspaces that may have 0 or more binaries and 0 or more libraries within them. The scenarios boil down to the 3 cases below:
- 0 bins, 1+ libs:
cargo test
completes with a warning - 1+bins, 1+libs:
cargo test
completes - 1+bins, 0 libs:
cargo test
fails
If there are 0 binaries, then the command completes with a warning, but if there are no libs in the workspace it will fail with the following error:
error: no library targets found in packages: bin1, bin2
Proposed Solution
I think there are two options here:
- Modify
--lib
to warn instead of error when no libraries are present. - Introduce a
--libs
argument that warns when no libraries are present. This would keep the behaviour of--lib
intact.
I would be happy to implement the change myself.
Notes
No response
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
No status