@@ -27,7 +27,7 @@ macro_rules! invalid {
27
27
}
28
28
29
29
#[ track_caller]
30
- fn get_bool ( key : & str ) -> bool {
30
+ fn is_present ( key : & str ) -> bool {
31
31
env:: var_os ( key) . is_some ( )
32
32
}
33
33
@@ -135,7 +135,7 @@ pub fn cargo_feature(name: &str) -> bool {
135
135
}
136
136
let name = name. to_uppercase ( ) . replace ( '-' , "_" ) ;
137
137
let key = format ! ( "CARGO_FEATURE_{name}" ) ;
138
- get_bool ( & key)
138
+ is_present ( & key)
139
139
}
140
140
141
141
/// For each [configuration option] of the package being built, this will contain
@@ -162,31 +162,31 @@ mod cfg {
162
162
#[ cfg( any( ) ) ]
163
163
#[ track_caller]
164
164
pub fn cargo_cfg_clippy ( ) -> bool {
165
- get_bool ( "CARGO_CFG_CLIPPY" )
165
+ is_present ( "CARGO_CFG_CLIPPY" )
166
166
}
167
167
168
168
/// If we are compiling with debug assertions enabled.
169
169
#[ track_caller]
170
170
pub fn cargo_cfg_debug_assertions ( ) -> bool {
171
- get_bool ( "CARGO_CFG_DEBUG_ASSERTIONS" )
171
+ is_present ( "CARGO_CFG_DEBUG_ASSERTIONS" )
172
172
}
173
173
174
174
#[ cfg( any( ) ) ]
175
175
#[ track_caller]
176
176
pub fn cargo_cfg_doc ( ) -> bool {
177
- get_bool ( "CARGO_CFG_DOC" )
177
+ is_present ( "CARGO_CFG_DOC" )
178
178
}
179
179
180
180
#[ cfg( any( ) ) ]
181
181
#[ track_caller]
182
182
pub fn cargo_cfg_docsrs ( ) -> bool {
183
- get_bool ( "CARGO_CFG_DOCSRS" )
183
+ is_present ( "CARGO_CFG_DOCSRS" )
184
184
}
185
185
186
186
#[ cfg( any( ) ) ]
187
187
#[ track_caller]
188
188
pub fn cargo_cfg_doctest ( ) -> bool {
189
- get_bool ( "CARGO_CFG_DOCTEST" )
189
+ is_present ( "CARGO_CFG_DOCTEST" )
190
190
}
191
191
192
192
/// The level of detail provided by derived [`Debug`] implementations.
@@ -200,15 +200,15 @@ mod cfg {
200
200
#[ cfg( any( ) ) ]
201
201
#[ track_caller]
202
202
pub fn cargo_cfg_miri ( ) -> bool {
203
- get_bool ( "CARGO_CFG_MIRI" )
203
+ is_present ( "CARGO_CFG_MIRI" )
204
204
}
205
205
206
206
/// If we are compiling with overflow checks enabled.
207
207
#[ doc = unstable ! ( cfg_overflow_checks, 111466 ) ]
208
208
#[ cfg( feature = "unstable" ) ]
209
209
#[ track_caller]
210
210
pub fn cargo_cfg_overflow_checks ( ) -> bool {
211
- get_bool ( "CARGO_CFG_OVERFLOW_CHECKS" )
211
+ is_present ( "CARGO_CFG_OVERFLOW_CHECKS" )
212
212
}
213
213
214
214
/// The [panic strategy](https://doc.rust-lang.org/stable/reference/conditional-compilation.html#panic).
@@ -220,7 +220,7 @@ mod cfg {
220
220
/// If the crate is being compiled as a procedural macro.
221
221
#[ track_caller]
222
222
pub fn cargo_cfg_proc_macro ( ) -> bool {
223
- get_bool ( "CARGO_CFG_PROC_MACRO" )
223
+ is_present ( "CARGO_CFG_PROC_MACRO" )
224
224
}
225
225
226
226
/// The target relocation model.
@@ -234,7 +234,7 @@ mod cfg {
234
234
#[ cfg( any( ) ) ]
235
235
#[ track_caller]
236
236
pub fn cargo_cfg_rustfmt ( ) -> bool {
237
- get_bool ( "CARGO_CFG_RUSTFMT" )
237
+ is_present ( "CARGO_CFG_RUSTFMT" )
238
238
}
239
239
240
240
/// Sanitizers enabled for the crate being compiled.
@@ -251,15 +251,15 @@ mod cfg {
251
251
#[ cfg( feature = "unstable" ) ]
252
252
#[ track_caller]
253
253
pub fn cargo_cfg_sanitizer_cfi_generalize_pointers ( ) -> bool {
254
- get_bool ( "CARGO_CFG_SANITIZER_CFI_GENERALIZE_POINTERS" )
254
+ is_present ( "CARGO_CFG_SANITIZER_CFI_GENERALIZE_POINTERS" )
255
255
}
256
256
257
257
/// If CFI sanitization is normalizing integers.
258
258
#[ doc = unstable ! ( cfg_sanitizer_cfi, 89653 ) ]
259
259
#[ cfg( feature = "unstable" ) ]
260
260
#[ track_caller]
261
261
pub fn cargo_cfg_sanitizer_cfi_normalize_integers ( ) -> bool {
262
- get_bool ( "CARGO_CFG_SANITIZER_CFI_NORMALIZE_INTEGERS" )
262
+ is_present ( "CARGO_CFG_SANITIZER_CFI_NORMALIZE_INTEGERS" )
263
263
}
264
264
265
265
/// Disambiguation of the [target ABI](https://doc.rust-lang.org/stable/reference/conditional-compilation.html#target_abi)
@@ -349,7 +349,7 @@ mod cfg {
349
349
#[ cfg( feature = "unstable" ) ]
350
350
#[ track_caller]
351
351
pub fn cargo_cfg_target_thread_local ( ) -> bool {
352
- get_bool ( "CARGO_CFG_TARGET_THREAD_LOCAL" )
352
+ is_present ( "CARGO_CFG_TARGET_THREAD_LOCAL" )
353
353
}
354
354
355
355
/// The [target vendor](https://doc.rust-lang.org/stable/reference/conditional-compilation.html#target_vendor).
@@ -361,27 +361,27 @@ mod cfg {
361
361
#[ cfg( any( ) ) ]
362
362
#[ track_caller]
363
363
pub fn cargo_cfg_test ( ) -> bool {
364
- get_bool ( "CARGO_CFG_TEST" )
364
+ is_present ( "CARGO_CFG_TEST" )
365
365
}
366
366
367
367
/// If we are compiling with UB checks enabled.
368
368
#[ doc = unstable ! ( cfg_ub_checks, 123499 ) ]
369
369
#[ cfg( feature = "unstable" ) ]
370
370
#[ track_caller]
371
371
pub fn cargo_cfg_ub_checks ( ) -> bool {
372
- get_bool ( "CARGO_CFG_UB_CHECKS" )
372
+ is_present ( "CARGO_CFG_UB_CHECKS" )
373
373
}
374
374
375
375
/// Set on [unix-like platforms](https://doc.rust-lang.org/stable/reference/conditional-compilation.html#unix-and-windows).
376
376
#[ track_caller]
377
377
pub fn cargo_cfg_unix ( ) -> bool {
378
- get_bool ( "CARGO_CFG_UNIX" )
378
+ is_present ( "CARGO_CFG_UNIX" )
379
379
}
380
380
381
381
/// Set on [windows-like platforms](https://doc.rust-lang.org/stable/reference/conditional-compilation.html#unix-and-windows).
382
382
#[ track_caller]
383
383
pub fn cargo_cfg_windows ( ) -> bool {
384
- get_bool ( "CARGO_CFG_WINDOWS" )
384
+ is_present ( "CARGO_CFG_WINDOWS" )
385
385
}
386
386
}
387
387
0 commit comments