fix code nits

This commit is contained in:
Ralf Jung 2018-07-16 19:45:11 +02:00
parent 579e0348d7
commit 04abd5ef2f
3 changed files with 10 additions and 9 deletions

View File

@ -32,8 +32,7 @@ pub fn run(
if bins.is_empty() {
if !options.filter.is_specific() {
bail!("a bin target must be available for `cargo run`")
}
else {
} else {
// this will be verified in cargo_compile
}
}
@ -55,10 +54,10 @@ pub fn run(
if !options.filter.is_specific() {
let names: Vec<&str> = bins.into_iter().map(|bin| bin.0).collect();
bail!(
"`cargo run` could not determine which binary to run; set `default-run` \
in the manifest or use the `--bin` option to specify\navailable binaries: {}",
"`cargo run` requires that a project only have one \
executable; use the `--bin` option to specify which one \
to run\navailable binaries: {}",
names.join(", ")
)
} else {
bail!(

View File

@ -1347,8 +1347,9 @@ fn run_default_multiple_required_features() {
assert_that(
p.cargo("run"),
execs().with_status(101).with_stderr(
"error: `cargo run` could not determine which binary to run; set `default-run` \
in the manifest or use the `--bin` option to specify\navailable binaries: foo1, foo2",
"\
error: `cargo run` requires that a project only have one executable; \
use the `--bin` option to specify which one to run\navailable binaries: foo1, foo2",
),
);
}

View File

@ -277,8 +277,9 @@ fn too_many_bins() {
p.cargo("run"),
// Using [..] here because the order is not stable
execs().with_status(101).with_stderr(
"[ERROR] `cargo run` could not determine which binary to run; set `default-run` \
in the manifest or use the `--bin` option to specify\navailable binaries: [..]\n",
"[ERROR] `cargo run` requires that a project only \
have one executable; use the `--bin` option \
to specify which one to run\navailable binaries: [..]\n",
),
);
}