},
};
-let bins: Vec<_> = pkg.manifest()
+ let bins: Vec<_> = pkg.manifest()
.targets()
.iter()
.filter(|a| {
}
if bins.len() == 1 {
- let bin = bins.first().unwrap();
- match *bin.1 {
- TargetKind::ExampleLib(..) => {
+ let &(name, kind) = bins.first().unwrap();
+ match kind {
+ &TargetKind::ExampleLib(..) => {
bail!(
- "example target `{}` is a library and cannot be executed.",
- bin.0
+ "example target `{}` is a library and cannot be executed",
+ name
)
},
_ => { }
if bins.len() > 1 {
if !options.filter.is_specific() {
-
- let names : Vec<&str> = bins.into_iter().map(|bin| bin.0).collect();
-
+ let names: Vec<&str> = bins.into_iter().map(|bin| bin.0).collect();
bail!(
"`cargo run` requires that a project only have one \
executable; use the `--bin` option to specify which one \
p.cargo("run").arg("--example").arg("bar"),
execs()
.with_status(101)
- .with_stderr("[ERROR] example target `bar` is a library and cannot be executed."),
+ .with_stderr("[ERROR] example target `bar` is a library and cannot be executed"),
);
}