We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2ee2c63 commit 2142bebCopy full SHA for 2142beb
src/env.rs
@@ -151,14 +151,8 @@ impl Environment {
151
/// Once `list_separator` is set, the type for string is [`Vec<String>`].
152
/// To switch the default type back to type Strings you need to provide the keys which should be [`Vec<String>`] using this function.
153
pub fn with_list_parse_key(mut self, key: &str) -> Self {
154
- if self.list_parse_keys.is_none() {
155
- self.list_parse_keys = Some(vec![key.into()]);
156
- } else {
157
- self.list_parse_keys = self.list_parse_keys.map(|mut keys| {
158
- keys.push(key.into());
159
- keys
160
- });
161
- }
+ let keys = self.list_parse_keys.get_or_insert_with(Vec::new);
+ keys.push(key.into());
162
self
163
}
164
0 commit comments