Skip to content

Commit

Permalink
Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
cobward committed Dec 6, 2024
1 parent 8085446 commit 0ae09b6
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 11 deletions.
2 changes: 0 additions & 2 deletions src/cose/mac0.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,6 @@ mod hmac {

use super::super::SignatureAlgorithm;

/// Implement [`SignatureAlgorithm`].
impl SignatureAlgorithm for Hmac<Sha256> {
fn algorithm(&self) -> iana::Algorithm {
iana::Algorithm::HMAC_256_256
Expand Down
2 changes: 1 addition & 1 deletion src/cose/serialized_as_cbor_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use serde::{Deserialize, Serialize};
/// implement `Serialize`/`Deserialize` but only `AsCborValue`.
pub struct SerializedAsCborValue<T>(pub T);

impl<'a, T: Clone + AsCborValue> Serialize for SerializedAsCborValue<&'a T> {
impl<T: Clone + AsCborValue> Serialize for SerializedAsCborValue<&T> {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
Expand Down
4 changes: 0 additions & 4 deletions src/cose/sign1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,6 @@ mod p256 {

use crate::cose::SignatureAlgorithm;

/// Implement [`SignatureAlgorithm`].
impl SignatureAlgorithm for SigningKey {
fn algorithm(&self) -> iana::Algorithm {
iana::Algorithm::ES256
Expand All @@ -252,8 +250,6 @@ mod p384 {

use crate::cose::SignatureAlgorithm;

/// Implement [`SignatureAlgorithm`].
impl SignatureAlgorithm for SigningKey {
fn algorithm(&self) -> iana::Algorithm {
iana::Algorithm::ES384
Expand Down
1 change: 0 additions & 1 deletion src/definitions/device_request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ pub type ReaderAuth = MaybeTagged<CoseSign1>;
/// Represents a device request.
#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]

pub struct DeviceRequest {
/// The version of the device request.
pub version: String,
Expand Down
4 changes: 2 additions & 2 deletions src/definitions/x509/extensions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ pub fn validate_signer_key_usage(bytes: Vec<u8>) -> Vec<Error> {
but no other key usages are allowed */
pub fn validate_root_key_usage(bytes: &[u8]) -> Vec<Error> {
let mut errors = vec![];
let key_usage = KeyUsage::from_der(&bytes);
let key_usage = KeyUsage::from_der(bytes);
match key_usage {
Ok(ku) => {
if !ku.crl_sign() {
Expand Down Expand Up @@ -328,7 +328,7 @@ pub fn validate_basic_constraints(bytes: Vec<u8>) -> Vec<Error> {
let basic_constraints = BasicConstraints::from_der(&bytes);
match basic_constraints {
Ok(bc) => {
if !bc.path_len_constraint.is_some_and(|path_len| path_len == 0) && bc.ca {
if bc.path_len_constraint.is_none_or(|path_len| path_len != 0) && bc.ca {
return vec![Error::ValidationError(format!(
"Basic constraints expected to be CA:true, path_len:0, but found: {:?}",
bc
Expand Down
2 changes: 1 addition & 1 deletion tests/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ impl Device {
)]
.into_iter()
.collect();
session_manager.prepare_response(&requested_items, permitted_items);
session_manager.prepare_response(requested_items, permitted_items);
let (_, sign_payload) = session_manager.get_next_signature_payload().unwrap();
let signature: p256::ecdsa::Signature = key.sign(sign_payload);
session_manager
Expand Down

0 comments on commit 0ae09b6

Please sign in to comment.