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 /autocrypt | |
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 'autocrypt')
-rw-r--r-- | autocrypt/src/lib.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/autocrypt/src/lib.rs b/autocrypt/src/lib.rs index 0da1f053..112f14f4 100644 --- a/autocrypt/src/lib.rs +++ b/autocrypt/src/lib.rs @@ -96,7 +96,7 @@ pub struct AutocryptHeader { impl AutocryptHeader { fn empty(header_type: AutocryptHeaderType) -> Self { AutocryptHeader { - header_type: header_type, + header_type, key: None, attributes: Vec::new(), } @@ -645,8 +645,8 @@ impl AutocryptSetupMessage { Ok(AutocryptSetupMessageParser { passcode_format: format, passcode_begin: begin, - skesk: skesk, - pp: pp, + skesk, + pp, passcode: None, }) } @@ -809,7 +809,7 @@ impl<'a> AutocryptSetupMessageParser<'a> { // We're done! Ok(AutocryptSetupMessage { - prefer_encrypt: prefer_encrypt, + prefer_encrypt, passcode: self.passcode, passcode_format: self.passcode_format, passcode_begin: self.passcode_begin, |