diff options
author | Nora Widdecke <nora@sequoia-pgp.org> | 2021-11-25 14:19:53 +0100 |
---|---|---|
committer | Nora Widdecke <nora@sequoia-pgp.org> | 2021-11-29 11:53:56 +0100 |
commit | f6a28555c2682c700165404d5f1944122b969f76 (patch) | |
tree | b2cb92462ae8d7bf886429084863b0ce01256af2 /sq | |
parent | 1d5e9385c20f8bc84ee45af2334f18b8a47c2dab (diff) |
sq: Simplify nested match expression.
- Found with clippy::collapsible_match.
Diffstat (limited to 'sq')
-rw-r--r-- | sq/src/sq.rs | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/sq/src/sq.rs b/sq/src/sq.rs index 8affa51f..a7996c69 100644 --- a/sq/src/sq.rs +++ b/sq/src/sq.rs @@ -223,22 +223,22 @@ fn detect_armor_kind(input: Box<dyn BufferedReader<()>>) -> (Box<dyn BufferedReader<()>>, armor::Kind) { let mut dup = Limitor::new(Dup::new(input), ARMOR_DETECTION_LIMIT).as_boxed(); let kind = 'detection: loop { - if let Ok(ppr) = PacketParser::from_reader(&mut dup) { - if let PacketParserResult::Some(pp) = ppr { - let (packet, _) = match pp.next() { - Ok(v) => v, - Err(_) => break 'detection armor::Kind::File, - }; + if let Ok(PacketParserResult::Some(pp)) = + PacketParser::from_reader(&mut dup) + { + let (packet, _) = match pp.next() { + Ok(v) => v, + Err(_) => break 'detection armor::Kind::File, + }; - break 'detection match packet { - Packet::Signature(_) => armor::Kind::Signature, - Packet::SecretKey(_) => armor::Kind::SecretKey, - Packet::PublicKey(_) => armor::Kind::PublicKey, - Packet::PKESK(_) | Packet::SKESK(_) => - armor::Kind::Message, - _ => armor::Kind::File, - }; - } + break 'detection match packet { + Packet::Signature(_) => armor::Kind::Signature, + Packet::SecretKey(_) => armor::Kind::SecretKey, + Packet::PublicKey(_) => armor::Kind::PublicKey, + Packet::PKESK(_) | Packet::SKESK(_) => + armor::Kind::Message, + _ => armor::Kind::File, + }; } break 'detection armor::Kind::File; }; |