Skip to content

Commit

Permalink
fixups for rust-1.78
Browse files Browse the repository at this point in the history
Rustc 1.78 introduced new unnecessary qualification warnings.
  • Loading branch information
baloo committed May 16, 2024
1 parent 0a90dc3 commit 5cf213e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@ impl std::error::Error for Error {
}
}

impl From<x509_cert::der::Error> for Error {
fn from(_err: x509_cert::der::Error) -> Error {
impl From<der::Error> for Error {
fn from(_err: der::Error) -> Error {
Error::ParseError
}
}
10 changes: 5 additions & 5 deletions src/yubikey.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,8 @@ impl YubiKey {
if let Some(yk_stored) = yubikey {
// We found two YubiKeys, so we won't use either.
// Don't reset them.
let _ = yk_stored.disconnect(pcsc::Disposition::LeaveCard);
let _ = yk_found.disconnect(pcsc::Disposition::LeaveCard);
let _ = yk_stored.disconnect(Disposition::LeaveCard);
let _ = yk_found.disconnect(Disposition::LeaveCard);

error!("multiple YubiKeys detected!");
return Err(Error::PcscError { inner: None });
Expand Down Expand Up @@ -246,7 +246,7 @@ impl YubiKey {
return Ok(yubikey);
} else {
// We didn't want this YubiKey; don't reset it.
let _ = yubikey.disconnect(pcsc::Disposition::LeaveCard);
let _ = yubikey.disconnect(Disposition::LeaveCard);
}
}

Expand All @@ -266,7 +266,7 @@ impl YubiKey {
self.card.reconnect(
pcsc::ShareMode::Shared,
pcsc::Protocols::T1,
pcsc::Disposition::ResetCard,
Disposition::ResetCard,
)?;

let pin = self
Expand Down Expand Up @@ -727,7 +727,7 @@ impl<'a> TryFrom<&'a Reader<'_>> for YubiKey {
// a side-effect of determining this. Avoid disrupting its internal state
// any further (e.g. preserve the PIN cache of whatever applet is selected
// currently).
if let Err((_, e)) = card.disconnect(pcsc::Disposition::LeaveCard) {
if let Err((_, e)) = card.disconnect(Disposition::LeaveCard) {
error!("Failed to disconnect gracefully from card: {}", e);
}

Expand Down
4 changes: 1 addition & 3 deletions tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ use signature::hazmat::PrehashVerifier;
use std::{env, str::FromStr, sync::Mutex, time::Duration};
use x509_cert::{der::Encode, name::Name, serial_number::SerialNumber, time::Validity};
use yubikey::{
certificate,
certificate::yubikey_signer,
certificate::Certificate,
piv::{self, AlgorithmId, Key, ManagementSlotId, RetiredSlotId, SlotId},
Expand Down Expand Up @@ -317,8 +316,7 @@ fn test_read_metadata() {
#[ignore]
fn test_parse_cert_from_der() {
let bob_der = std::fs::read("tests/assets/Bob.der").expect(".der file not found");
let cert =
certificate::Certificate::from_bytes(bob_der).expect("Failed to parse valid certificate");
let cert = Certificate::from_bytes(bob_der).expect("Failed to parse valid certificate");
assert_eq!(
cert.subject(),
"CN=Bob",
Expand Down

0 comments on commit 5cf213e

Please sign in to comment.