From 04abd5ef2fe84761e0ff7ed44bd201caef927e03 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Mon, 16 Jul 2018 19:45:11 +0200 Subject: [PATCH] fix code nits --- src/cargo/ops/cargo_run.rs | 9 ++++----- tests/testsuite/required_features.rs | 5 +++-- tests/testsuite/run.rs | 5 +++-- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/cargo/ops/cargo_run.rs b/src/cargo/ops/cargo_run.rs index f0745d148..aea9a9b19 100644 --- a/src/cargo/ops/cargo_run.rs +++ b/src/cargo/ops/cargo_run.rs @@ -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!( diff --git a/tests/testsuite/required_features.rs b/tests/testsuite/required_features.rs index ed7cb2281..6dba1ad70 100644 --- a/tests/testsuite/required_features.rs +++ b/tests/testsuite/required_features.rs @@ -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", ), ); } diff --git a/tests/testsuite/run.rs b/tests/testsuite/run.rs index 052b3aeda..08736f569 100644 --- a/tests/testsuite/run.rs +++ b/tests/testsuite/run.rs @@ -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", ), ); }