Skip to content

Commit

Permalink
Small fixes for consistency
Browse files Browse the repository at this point in the history
- Adds `Eq` to types that already derive `PartialEq`.
- Fixes a comment to match the latest USB changes.
- Removes a back-and-forth conversion.
  • Loading branch information
kaczmarczyck committed Sep 18, 2024
1 parent 6feeb71 commit 49f0107
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion libraries/opensk/fuzz/fuzz_helper/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ use opensk::{test_helpers, Ctap, Transport};

const CHANNEL_BROADCAST: ChannelID = [0xFF, 0xFF, 0xFF, 0xFF];

#[derive(Clone, Copy, PartialEq)]
#[derive(Clone, Copy, PartialEq, Eq)]
pub enum InputType {
CborMakeCredentialParameter,
CborGetAssertionParameter,
Expand Down
2 changes: 1 addition & 1 deletion libraries/opensk/src/ctap/status_code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub type CtapResult<T> = Result<T, Ctap2StatusCode>;
// For now, only the CTAP2 codes are here, the CTAP1 are not included.
#[allow(non_camel_case_types)]
#[allow(dead_code)]
#[derive(Copy, Clone, Debug, PartialEq)]
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum Ctap2StatusCode {
CTAP2_OK = 0x00,
CTAP1_ERR_INVALID_COMMAND = 0x01,
Expand Down
2 changes: 1 addition & 1 deletion libraries/opensk/src/env/test/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pub type TestRng = StdRng;

impl Rng for TestRng {}

#[derive(Debug, Default, PartialEq)]
#[derive(Debug, Default, PartialEq, Eq)]
pub struct TestTimer {
end_ms: usize,
}
Expand Down
5 changes: 2 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ extern crate byteorder;
extern crate core;
extern crate lang_items;

use core::convert::TryFrom;
#[cfg(feature = "debug_ctap")]
use core::fmt::Write;
#[cfg(feature = "with_ctap1")]
Expand Down Expand Up @@ -151,7 +150,7 @@ fn main() {
#[cfg(feature = "with_ctap1")]
let num_buttons = Buttons::<SyscallImplementation>::count().ok().unwrap();

// Variable for use in both the send_and_maybe_recv and recv cases.
// Variable for use in both the send and recv cases.
let mut usb_endpoint: Option<UsbEndpoint> = None;
let mut pkt_request = [0; 64];

Expand Down Expand Up @@ -189,7 +188,7 @@ fn main() {
ctap.env().clock().timestamp_us(),
&mut writer,
);
UsbEndpoint::try_from(endpoint as usize).ok()
Some(endpoint)
}
Err(_) => panic!("Error on USB recv"),
};
Expand Down

0 comments on commit 49f0107

Please sign in to comment.