summaryrefslogtreecommitdiffstats
path: root/ipc
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2021-09-27 16:30:38 +0300
committerLars Wirzenius <liw@sequoia-pgp.org>2021-09-30 08:31:11 +0300
commit8b06d88ede1315af63250b00dbefe8ec2804eda8 (patch)
tree45a77c6ef7eae2f02cb795713fb7445e12a4c7b0 /ipc
parentfe78f2fc0baa68aa2b9c0125c1b89dc23121d68b (diff)
Avoid redundant closures
If a closure just passes the argument it gets to a function, the closure is usually redundant and you can just use the function instead of the closure. Thus, instead of this: iter().map(|x| foo(x)) you can write this: iter().map(foo) This is shorter and simpler. Sometimes it doesn't work and the closure is necessary. Such locations can be marked with `#[allow(clippy::redundant_closure)]`. Found by clippy lint redundant_closure: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure
Diffstat (limited to 'ipc')
-rw-r--r--ipc/src/keybox.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/ipc/src/keybox.rs b/ipc/src/keybox.rs
index 7ed481b7..c098631d 100644
--- a/ipc/src/keybox.rs
+++ b/ipc/src/keybox.rs
@@ -162,13 +162,13 @@ impl KeyboxRecord {
let record = KeyboxRecord::Unknown(bytes.clone());
match record.typ() {
KeyboxRecordType::Header => {
- HeaderRecord::new(bytes).map(|r| KeyboxRecord::Header(r))
+ HeaderRecord::new(bytes).map(KeyboxRecord::Header)
}
KeyboxRecordType::OpenPGP => {
- OpenPGPRecordV1::new(&record).map(|r| KeyboxRecord::OpenPGP(r))
+ OpenPGPRecordV1::new(&record).map(KeyboxRecord::OpenPGP)
}
KeyboxRecordType::X509 => {
- X509Record::new(bytes).map(|r| KeyboxRecord::X509(r))
+ X509Record::new(bytes).map(KeyboxRecord::X509)
}
KeyboxRecordType::Unknown(_) => Ok(record),
}