Fix new clippy lints.

This commit is contained in:
Heiko Schaefer 2022-08-30 18:27:12 +02:00
parent 0f50eda297
commit 8e6f03a2c5
No known key found for this signature in database
GPG key ID: 4A849A1904CCBD7D
4 changed files with 13 additions and 13 deletions

View file

@ -507,7 +507,7 @@ impl Display for KeyInformation {
/// KeyStatus is contained in `KeyInformation`. It encodes if key material on a card was imported /// KeyStatus is contained in `KeyInformation`. It encodes if key material on a card was imported
/// or generated on the card. /// or generated on the card.
#[derive(Debug, PartialEq, Clone, Copy)] #[derive(Debug, PartialEq, Eq, Clone, Copy)]
#[non_exhaustive] #[non_exhaustive]
pub enum KeyStatus { pub enum KeyStatus {
NotPresent, NotPresent,
@ -558,7 +558,7 @@ impl Display for ApplicationIdentifier {
} }
/// 6 Historical Bytes /// 6 Historical Bytes
#[derive(Debug, PartialEq)] #[derive(Debug, PartialEq, Eq)]
pub struct HistoricalBytes { pub struct HistoricalBytes {
/// category indicator byte /// category indicator byte
cib: u8, cib: u8,
@ -574,7 +574,7 @@ pub struct HistoricalBytes {
} }
/// Card Capabilities (see 6 Historical Bytes) /// Card Capabilities (see 6 Historical Bytes)
#[derive(Debug, PartialEq)] #[derive(Debug, PartialEq, Eq)]
pub struct CardCapabilities { pub struct CardCapabilities {
command_chaining: bool, command_chaining: bool,
extended_lc_le: bool, extended_lc_le: bool,
@ -598,7 +598,7 @@ impl Display for CardCapabilities {
} }
/// Card service data (see 6 Historical Bytes) /// Card service data (see 6 Historical Bytes)
#[derive(Debug, PartialEq)] #[derive(Debug, PartialEq, Eq)]
pub struct CardServiceData { pub struct CardServiceData {
select_by_full_df_name: bool, // Application Selection by full DF name (AID) select_by_full_df_name: bool, // Application Selection by full DF name (AID)
select_by_partial_df_name: bool, // Application Selection by partial DF name select_by_partial_df_name: bool, // Application Selection by partial DF name
@ -754,7 +754,7 @@ impl Display for ExtendedLengthInfo {
} }
/// Cardholder Related Data (see spec pg. 22) /// Cardholder Related Data (see spec pg. 22)
#[derive(Debug, PartialEq)] #[derive(Debug, PartialEq, Eq)]
pub struct CardholderRelatedData { pub struct CardholderRelatedData {
name: Option<Vec<u8>>, name: Option<Vec<u8>>,
lang: Option<Vec<Lang>>, lang: Option<Vec<Lang>>,
@ -781,7 +781,7 @@ impl Display for CardholderRelatedData {
/// 4.4.3.5 Sex /// 4.4.3.5 Sex
/// ///
/// Encoded in accordance with <https://en.wikipedia.org/wiki/ISO/IEC_5218> /// Encoded in accordance with <https://en.wikipedia.org/wiki/ISO/IEC_5218>
#[derive(Debug, PartialEq, Clone, Copy)] #[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum Sex { pub enum Sex {
NotKnown, NotKnown,
Male, Male,
@ -829,7 +829,7 @@ impl From<u8> for Sex {
/// Individual language for Language Preferences (4.4.3.4), accessible via `CardholderRelatedData`. /// Individual language for Language Preferences (4.4.3.4), accessible via `CardholderRelatedData`.
/// ///
/// Encoded according to <https://en.wikipedia.org/wiki/ISO_639-1> /// Encoded according to <https://en.wikipedia.org/wiki/ISO_639-1>
#[derive(Debug, PartialEq, Clone, Copy)] #[derive(Debug, PartialEq, Eq, Clone, Copy)]
pub enum Lang { pub enum Lang {
Value([u8; 2]), Value([u8; 2]),
Invalid(u8), Invalid(u8),
@ -882,7 +882,7 @@ impl From<&[u8; 2]> for Lang {
} }
/// PW status Bytes (see spec page 23) /// PW status Bytes (see spec page 23)
#[derive(Debug, PartialEq)] #[derive(Debug, PartialEq, Eq)]
pub struct PWStatusBytes { pub struct PWStatusBytes {
pub(crate) pw1_cds_valid_once: bool, pub(crate) pw1_cds_valid_once: bool,
pub(crate) pw1_pin_block: bool, pub(crate) pw1_pin_block: bool,

View file

@ -50,7 +50,7 @@ impl From<StatusBytes> for Error {
} }
/// OpenPGP card "Status Bytes" (ok statuses and errors) /// OpenPGP card "Status Bytes" (ok statuses and errors)
#[derive(thiserror::Error, Debug, PartialEq, Copy, Clone)] #[derive(thiserror::Error, Debug, PartialEq, Eq, Copy, Clone)]
#[non_exhaustive] #[non_exhaustive]
pub enum StatusBytes { pub enum StatusBytes {
#[error("Command correct")] #[error("Command correct")]

View file

@ -339,10 +339,10 @@ fn card_algo_rsa(algo_info: AlgoInfo, key_type: KeyType, rsa_bits: u16) -> Resul
Ok((**algo.last().unwrap()).clone()) Ok((**algo.last().unwrap()).clone())
} else { } else {
// RSA with this bit length is not in algo_info // RSA with this bit length is not in algo_info
return Err(Error::UnsupportedAlgo(format!( Err(Error::UnsupportedAlgo(format!(
"RSA {} unsupported according to algo_info", "RSA {} unsupported according to algo_info",
rsa_bits rsa_bits
))); )))
} }
} }

View file

@ -586,7 +586,7 @@ fn pick_card_for_reading(ident: Option<String>) -> Result<Box<dyn CardBackend +
if cards.len() == 1 { if cards.len() == 1 {
Ok(Box::new(cards.pop().unwrap())) Ok(Box::new(cards.pop().unwrap()))
} else if cards.is_empty() { } else if cards.is_empty() {
return Err(anyhow::anyhow!("No cards found")); Err(anyhow::anyhow!("No cards found"))
} else { } else {
println!("Found {} cards:", cards.len()); println!("Found {} cards:", cards.len());
list_cards()?; list_cards()?;
@ -595,7 +595,7 @@ fn pick_card_for_reading(ident: Option<String>) -> Result<Box<dyn CardBackend +
println!("Specify which card to use with '--card <card ident>'"); println!("Specify which card to use with '--card <card ident>'");
println!(); println!();
return Err(anyhow::anyhow!("Specify card")); Err(anyhow::anyhow!("Specify card"))
} }
} }
} }