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
/// or generated on the card.
#[derive(Debug, PartialEq, Clone, Copy)]
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
#[non_exhaustive]
pub enum KeyStatus {
NotPresent,
@ -558,7 +558,7 @@ impl Display for ApplicationIdentifier {
}
/// 6 Historical Bytes
#[derive(Debug, PartialEq)]
#[derive(Debug, PartialEq, Eq)]
pub struct HistoricalBytes {
/// category indicator byte
cib: u8,
@ -574,7 +574,7 @@ pub struct HistoricalBytes {
}
/// Card Capabilities (see 6 Historical Bytes)
#[derive(Debug, PartialEq)]
#[derive(Debug, PartialEq, Eq)]
pub struct CardCapabilities {
command_chaining: bool,
extended_lc_le: bool,
@ -598,7 +598,7 @@ impl Display for CardCapabilities {
}
/// Card service data (see 6 Historical Bytes)
#[derive(Debug, PartialEq)]
#[derive(Debug, PartialEq, Eq)]
pub struct CardServiceData {
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
@ -754,7 +754,7 @@ impl Display for ExtendedLengthInfo {
}
/// Cardholder Related Data (see spec pg. 22)
#[derive(Debug, PartialEq)]
#[derive(Debug, PartialEq, Eq)]
pub struct CardholderRelatedData {
name: Option<Vec<u8>>,
lang: Option<Vec<Lang>>,
@ -781,7 +781,7 @@ impl Display for CardholderRelatedData {
/// 4.4.3.5 Sex
///
/// 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 {
NotKnown,
Male,
@ -829,7 +829,7 @@ impl From<u8> for Sex {
/// Individual language for Language Preferences (4.4.3.4), accessible via `CardholderRelatedData`.
///
/// 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 {
Value([u8; 2]),
Invalid(u8),
@ -882,7 +882,7 @@ impl From<&[u8; 2]> for Lang {
}
/// PW status Bytes (see spec page 23)
#[derive(Debug, PartialEq)]
#[derive(Debug, PartialEq, Eq)]
pub struct PWStatusBytes {
pub(crate) pw1_cds_valid_once: 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)
#[derive(thiserror::Error, Debug, PartialEq, Copy, Clone)]
#[derive(thiserror::Error, Debug, PartialEq, Eq, Copy, Clone)]
#[non_exhaustive]
pub enum StatusBytes {
#[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())
} else {
// 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_bits
)));
)))
}
}

View file

@ -586,7 +586,7 @@ fn pick_card_for_reading(ident: Option<String>) -> Result<Box<dyn CardBackend +
if cards.len() == 1 {
Ok(Box::new(cards.pop().unwrap()))
} else if cards.is_empty() {
return Err(anyhow::anyhow!("No cards found"));
Err(anyhow::anyhow!("No cards found"))
} else {
println!("Found {} cards:", cards.len());
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!();
return Err(anyhow::anyhow!("Specify card"));
Err(anyhow::anyhow!("Specify card"))
}
}
}