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-ffi | |
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-ffi')
-rw-r--r-- | openpgp-ffi/src/cert.rs | 2 | ||||
-rw-r--r-- | openpgp-ffi/src/io.rs | 4 | ||||
-rw-r--r-- | openpgp-ffi/src/parse/stream.rs | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/openpgp-ffi/src/cert.rs b/openpgp-ffi/src/cert.rs index 03ca1c7d..a39b2e5a 100644 --- a/openpgp-ffi/src/cert.rs +++ b/openpgp-ffi/src/cert.rs @@ -863,7 +863,7 @@ fn pgp_cert_parser_from_packet_parser(ppr: *mut PacketParserResult<'static>) { let ppr = ffi_param_move!(ppr); let parser = CertParser::from(*ppr); - box_raw!(CertParserWrapper { parser: parser }) + box_raw!(CertParserWrapper { parser }) } diff --git a/openpgp-ffi/src/io.rs b/openpgp-ffi/src/io.rs index 3760395f..f888bc21 100644 --- a/openpgp-ffi/src/io.rs +++ b/openpgp-ffi/src/io.rs @@ -391,8 +391,8 @@ fn pgp_writer_alloc_with_capacity(buf: *mut *mut c_void, len: *mut size_t, } let w = WriterKind::Generic(Box::new(WriterAlloc(Mutex::new(Buffer { - buf: buf, - len: len, + buf, + len, capacity, })))); w.move_into_raw() diff --git a/openpgp-ffi/src/parse/stream.rs b/openpgp-ffi/src/parse/stream.rs index 52932e70..62ba4b1e 100644 --- a/openpgp-ffi/src/parse/stream.rs +++ b/openpgp-ffi/src/parse/stream.rs @@ -452,7 +452,7 @@ impl VHelper { inspect_cb, get_certs_cb: get_certs, check_signatures_cb: check_signatures, - cookie: cookie, + cookie, })) } } |