Skip to content

Commit a7f23d9

Browse files
committed
Make the test function smaller
1 parent c5fc531 commit a7f23d9

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

crates/std_detect/src/detect/cache.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -160,20 +160,19 @@ impl Cache {
160160
}
161161
cfg_if! {
162162
if #[cfg(feature = "std_detect_env_override")] {
163-
fn env_override(mut value: Initializer) -> Initializer {
163+
#[inline(never)]
164+
fn initialize(mut value: Initializer) {
164165
if let Ok(disable) = crate::env::var("RUST_STD_DETECT_UNSTABLE") {
165166
for v in disable.split(" ") {
166167
let _ = super::Feature::from_str(v).map(|v| value.unset(v as u32));
167168
}
168-
value
169-
} else {
170-
value
171169
}
170+
CACHE.initialize(value);
172171
}
173172
} else {
174173
#[inline]
175-
fn env_override(value: Initializer) -> Initializer {
176-
value
174+
fn initialize(value: Initializer) {
175+
CACHE.initialize(value);
177176
}
178177
}
179178
}
@@ -197,7 +196,7 @@ where
197196
F: FnOnce() -> Initializer,
198197
{
199198
if CACHE.is_uninitialized() {
200-
CACHE.initialize(env_override(f()));
199+
initialize(f());
201200
}
202201
CACHE.test(bit)
203202
}

0 commit comments

Comments
 (0)