Skip to content

Commit 582358a

Browse files
committed
style: clippy fix
1 parent 70ceb14 commit 582358a

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

packages/jsonwebtoken/src/header.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ pub struct Header {
5757
impl From<&Header> for jsonwebtoken::Header {
5858
#[inline]
5959
fn from(value: &Header) -> Self {
60-
let header = jsonwebtoken::Header {
60+
jsonwebtoken::Header {
6161
typ: Some(String::from("JWT")),
6262
alg: value.algorithm.unwrap_or(Algorithm::ES256).into(),
6363
cty: value.content_type.clone(),
@@ -69,9 +69,7 @@ impl From<&Header> for jsonwebtoken::Header {
6969
x5t_s256: value.x5t_s256_cert_thumbprint.clone(),
7070
// TODO: support jwk
7171
jwk: None,
72-
};
73-
74-
header
72+
}
7573
}
7674
}
7775

packages/jsonwebtoken/src/verify.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use jsonwebtoken;
21
use napi::{bindgen_prelude::*, JsBuffer, JsBufferValue, Ref};
32
use napi_derive::napi;
43
use std::borrow::Borrow;
@@ -66,12 +65,12 @@ pub struct VerifyTask {
6665
}
6766

6867
impl VerifyTask {
69-
pub fn verify(token: &String, key: &[u8], validation: &Validation) -> Result<Claims> {
68+
pub fn verify(token: &str, key: &[u8], validation: &Validation) -> Result<Claims> {
7069
let validation: &jsonwebtoken::Validation = &validation.borrow().into();
7170

7271
let first_alg = validation.algorithms.first().ok_or(Error::new(
7372
Status::InvalidArg,
74-
format!("Validation `algorithms` should contain at least one valid algorithm"),
73+
"Validation `algorithms` should contain at least one valid algorithm".to_string(),
7574
))?;
7675
let verify_key = &into_decoding_key(key, first_alg)?;
7776

@@ -87,7 +86,7 @@ impl Task for VerifyTask {
8786
type JsValue = Claims;
8887

8988
fn compute(&mut self) -> Result<Self::Output> {
90-
VerifyTask::verify(&self.token, &self.key.as_ref(), &self.validation)
89+
VerifyTask::verify(&self.token, self.key.as_ref(), &self.validation)
9190
}
9291

9392
fn resolve(&mut self, _env: Env, output: Self::Output) -> Result<Self::JsValue> {

0 commit comments

Comments
 (0)