summaryrefslogtreecommitdiffstats
path: root/src/env.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/env.rs')
-rw-r--r--src/env.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/env.rs b/src/env.rs
index 0a988f9a..9792355b 100644
--- a/src/env.rs
+++ b/src/env.rs
@@ -3,7 +3,7 @@ use std::env;
/// If `name` is set and, after trimming whitespace, is not empty string, then return that trimmed
/// string. Else None.
pub fn get_env_var(name: &str) -> Option<String> {
- match env::var(name).unwrap_or("".to_string()).trim() {
+ match env::var(name).unwrap_or_else(|_| "".to_string()).trim() {
"" => None,
non_empty_string => Some(non_empty_string.to_string()),
}