diff options
author | Lars Wirzenius <liw@liw.fi> | 2021-09-28 19:13:12 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@sequoia-pgp.org> | 2021-09-30 08:31:15 +0300 |
commit | 2fa7cb8ead4e1be702ebc6ff580ec3dae969cc1f (patch) | |
tree | 36c32ae7c79ed0ec34c9fa0d3b051a058656d139 /openpgp/src/parse.rs | |
parent | df2471fb95dbc50a1e5eaf6e363c016fb97418e4 (diff) |
Avoid calling .map with function returning the unit type
It seems clearer to write this with "if let".
Found by clippy lint option_map_unit_fn:
https://rust-lang.github.io/rust-clippy/master/index.html#option_map_unit_fn
Diffstat (limited to 'openpgp/src/parse.rs')
-rw-r--r-- | openpgp/src/parse.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/openpgp/src/parse.rs b/openpgp/src/parse.rs index 5cf7c5f5..11f2f3e3 100644 --- a/openpgp/src/parse.rs +++ b/openpgp/src/parse.rs @@ -4853,7 +4853,9 @@ impl <'a> PacketParser<'a> { fn hash_read_content(&mut self, b: &[u8]) { if !b.is_empty() { assert!(self.body_hash.is_some()); - self.body_hash.as_mut().map(|h| h.update(b)); + if let Some(h) = self.body_hash.as_mut() { + h.update(b); + } self.content_was_read = true; } } |