@@ -95,9 +95,8 @@ struct Opts {
95
95
#[ clap(
96
96
long,
97
97
help = "Host triple for the compiler" ,
98
- default_value_t = option_env!( "HOST" ) . unwrap_or( "unkown" ) . to_string( ) ,
99
- validator = validate_host
100
- ) ]
98
+ default_value = env!( "HOST" ) ,
99
+ ) ]
101
100
host : String ,
102
101
103
102
#[ clap( long, help = "Cross-compilation target platform" ) ]
@@ -177,8 +176,7 @@ a date (YYYY-MM-DD), git tag name (e.g. 1.58.0) or git commit SHA."
177
176
#[ clap(
178
177
long,
179
178
help = "Script replacement for `cargo build` command" ,
180
- parse( from_os_str) ,
181
- validator = validate_file,
179
+ parse( from_os_str)
182
180
) ]
183
181
script : Option < PathBuf > ,
184
182
@@ -200,25 +198,6 @@ fn validate_dir(s: &str) -> anyhow::Result<()> {
200
198
}
201
199
}
202
200
203
- fn validate_file ( s : & str ) -> anyhow:: Result < ( ) > {
204
- let path: PathBuf = s. parse ( ) ?;
205
- if path. is_file ( ) {
206
- Ok ( ( ) )
207
- } else {
208
- bail ! ( "{} is not an existing file" , path. canonicalize( ) ?. display( ) )
209
- }
210
- }
211
-
212
- fn validate_host ( s : & str ) -> anyhow:: Result < ( ) > {
213
- if s == "unknown" {
214
- bail ! (
215
- "Failed to auto-detect host triple and was not specified. Please provide it via --host"
216
- )
217
- } else {
218
- Ok ( ( ) )
219
- }
220
- }
221
-
222
201
#[ derive( Clone , Debug ) ]
223
202
enum Bound {
224
203
Commit ( String ) ,
@@ -1289,16 +1268,4 @@ mod tests {
1289
1268
validate_dir( main) . unwrap_err( )
1290
1269
)
1291
1270
}
1292
-
1293
- #[ test]
1294
- fn test_validate_file ( ) {
1295
- let current_dir = "." ;
1296
- assert ! ( validate_file( current_dir) . is_err( ) ) ;
1297
- let main = "src/main.rs" ;
1298
- assert ! (
1299
- validate_file( main) . is_ok( ) ,
1300
- "{}" ,
1301
- validate_dir( main) . unwrap_err( )
1302
- )
1303
- }
1304
1271
}
0 commit comments