diff options
author | Lars Wirzenius <liw@liw.fi> | 2021-09-27 09:04:34 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@sequoia-pgp.org> | 2021-09-30 08:31:07 +0300 |
commit | 85362f33d81ebdc1cd355454be2494b9286e80be (patch) | |
tree | 6fba218d7f81565e0dd7f00883d8ab908e958af0 /openpgp/src/parse.rs | |
parent | 9fdbbf44d55f99807b2d2736ed3a85b0517be8e7 (diff) |
Avoid naming field setting it from variable of the same name
When creating a struct with a field foo, using a variable also named
foo, it's not necessary to name the field explicitly. Thus, instead
of:
Self { foo: foo }
use this:
Self { foo }
The shorter form is more idiomatic and thus less confusing to
experienced Rust programmers.
This was found by the clippy lint redundant_field_names:
https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names
Sponsored-by: author
Diffstat (limited to 'openpgp/src/parse.rs')
-rw-r--r-- | openpgp/src/parse.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/openpgp/src/parse.rs b/openpgp/src/parse.rs index 068bdd6b..cae96fc8 100644 --- a/openpgp/src/parse.rs +++ b/openpgp/src/parse.rs @@ -452,11 +452,11 @@ impl<'a, T: 'a + BufferedReader<Cookie>> PacketHeaderParser<T> { }; PacketHeaderParser { reader: buffered_reader::Dup::with_cookie(inner, cookie), - header: header, - header_bytes: header_bytes, - path: path, - state: state, - map: map, + header, + header_bytes, + path, + state, + map, } } @@ -3050,7 +3050,7 @@ struct PacketParserState { impl PacketParserState { fn new(settings: PacketParserSettings) -> Self { PacketParserState { - settings: settings, + settings, message_validator: Default::default(), keyring_validator: Default::default(), cert_validator: Default::default(), |