Remove an allocation in min_stack

Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>
This commit is contained in:
Alex Saveau 2023-08-06 11:35:24 +01:00
parent b9068315db
commit af8dfde7f9
No known key found for this signature in database
GPG Key ID: 3F8D5B16EB169D48

View File

@ -8,7 +8,7 @@ pub fn min_stack() -> usize {
0 => {} 0 => {}
n => return n - 1, n => return n - 1,
} }
let amt = env::var("RUST_MIN_STACK").ok().and_then(|s| s.parse().ok()); let amt = env::var_os("RUST_MIN_STACK").and_then(|s| s.to_str().and_then(|s| s.parse().ok()));
let amt = amt.unwrap_or(imp::DEFAULT_MIN_STACK_SIZE); let amt = amt.unwrap_or(imp::DEFAULT_MIN_STACK_SIZE);
// 0 is our sentinel value, so ensure that we'll never see 0 after // 0 is our sentinel value, so ensure that we'll never see 0 after