From 347e9519954b1a7702d7120d6c265ea3d82b64cc Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Wed, 29 Sep 2021 15:05:32 +0300 Subject: Annotate functions where clippy::redundant_pattern_matching is OK See https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pattern_matching --- ffi/src/error.rs | 1 + openpgp-ffi/src/error.rs | 1 + openpgp/src/packet/signature/subpacket.rs | 1 + openpgp/src/parse/packet_parser_builder.rs | 1 + openpgp/src/parse/stream.rs | 1 + sq/src/commands/dump.rs | 1 + 6 files changed, 6 insertions(+) diff --git a/ffi/src/error.rs b/ffi/src/error.rs index 003477dd..b1c77a1e 100644 --- a/ffi/src/error.rs +++ b/ffi/src/error.rs @@ -13,6 +13,7 @@ trait FromSequoiaError<'a> { } impl<'a> FromSequoiaError<'a> for Status { + #[allow(clippy::redundant_pattern_matching)] fn from_sequoia_error(e: &'a anyhow::Error) -> Self { if let Some(e) = e.downcast_ref::() { return match e { diff --git a/openpgp-ffi/src/error.rs b/openpgp-ffi/src/error.rs index 1709e1c9..7dc6d8a4 100644 --- a/openpgp-ffi/src/error.rs +++ b/openpgp-ffi/src/error.rs @@ -208,6 +208,7 @@ pub extern "C" fn pgp_status_to_string(status: Status) -> *const c_char { } impl<'a> From<&'a anyhow::Error> for Status { + #[allow(clippy::redundant_pattern_matching)] fn from(e: &'a anyhow::Error) -> Self { if let Some(e) = e.downcast_ref::() { return match e { diff --git a/openpgp/src/packet/signature/subpacket.rs b/openpgp/src/packet/signature/subpacket.rs index 558d3f9c..40e1bb2e 100644 --- a/openpgp/src/packet/signature/subpacket.rs +++ b/openpgp/src/packet/signature/subpacket.rs @@ -2141,6 +2141,7 @@ impl SubpacketAreas { /// /// For subpackets that can safely occur in both subpacket areas, /// this function prefers instances in the hashed subpacket area. + #[allow(clippy::redundant_pattern_matching)] pub fn subpacket_mut(&mut self, tag: SubpacketTag) -> Option<&mut Subpacket> { if let Some(_) = self.hashed_area().subpacket(tag) { diff --git a/openpgp/src/parse/packet_parser_builder.rs b/openpgp/src/parse/packet_parser_builder.rs index d94a5d2e..24b9a13b 100644 --- a/openpgp/src/parse/packet_parser_builder.rs +++ b/openpgp/src/parse/packet_parser_builder.rs @@ -396,6 +396,7 @@ impl<'a> PacketParserBuilder<'a> { /// ppr = pp.recurse()?.1; /// } /// # Ok(()) } + #[allow(clippy::redundant_pattern_matching)] pub fn build(mut self) -> Result> where Self: 'a diff --git a/openpgp/src/parse/stream.rs b/openpgp/src/parse/stream.rs index 141b8f5c..22dbf9a0 100644 --- a/openpgp/src/parse/stream.rs +++ b/openpgp/src/parse/stream.rs @@ -2265,6 +2265,7 @@ impl<'a, H: VerificationHelper + DecryptionHelper> Decryptor<'a, H> { } /// Creates the `Decryptor`, and buffers the data up to `buffer_size`. + #[allow(clippy::redundant_pattern_matching)] fn from_buffered_reader( policy: &'a dyn Policy, bio: Box + 'a>, diff --git a/sq/src/commands/dump.rs b/sq/src/commands/dump.rs index c2d0aa03..58401baa 100644 --- a/sq/src/commands/dump.rs +++ b/sq/src/commands/dump.rs @@ -52,6 +52,7 @@ impl Convert> for Timestamp { } } +#[allow(clippy::redundant_pattern_matching)] pub fn dump(input: &mut (dyn io::Read + Sync + Send), output: &mut dyn io::Write, mpis: bool, hex: bool, sk: Option<&SessionKey>, -- cgit v1.2.3