1
0
mirror of https://github.com/matrix-org/matrix-authentication-service.git synced 2025-07-29 22:01:14 +03:00

Enable the clippy::str_to_string lint

This commit is contained in:
Quentin Gliech
2022-08-05 10:18:32 +02:00
parent 78fe152d9b
commit c1ed726dc8
39 changed files with 120 additions and 81 deletions

View File

@ -317,7 +317,7 @@ pub async fn compat_login(
// TODO: pass verifiers list as parameter
// Verify the password in a blocking thread to avoid blocking the async executor
let password = password.to_string();
let password = password.to_owned();
task::spawn_blocking(move || {
let context = Argon2::default();
let hasher = PasswordHash::new(&hashed_password)?;

View File

@ -15,7 +15,7 @@
//! Interactions with the database
#![forbid(unsafe_code)]
#![deny(clippy::all, rustdoc::broken_intra_doc_links)]
#![deny(clippy::all, clippy::str_to_string, rustdoc::broken_intra_doc_links)]
#![warn(clippy::pedantic)]
#![allow(
clippy::missing_errors_doc,

View File

@ -51,7 +51,7 @@ pub async fn add_access_token(
Ok(AccessToken {
data: res.id,
expires_after,
token: token.to_string(),
token: token.to_owned(),
jti: format!("{}", res.id),
created_at: res.created_at,
})

View File

@ -49,7 +49,7 @@ pub async fn add_refresh_token(
Ok(RefreshToken {
data: res.id,
token: token.to_string(),
token: token.to_owned(),
access_token: Some(access_token),
created_at: res.created_at,
})

View File

@ -73,7 +73,7 @@ pub async fn login(
.map_err(|source| {
if source.not_found() {
LoginError::NotFound {
username: username.to_string(),
username: username.to_owned(),
source,
}
} else {
@ -87,7 +87,7 @@ pub async fn login(
.map_err(|source| {
if matches!(source, AuthenticationError::Password { .. }) {
LoginError::Authentication {
username: username.to_string(),
username: username.to_owned(),
source,
}
} else {
@ -297,7 +297,7 @@ pub async fn authenticate_session(
// TODO: pass verifiers list as parameter
// Verify the password in a blocking thread to avoid blocking the async executor
let password = password.to_string();
let password = password.to_owned();
task::spawn_blocking(move || {
let context = Argon2::default();
let hasher = PasswordHash::new(&hashed_password).map_err(AuthenticationError::Password)?;
@ -353,7 +353,7 @@ pub async fn register_user(
let user = User {
data: id,
username: username.to_string(),
username: username.to_owned(),
sub: format!("fake-sub-{}", id),
primary_email: None,
};