Skip to content

Commit

Permalink
Sort available binaries when multiple
Browse files Browse the repository at this point in the history
From:
```
error: `cargo run` could not determine which binary to run. Use the `--bin` option to specify a binary, or the `default-run` manifest key.
available binaries: basic-tutorial-13, basic-tutorial-6, basic-tutorial-1, basic-tutorial-4, basic-tutorial-9, basic-tutorial-2, basic-tutorial-3, basic-tutorial-5, basic-tutorial-12, playback-tutorial-4, basic-tutorial-8, basic-tutorial-7
```

To:
```
error: `cargo run` could not determine which binary to run. Use the `--bin` option to specify a binary, or the `default-run` manifest key.
available binaries: basic-tutorial-1, basic-tutorial-12, basic-tutorial-13, basic-tutorial-2, basic-tutorial-3, basic-tutorial-4, basic-tutorial-5, basic-tutorial-6, basic-tutorial-7, basic-tutorial-8, basic-tutorial-9, playback-tutorial-4
```
  • Loading branch information
rubenrua committed Jan 12, 2021
1 parent 89dcb2a commit 14979f6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/cargo/ops/cargo_run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,11 @@ pub fn run(

if bins.len() > 1 {
if !options.filter.is_specific() {
let names: Vec<&str> = bins
let mut names: Vec<&str> = bins
.into_iter()
.map(|(_pkg, target)| target.name())
.collect();
names.sort();
anyhow::bail!(
"`cargo run` could not determine which binary to run. \
Use the `--bin` option to specify a binary, \
Expand Down

0 comments on commit 14979f6

Please sign in to comment.