Right now I have a Cargo workspace with three members.
[workspace]
members = [
"foo",
"bar",
"baz",
]
If I run cargo run
in the root directory, I get this error:
error: manifest path
/home/lukas/dev/mahboi/Cargo.toml
is a virtual manifest, but this command requires running against an actual package in this workspace
That makes sense. I can run cargo run -p foo
and it works. But the thing is: foo
is the only crate that is executable and I will execute it very often, so it would be nice if I could just run cargo run
and execute it.
I tried to use the default-members
key, but this didn't help:
default-members = ["foo"]
Is there another way to tell Cargo that cargo run
should execute the foo
crate (equivalent to running cargo run
in the foo/
subdirectory)? I would also accept answers that make the root crate non virtual (i.e. add a [package]
key).