File tree 2 files changed +8
-10
lines changed
2 files changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ pub fn run(
26
26
} ,
27
27
} ;
28
28
29
- let bins: Vec < _ > = pkg. manifest ( )
29
+ let bins: Vec < _ > = pkg. manifest ( )
30
30
. targets ( )
31
31
. iter ( )
32
32
. filter ( |a| {
@@ -48,12 +48,12 @@ let bins: Vec<_> = pkg.manifest()
48
48
}
49
49
50
50
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 ( ..) => {
54
54
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
57
57
)
58
58
} ,
59
59
_ => { }
@@ -62,9 +62,7 @@ let bins: Vec<_> = pkg.manifest()
62
62
63
63
if bins. len ( ) > 1 {
64
64
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 ( ) ;
68
66
bail ! (
69
67
"`cargo run` requires that a project only have one \
70
68
executable; use the `--bin` option to specify which one \
Original file line number Diff line number Diff line change @@ -415,7 +415,7 @@ fn run_library_example() {
415
415
p. cargo ( "run" ) . arg ( "--example" ) . arg ( "bar" ) ,
416
416
execs ( )
417
417
. 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" ) ,
419
419
) ;
420
420
}
421
421
You can’t perform that action at this time.
0 commit comments