66//!
77//! Reference: <https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script>
88
9- use crate :: {
10- allow_use,
11- ident:: { is_ascii_ident, is_ident} ,
12- } ;
9+ use crate :: ident:: { is_ascii_ident, is_ident} ;
1310use std:: { ffi:: OsStr , fmt:: Display , fmt:: Write , path:: Path , str} ;
1411
1512fn emit ( directive : & str , value : impl Display ) {
@@ -309,13 +306,11 @@ pub fn rustc_check_cfgs(keys: &[&str]) {
309306 }
310307 }
311308
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" ) ;
318312 }
313+ emit ( "rustc-check-cfg" , format_args ! ( "cfg({directive})" ) ) ;
319314}
320315
321316/// 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]) {
339334 return ;
340335 }
341336
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" ) ;
352341 }
342+ emit (
343+ "rustc-check-cfg" ,
344+ format_args ! ( "cfg({key}, values({directive}))" ) ,
345+ ) ;
353346}
354347
355348/// The `rustc-env` instruction tells Cargo to set the given environment variable
0 commit comments