summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2022-11-07 17:47:29 +0100
committerGitHub <noreply@github.com>2022-11-07 17:47:29 +0100
commit03614aa6e47c9754b65c28be661de63e7d701df3 (patch)
treed66634ee824533fb13a7e6affa77a84b8c581912
parent807e3c1b8080cc697ed46e8e5720e879744858b0 (diff)
parenta73dc372e7eaa21c8d177e73e58d91245d8812b4 (diff)
Merge pull request #393 from matthiasbeyer/more-clippy-fixes
More clippy fixes
-rw-r--r--src/env.rs2
-rw-r--r--src/value.rs8
2 files changed, 5 insertions, 5 deletions
diff --git a/src/env.rs b/src/env.rs
index 9302903..f1d3000 100644
--- a/src/env.rs
+++ b/src/env.rs
@@ -140,7 +140,7 @@ impl Environment {
/// Once list_separator is set, the type for string is [`Vec<String>`].
/// To switch the default type back to type Strings you need to provide the keys which should be [`Vec<String>`] using this function.
pub fn with_list_parse_key(mut self, key: &str) -> Self {
- if self.list_parse_keys == None {
+ if self.list_parse_keys.is_none() {
self.list_parse_keys = Some(vec![key.into()])
} else {
self.list_parse_keys = self.list_parse_keys.map(|mut keys| {
diff --git a/src/value.rs b/src/value.rs
index dced53b..cd7440d 100644
--- a/src/value.rs
+++ b/src/value.rs
@@ -309,7 +309,7 @@ impl Value {
}
}
- ValueKind::Boolean(value) => Ok(if value { 1 } else { 0 }),
+ ValueKind::Boolean(value) => Ok(i64::from(value)),
ValueKind::Float(value) => Ok(value.round() as i64),
// Unexpected type
@@ -362,7 +362,7 @@ impl Value {
}
}
- ValueKind::Boolean(value) => Ok(if value { 1 } else { 0 }),
+ ValueKind::Boolean(value) => Ok(i128::from(value)),
ValueKind::Float(value) => Ok(value.round() as i128),
// Unexpected type
@@ -428,7 +428,7 @@ impl Value {
}
}
- ValueKind::Boolean(value) => Ok(if value { 1 } else { 0 }),
+ ValueKind::Boolean(value) => Ok(u64::from(value)),
ValueKind::Float(value) => Ok(value.round() as u64),
// Unexpected type
@@ -487,7 +487,7 @@ impl Value {
}
}
- ValueKind::Boolean(value) => Ok(if value { 1 } else { 0 }),
+ ValueKind::Boolean(value) => Ok(u128::from(value)),
ValueKind::Float(value) => Ok(value.round() as u128),
// Unexpected type