diff options
author | Nora Widdecke <nora@sequoia-pgp.org> | 2020-09-22 00:45:53 +0200 |
---|---|---|
committer | Nora Widdecke <nora@sequoia-pgp.org> | 2020-11-06 09:46:53 +0100 |
commit | cdc9e16fb2aef0156d6af4abe3e519c22efa230e (patch) | |
tree | f4f5e10029ed7816bcb0931c53d27ed0e21c598c /sq | |
parent | 327a987e2c95ea9d05fcadd6fa7a8c249372affd (diff) |
openpgp: Use non_exhaustive attribute.
- Fixes #563
- With an MSRV >= 1.40.0, we can use #[non_exhaustive], as mentioned
in #406.
- This is also a clippy lint:
https://rust-lang.github.io/rust-clippy/master/index.html#manual_non_exhaustive
Diffstat (limited to 'sq')
-rw-r--r-- | sq/src/commands/dump.rs | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/sq/src/commands/dump.rs b/sq/src/commands/dump.rs index 6f35f56d..eddce8c8 100644 --- a/sq/src/commands/dump.rs +++ b/sq/src/commands/dump.rs @@ -369,7 +369,9 @@ impl PacketDumper { pd.dump_mpis(output, &ii, &[&rest[..]], &["rest"])?; }, - mpi::PublicKey::__Nonexhaustive => unreachable!(), + + // crypto::mpi:Publickey is non-exhaustive + _ => writeln!(output, "{} Unknown variant", ii)?, } } @@ -425,8 +427,9 @@ impl PacketDumper { pd.dump_mpis(output, &ii, &[rest], &["rest"])?; }, - mpi::SecretKeyMaterial::__Nonexhaustive => - unreachable!(), + + // crypto::mpi::SecretKeyMaterial is non-exhaustive. + _ => writeln!(output, "{} Unknown variant", ii)?, } Ok(()) })?; @@ -531,8 +534,9 @@ impl PacketDumper { self.dump_mpis(output, &ii, &[&rest[..]], &["rest"])?; }, - mpi::Signature::__Nonexhaustive => unreachable!(), + // crypto::mpi::Signature is non-exhaustive. + _ => writeln!(output, "{} Unknown variant", ii)?, } } }, @@ -641,7 +645,9 @@ impl PacketDumper { self.dump_mpis(output, &ii, &[rest], &["rest"])?; }, - mpi::Ciphertext::__Nonexhaustive => unreachable!(), + + // crypto::mpi::Ciphertext is non-exhaustive. + _ => writeln!(output, "{} Unknown variant", ii)?, } } }, @@ -679,8 +685,8 @@ impl PacketDumper { hex::encode(s.aead_digest()))?; }, - self::openpgp::packet::SKESK::__Nonexhaustive => - unreachable!(), + // SKESK is non-exhaustive. + _ => writeln!(output, "{} Unknown variant", i)?, } }, @@ -703,7 +709,8 @@ impl PacketDumper { writeln!(output, "{} IV: {}", i, hex::encode(a.iv()))?; }, - __Nonexhaustive => unreachable!(), + // openpgp::Packet is non-exhaustive. + _ => writeln!(output, "{} Unknown variant", i)?, } if let Some(fields) = additional_fields { @@ -840,7 +847,9 @@ impl PacketDumper { .collect::<Vec<String>>().join(", "))?, IntendedRecipient(ref fp) => write!(output, "{} Intended Recipient: {}", i, fp)?, - __Nonexhaustive => unreachable!(), + + // SubpacketValue is non-exhaustive. + _ => writeln!(output, "{} Unknown variant", i)?, } match s.value() { @@ -900,7 +909,9 @@ impl PacketDumper { writeln!(output, "{} Parameters: {:?}", i, p)?; } }, - __Nonexhaustive => unreachable!(), + + // S2K is non-exhaustive + _ => writeln!(output, "{} Unknown variant", i)?, } Ok(()) } |