diff options
author | Nora Widdecke <nora@sequoia-pgp.org> | 2021-11-22 16:28:06 +0100 |
---|---|---|
committer | Nora Widdecke <nora@sequoia-pgp.org> | 2021-11-29 11:53:55 +0100 |
commit | b2ffb4401fad2f5c51f35d56a4408c23c10a3450 (patch) | |
tree | a5584f9024044a162a3850250d2269062a1c1cdd /openpgp | |
parent | 8b272c162ce443e26c89afbda6fe4e06dd366118 (diff) |
openpgp: Use functional update syntax.
- Instead of creating a default struct and immediately afterwards
changing a field, use this type of initialization syntax:
Struct { field: value, ..Default::default() }.
- Suggested by clippy::field_reassign_with_default.
Diffstat (limited to 'openpgp')
-rw-r--r-- | openpgp/src/cert/parser/mod.rs | 7 | ||||
-rw-r--r-- | openpgp/src/parse.rs | 6 |
2 files changed, 8 insertions, 5 deletions
diff --git a/openpgp/src/cert/parser/mod.rs b/openpgp/src/cert/parser/mod.rs index c384be1f..53c9bcf9 100644 --- a/openpgp/src/cert/parser/mod.rs +++ b/openpgp/src/cert/parser/mod.rs @@ -662,9 +662,10 @@ impl<'a> CertParser<'a> { J: 'a + Into<Result<Packet>>, <I as IntoIterator>::IntoIter: Send + Sync, { - let mut parser : Self = Default::default(); - parser.source = Some(Box::new(iter.into_iter().map(Into::into))); - parser + Self { + source: Some(Box::new(iter.into_iter().map(Into::into))), + ..Default::default() + } } /// Filters the Certs prior to validation. diff --git a/openpgp/src/parse.rs b/openpgp/src/parse.rs index ede6d182..e2aa2660 100644 --- a/openpgp/src/parse.rs +++ b/openpgp/src/parse.rs @@ -445,8 +445,10 @@ impl<'a, T: 'a + BufferedReader<Cookie>> PacketHeaderParser<T> { { assert!(!path.is_empty()); - let mut cookie = Cookie::default(); - cookie.level = inner.cookie_ref().level; + let cookie = Cookie { + level: inner.cookie_ref().level, + ..Default::default() + }; let map = if state.settings.map { Some(map::Map::new(header_bytes.clone())) } else { |