Skip to content

Commit

Permalink
Clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew committed Jan 15, 2024
1 parent b0072fd commit dbc9dbd
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/decoding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ fn verify_signature_body(
return Err(new_error(ErrorKind::InvalidSignature));
}

return Ok(());
Ok(())
}

/// Verify signature of a JWT, and return header object and raw payload
Expand Down
2 changes: 1 addition & 1 deletion src/encoding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ pub fn encode_jws<T: Serialize>(
Ok(Jws {
protected: encoded_header,
payload: encoded_claims,
signature: signature,
signature,
_pd: Default::default(),
})
}
21 changes: 10 additions & 11 deletions src/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@ use crate::errors::Result;
use crate::jwk::Jwk;
use crate::serialization::b64_decode;

const ZIP_SERIAL_DEFLATE: &'static str = "DEF";
const ENC_A128CBC_HS256: &'static str = "A128CBC-HS256";
const ENC_A192CBC_HS384: &'static str = "A192CBC-HS384";
const ENC_A256CBC_HS512: &'static str = "A256CBC-HS512";
const ENC_A128GCM: &'static str = "A128GCM";
const ENC_A192GCM: &'static str = "A192GCM";
const ENC_A256GCM: &'static str = "A256GCM";
const ZIP_SERIAL_DEFLATE: &str = "DEF";
const ENC_A128CBC_HS256: &str = "A128CBC-HS256";
const ENC_A192CBC_HS384: &str = "A192CBC-HS384";
const ENC_A256CBC_HS512: &str = "A256CBC-HS512";
const ENC_A128GCM: &str = "A128GCM";
const ENC_A192GCM: &str = "A192GCM";
const ENC_A256GCM: &str = "A256GCM";

/// Encryption algorithm for encrypted payloads.
///
/// Defined in [RFC7516#4.1.2](https://datatracker.ietf.org/doc/html/rfc7516#section-4.1.2).
///
/// Values defined in [RFC7518#5.1](https://datatracker.ietf.org/doc/html/rfc7518#section-5.1).
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
#[allow(clippy::upper_case_acronyms)]
#[allow(clippy::upper_case_acronyms, non_camel_case_types)]
pub enum Enc {
A128CBC_HS256,
A192CBC_HS384,
Expand Down Expand Up @@ -98,10 +98,9 @@ impl<'de> Deserialize<'de> for Zip {
{
let s = String::deserialize(deserializer)?;
match s.as_str() {
ZIP_SERIAL_DEFLATE => return Ok(Zip::Deflate),
_ => (),
ZIP_SERIAL_DEFLATE => Ok(Zip::Deflate),
_ => Ok(Zip::Other(s)),
}
Ok(Zip::Other(s))
}
}

Expand Down

0 comments on commit dbc9dbd

Please sign in to comment.