Use Option<EncryptPreference>.unwrap_or_default in aheader.rs

This commit is contained in:
Alexander Krotov
2019-12-07 02:24:42 +03:00
committed by holger krekel
parent 0db5ff55fd
commit f1aba8115b

View File

@@ -150,13 +150,10 @@ impl str::FromStr for Aheader {
} }
}; };
let prefer_encrypt = match attributes let prefer_encrypt = attributes
.remove("prefer-encrypt") .remove("prefer-encrypt")
.and_then(|raw| raw.parse().ok()) .and_then(|raw| raw.parse().ok())
{ .unwrap_or_default();
Some(pref) => pref,
None => EncryptPreference::NoPreference,
};
// Autocrypt-Level0: unknown attributes starting with an underscore can be safely ignored // Autocrypt-Level0: unknown attributes starting with an underscore can be safely ignored
// Autocrypt-Level0: unknown attribute, treat the header as invalid // Autocrypt-Level0: unknown attribute, treat the header as invalid