Skip to content

Commit 8da2908

Browse files
Made adjustments based on feedback from review.
1 parent 5b49778 commit 8da2908

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

src/cargo/ops/cargo_run.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pub fn run(
2626
},
2727
};
2828

29-
let bins: Vec<_> = pkg.manifest()
29+
let bins: Vec<_> = pkg.manifest()
3030
.targets()
3131
.iter()
3232
.filter(|a| {
@@ -48,12 +48,12 @@ let bins: Vec<_> = pkg.manifest()
4848
}
4949

5050
if bins.len() == 1 {
51-
let bin = bins.first().unwrap();
52-
match *bin.1 {
53-
TargetKind::ExampleLib(..) => {
51+
let &(name, kind) = bins.first().unwrap();
52+
match kind {
53+
&TargetKind::ExampleLib(..) => {
5454
bail!(
55-
"example target `{}` is a library and cannot be executed.",
56-
bin.0
55+
"example target `{}` is a library and cannot be executed",
56+
name
5757
)
5858
},
5959
_ => { }
@@ -62,9 +62,7 @@ let bins: Vec<_> = pkg.manifest()
6262

6363
if bins.len() > 1 {
6464
if !options.filter.is_specific() {
65-
66-
let names : Vec<&str> = bins.into_iter().map(|bin| bin.0).collect();
67-
65+
let names: Vec<&str> = bins.into_iter().map(|bin| bin.0).collect();
6866
bail!(
6967
"`cargo run` requires that a project only have one \
7068
executable; use the `--bin` option to specify which one \

tests/testsuite/run.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ fn run_library_example() {
415415
p.cargo("run").arg("--example").arg("bar"),
416416
execs()
417417
.with_status(101)
418-
.with_stderr("[ERROR] example target `bar` is a library and cannot be executed."),
418+
.with_stderr("[ERROR] example target `bar` is a library and cannot be executed"),
419419
);
420420
}
421421

0 commit comments

Comments
 (0)