File tree 1 file changed +30
-16
lines changed
1 file changed +30
-16
lines changed Original file line number Diff line number Diff line change @@ -97,24 +97,38 @@ fn main() {
97
97
let kind = target. kind . get ( 0 ) . expect (
98
98
"badly formatted cargo metadata: target::kind is an empty array" ,
99
99
) ;
100
- if test && kind == "test" {
101
- if let Err ( code) = process (
102
- vec ! [ "--test" . to_string( ) , target. name] . into_iter ( ) . chain (
103
- args,
104
- ) ,
105
- )
106
- {
107
- std:: process:: exit ( code) ;
100
+ match ( test, & kind[ ..] ) {
101
+ ( true , "test" ) => {
102
+ if let Err ( code) = process (
103
+ vec ! [ "--test" . to_string( ) , target. name] . into_iter ( ) . chain (
104
+ args,
105
+ ) ,
106
+ )
107
+ {
108
+ std:: process:: exit ( code) ;
109
+ }
108
110
}
109
- } else if !test && kind == "bin" {
110
- if let Err ( code) = process (
111
- vec ! [ "--bin" . to_string( ) , target. name] . into_iter ( ) . chain (
112
- args,
113
- ) ,
114
- )
115
- {
116
- std:: process:: exit ( code) ;
111
+ ( true , "lib" ) => {
112
+ if let Err ( code) = process (
113
+ vec ! [ "--" . to_string( ) , "--test" . to_string( ) ] . into_iter ( ) . chain (
114
+ args,
115
+ ) ,
116
+ )
117
+ {
118
+ std:: process:: exit ( code) ;
119
+ }
117
120
}
121
+ ( false , "bin" ) => {
122
+ if let Err ( code) = process (
123
+ vec ! [ "--bin" . to_string( ) , target. name] . into_iter ( ) . chain (
124
+ args,
125
+ ) ,
126
+ )
127
+ {
128
+ std:: process:: exit ( code) ;
129
+ }
130
+ }
131
+ _ => { }
118
132
}
119
133
}
120
134
} else {
You can’t perform that action at this time.
0 commit comments