From af8dfde7f952ac35192bfcea0c665d669237cd97 Mon Sep 17 00:00:00 2001 From: Alex Saveau Date: Sun, 6 Aug 2023 11:35:24 +0100 Subject: [PATCH] Remove an allocation in min_stack Signed-off-by: Alex Saveau --- library/std/src/sys_common/thread.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/std/src/sys_common/thread.rs b/library/std/src/sys_common/thread.rs index 76466b2b37beb..8f5624bbce9da 100644 --- a/library/std/src/sys_common/thread.rs +++ b/library/std/src/sys_common/thread.rs @@ -8,7 +8,7 @@ pub fn min_stack() -> usize { 0 => {} 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); // 0 is our sentinel value, so ensure that we'll never see 0 after