summaryrefslogtreecommitdiffstats
path: root/sq
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2021-09-27 09:04:34 +0300
committerLars Wirzenius <liw@sequoia-pgp.org>2021-09-30 08:31:07 +0300
commit85362f33d81ebdc1cd355454be2494b9286e80be (patch)
tree6fba218d7f81565e0dd7f00883d8ab908e958af0 /sq
parent9fdbbf44d55f99807b2d2736ed3a85b0517be8e7 (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 'sq')
-rw-r--r--sq/src/commands/decrypt.rs2
-rw-r--r--sq/src/commands/dump.rs12
-rw-r--r--sq/src/commands/mod.rs2
3 files changed, 8 insertions, 8 deletions
diff --git a/sq/src/commands/decrypt.rs b/sq/src/commands/decrypt.rs
index f8102e7e..45e2b4e7 100644
--- a/sq/src/commands/decrypt.rs
+++ b/sq/src/commands/decrypt.rs
@@ -72,7 +72,7 @@ impl<'a> Helper<'a> {
secret_keys: keys,
key_identities: identities,
key_hints: hints,
- dump_session_key: dump_session_key,
+ dump_session_key,
dumper: if dump {
let width = term_size::dimensions_stdout().map(|(w, _)| w)
.unwrap_or(80);
diff --git a/sq/src/commands/dump.rs b/sq/src/commands/dump.rs
index 081760a6..3c1eda31 100644
--- a/sq/src/commands/dump.rs
+++ b/sq/src/commands/dump.rs
@@ -185,10 +185,10 @@ impl Node {
fn new(header: Header, packet: Packet, map: Option<Map>,
additional_fields: Option<Vec<String>>) -> Self {
Node {
- header: header,
- packet: packet,
- map: map,
- additional_fields: additional_fields,
+ header,
+ packet,
+ map,
+ additional_fields,
children: Vec::new(),
}
}
@@ -211,8 +211,8 @@ pub struct PacketDumper {
impl PacketDumper {
pub fn new(width: usize, mpis: bool) -> Self {
PacketDumper {
- width: width,
- mpis: mpis,
+ width,
+ mpis,
root: None,
}
}
diff --git a/sq/src/commands/mod.rs b/sq/src/commands/mod.rs
index ee185be7..61c05133 100644
--- a/sq/src/commands/mod.rs
+++ b/sq/src/commands/mod.rs
@@ -226,7 +226,7 @@ impl<'a> VHelper<'a> {
-> Self {
VHelper {
config: config.clone(),
- signatures: signatures,
+ signatures,
certs: Some(certs),
labels: HashMap::new(),
trusted: HashSet::new(),