@@ -86,7 +86,7 @@ fn main() {
8686 . flat_map ( |combination_length| lib_features. iter ( ) . combinations ( combination_length) )
8787 . map ( |combination| String :: from ( "--features=" ) + & combination. iter ( ) . join ( "," ) ) ;
8888
89- let default_feature_options = [ "--no-default-features" , "--all-features" ] ;
89+ let default_feature_options = [ "" , " --no-default-features", "--all-features" ] ;
9090 let all_features_options = default_feature_options
9191 . iter ( )
9292 . map ( |str| str. to_string ( ) )
@@ -103,13 +103,27 @@ fn main() {
103103 if what_to_run. contains ( Check :: CLIPPY ) {
104104 // See if clippy has any complaints.
105105 // --all-targets was removed because Emergence currently has no special targets;
106- // please add them back as necessary
107- cmd ! (
108- sh,
109- "cargo clippy --workspace {feature_option} {extra...} -- {CLIPPY_FLAGS...}"
110- )
111- . run ( )
112- . expect ( "Please fix clippy errors in output above." ) ;
106+ // please add them back as
107+
108+ // We have to do this check because if the feature_option is empty (default-features) and there
109+ // and there is no extra, the command chokes on the last argument (feature_option) being empty
110+ // extra doesn't trigger this because it is an array and the logic for handling a split empty
111+ // array is not the same as an empty string
112+ if feature_option. is_empty ( ) {
113+ cmd ! (
114+ sh,
115+ "cargo clippy --workspace {extra...} -- {CLIPPY_FLAGS...}"
116+ )
117+ . run ( )
118+ . expect ( "Please fix clippy errors in output above." ) ;
119+ } else {
120+ cmd ! (
121+ sh,
122+ "cargo clippy --workspace {feature_option} {extra...} -- {CLIPPY_FLAGS...}"
123+ )
124+ . run ( )
125+ . expect ( "Please fix clippy errors in output above." ) ;
126+ }
113127 }
114128
115129 if what_to_run. contains ( Check :: TEST ) {
@@ -140,9 +154,19 @@ fn main() {
140154 }
141155
142156 if what_to_run. contains ( Check :: COMPILE_CHECK ) {
143- cmd ! ( sh, "cargo check --workspace {feature_option} {extra...}" )
144- . run ( )
145- . expect ( "Please fix compiler errors in above output." ) ;
157+ // We have to do this check because if the feature_option is empty (default-features) and there
158+ // and there is no extra, the command chokes on the last argument (feature_option) being empty
159+ // extra doesn't trigger this because it is an array and the logic for handling a split empty
160+ // array is not the same as an empty string
161+ if feature_option. is_empty ( ) {
162+ cmd ! ( sh, "cargo check --workspace {extra...}" )
163+ . run ( )
164+ . expect ( "Please fix compiler errors in above output." ) ;
165+ } else {
166+ cmd ! ( sh, "cargo check --workspace {feature_option} {extra...}" )
167+ . run ( )
168+ . expect ( "Please fix compiler errors in above output." ) ;
169+ }
146170 }
147171 }
148172}
0 commit comments