6
6
//!
7
7
//! Reference: <https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script>
8
8
9
- use crate :: {
10
- allow_use,
11
- ident:: { is_ascii_ident, is_ident} ,
12
- } ;
9
+ use crate :: ident:: { is_ascii_ident, is_ident} ;
13
10
use std:: { ffi:: OsStr , fmt:: Display , fmt:: Write , path:: Path , str} ;
14
11
15
12
fn emit ( directive : & str , value : impl Display ) {
@@ -309,13 +306,11 @@ pub fn rustc_check_cfgs(keys: &[&str]) {
309
306
}
310
307
}
311
308
312
- if allow_use:: check_cfg ( ) {
313
- let mut directive = keys[ 0 ] . to_string ( ) ;
314
- for key in & keys[ 1 ..] {
315
- write ! ( directive, ", {key}" ) . expect ( "writing to string should be infallible" ) ;
316
- }
317
- emit ( "rustc-check-cfg" , format_args ! ( "cfg({directive})" ) ) ;
309
+ let mut directive = keys[ 0 ] . to_string ( ) ;
310
+ for key in & keys[ 1 ..] {
311
+ write ! ( directive, ", {key}" ) . expect ( "writing to string should be infallible" ) ;
318
312
}
313
+ emit ( "rustc-check-cfg" , format_args ! ( "cfg({directive})" ) ) ;
319
314
}
320
315
321
316
/// Add to the list of expected config names that is used when checking the
@@ -339,17 +334,15 @@ pub fn rustc_check_cfg_values(key: &str, values: &[&str]) {
339
334
return ;
340
335
}
341
336
342
- if allow_use:: check_cfg ( ) {
343
- let mut directive = format ! ( "\" {}\" " , values[ 0 ] . escape_default( ) ) ;
344
- for value in & values[ 1 ..] {
345
- write ! ( directive, ", \" {}\" " , value. escape_default( ) )
346
- . expect ( "writing to string should be infallible" ) ;
347
- }
348
- emit (
349
- "rustc-check-cfg" ,
350
- format_args ! ( "cfg({key}, values({directive}))" ) ,
351
- ) ;
337
+ let mut directive = format ! ( "\" {}\" " , values[ 0 ] . escape_default( ) ) ;
338
+ for value in & values[ 1 ..] {
339
+ write ! ( directive, ", \" {}\" " , value. escape_default( ) )
340
+ . expect ( "writing to string should be infallible" ) ;
352
341
}
342
+ emit (
343
+ "rustc-check-cfg" ,
344
+ format_args ! ( "cfg({key}, values({directive}))" ) ,
345
+ ) ;
353
346
}
354
347
355
348
/// The `rustc-env` instruction tells Cargo to set the given environment variable
0 commit comments