summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Brandt <johnb0@outlook.com>2021-03-26 15:13:21 -0600
committerJohn Brandt <johnb0@outlook.com>2021-05-04 10:31:53 -0600
commit2048c033bbccaa5398c5db3b2b2589e34a614015 (patch)
tree832172e642f7de494cc88d1740b4afb48aada721
parentab8d0064cb1cabe930d7f91e3f1194696f2e1f06 (diff)
clearer env bool parse if
-rw-r--r--src/env.rs7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/env.rs b/src/env.rs
index 6e5ad25..5f6491b 100644
--- a/src/env.rs
+++ b/src/env.rs
@@ -127,12 +127,11 @@ impl Source for Environment {
let value = if self.try_parsing {
let string_value = Value::new(Some(&uri), ValueKind::String(value.clone()));
+ let is_true_false =
+ value.to_lowercase() == "true" || value.to_lowercase() == "false";
// if the value is "true" or "false" it should be parsed as a bool
- if let (true, Ok(parsed)) = (
- value.to_lowercase() == "true" || value.to_lowercase() == "false",
- string_value.clone().into_bool(),
- ) {
+ if let (true, Ok(parsed)) = (is_true_false, string_value.clone().into_bool()) {
ValueKind::Boolean(parsed)
} else if let Ok(parsed) = string_value.clone().into_int() {
ValueKind::Integer(parsed)