Skip to content

Commit 5444549

Browse files
committed
Code refactor using Clippy
1 parent 668fba6 commit 5444549

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/middleware/authen_middleware.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ where
5252

5353
fn call(&mut self, mut req: ServiceRequest) -> Self::Future {
5454
// Bypass some account routes
55-
for ignore_route in constants::IGNORE_ROUTES.into_iter() {
55+
for ignore_route in constants::IGNORE_ROUTES.iter() {
5656
if req.path().starts_with(ignore_route) {
5757
return Either::A(self.service.call(req));
5858
}

src/models/user_token.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::models::user::LoginInfoDTO;
22
use jsonwebtoken::Header;
33

4-
pub static KEY: &'static [u8; 16] = include_bytes!("../secret.key");
4+
pub static KEY: [u8; 16] = *include_bytes!("../secret.key");
55
static ONE_WEEK: i64 = 60 * 60 * 24 * 7;
66

77
#[derive(Serialize, Deserialize)]
@@ -25,6 +25,6 @@ impl UserToken {
2525
login_session: login.login_session,
2626
};
2727

28-
jsonwebtoken::encode(&Header::default(), &payload, KEY).unwrap()
28+
jsonwebtoken::encode(&Header::default(), &payload, &KEY).unwrap()
2929
}
3030
}

src/utils/token_utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use actix_web::web;
99
use jsonwebtoken::{TokenData, Validation};
1010

1111
pub fn decode_token(token: String) -> jsonwebtoken::errors::Result<TokenData<UserToken>> {
12-
jsonwebtoken::decode::<UserToken>(&token, KEY, &Validation::default())
12+
jsonwebtoken::decode::<UserToken>(&token, &KEY, &Validation::default())
1313
}
1414

1515
pub fn verify_token(token_data: &TokenData<UserToken>, pool: &web::Data<Pool>) -> Result<String, String> {

0 commit comments

Comments
 (0)