Skip to content

Commit 04abd5e

Browse files
committed
fix code nits
1 parent 579e034 commit 04abd5e

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

src/cargo/ops/cargo_run.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ pub fn run(
3232
if bins.is_empty() {
3333
if !options.filter.is_specific() {
3434
bail!("a bin target must be available for `cargo run`")
35-
}
36-
else {
35+
} else {
3736
// this will be verified in cargo_compile
3837
}
3938
}
@@ -55,10 +54,10 @@ pub fn run(
5554
if !options.filter.is_specific() {
5655
let names: Vec<&str> = bins.into_iter().map(|bin| bin.0).collect();
5756
bail!(
58-
"`cargo run` could not determine which binary to run; set `default-run` \
59-
in the manifest or use the `--bin` option to specify\navailable binaries: {}",
57+
"`cargo run` requires that a project only have one \
58+
executable; use the `--bin` option to specify which one \
59+
to run\navailable binaries: {}",
6060
names.join(", ")
61-
6261
)
6362
} else {
6463
bail!(

tests/testsuite/required_features.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1347,8 +1347,9 @@ fn run_default_multiple_required_features() {
13471347
assert_that(
13481348
p.cargo("run"),
13491349
execs().with_status(101).with_stderr(
1350-
"error: `cargo run` could not determine which binary to run; set `default-run` \
1351-
in the manifest or use the `--bin` option to specify\navailable binaries: foo1, foo2",
1350+
"\
1351+
error: `cargo run` requires that a project only have one executable; \
1352+
use the `--bin` option to specify which one to run\navailable binaries: foo1, foo2",
13521353
),
13531354
);
13541355
}

tests/testsuite/run.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,9 @@ fn too_many_bins() {
277277
p.cargo("run"),
278278
// Using [..] here because the order is not stable
279279
execs().with_status(101).with_stderr(
280-
"[ERROR] `cargo run` could not determine which binary to run; set `default-run` \
281-
in the manifest or use the `--bin` option to specify\navailable binaries: [..]\n",
280+
"[ERROR] `cargo run` requires that a project only \
281+
have one executable; use the `--bin` option \
282+
to specify which one to run\navailable binaries: [..]\n",
282283
),
283284
);
284285
}

0 commit comments

Comments
 (0)