summaryrefslogtreecommitdiffstats
path: root/openpgp/src/message/mod.rs
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2021-09-20 19:26:48 +0300
committerLars Wirzenius <liw@liw.fi>2021-09-21 09:56:49 +0300
commit7febc9e2722f7ca97be91dc4a68c9f6a0502dc27 (patch)
tree9159e67837902e39cd251c777f66c23789920ca2 /openpgp/src/message/mod.rs
parenteff8edd82629a4e6151d4bcb104a7695c6975e8d (diff)
Avoid matching on &Foo, when a plain Foo pattern works
The extra & in a pattern (match arm or if let) is unnecessary and only makes the code harder to read. In most places it's enough to just remove the & from the pattern, but in a few places a dereference (*) needs to be added where the value captured in the pattern is used, as removing the & changes the type of the captured value to be a reference. Overall, the changes are almost mechanical. Although the diff is huge, it should be easy to read. The clippy lint match_ref_pats warns about this. See: https://rust-lang.github.io/rust-clippy/master/index.html#match_ref_pats
Diffstat (limited to 'openpgp/src/message/mod.rs')
-rw-r--r--openpgp/src/message/mod.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/openpgp/src/message/mod.rs b/openpgp/src/message/mod.rs
index 2d92f44d..662e4e02 100644
--- a/openpgp/src/message/mod.rs
+++ b/openpgp/src/message/mod.rs
@@ -408,7 +408,7 @@ impl Message {
/// ```
pub fn body(&self) -> Option<&Literal> {
for packet in self.pile.descendants() {
- if let &Packet::Literal(ref l) = packet {
+ if let Packet::Literal(ref l) = packet {
return Some(l);
}
}