Use map instead of match on Option

This commit is contained in:
Jeremy Stucki 2019-06-20 14:18:17 +02:00
parent d07bd9fed4
commit ea15e55829
No known key found for this signature in database
GPG key ID: EEFCA93148042655

View file

@ -131,10 +131,8 @@ impl Config {
pub fn update_from_env(&mut self) {
debug!("Updating the config from environment variables");
let overrides = env::vars().filter_map(|(key, value)| match parse_env(&key) {
Some(index) => Some((index, value)),
None => None,
});
let overrides =
env::vars().filter_map(|(key, value)| parse_env(&key).map(|index| (index, value)));
for (key, value) in overrides {
trace!("{} => {}", key, value);