Update to code to Rust 1.67
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Pierre HUBERT 2023-02-02 10:22:15 +01:00
parent 107b613be5
commit f2e4826b14
4 changed files with 16 additions and 26 deletions

View File

@ -289,8 +289,7 @@ pub async fn token(
&query, &query,
"invalid_request", "invalid_request",
&format!( &format!(
"Authorization header does not start with 'Basic ', got '{:#?}'", "Authorization header does not start with 'Basic ', got '{v:#?}'"
v
), ),
)); ));
} }
@ -538,10 +537,7 @@ fn user_info_error(err: &str, description: &str) -> HttpResponse {
HttpResponse::Unauthorized() HttpResponse::Unauthorized()
.insert_header(( .insert_header((
"WWW-Authenticate", "WWW-Authenticate",
format!( format!("Bearer error=\"{err}\", error_description=\"{description}\""),
"Bearer error=\"{}\", error_description=\"{}\"",
err, description
),
)) ))
.finish() .finish()
} }

View File

@ -70,11 +70,8 @@ impl<'a> Action<'a> {
user.quick_identity() user.quick_identity()
), ),
Action::LoginWebauthnAttempt { success, user_id } => match success { Action::LoginWebauthnAttempt { success, user_id } => match success {
true => format!( true => format!("successfully performed webauthn attempt for user {user_id:?}"),
"successfully performed webauthn attempt for user {:?}", false => format!("performed FAILED webauthn attempt for user {user_id:?}"),
user_id
),
false => format!("performed FAILED webauthn attempt for user {:?}", user_id),
}, },
Action::Signout => "signed out".to_string(), Action::Signout => "signed out".to_string(),
Action::UserNeed2FAOnLogin(user) => { Action::UserNeed2FAOnLogin(user) => {
@ -90,16 +87,14 @@ impl<'a> Action<'a> {
"successfully authenticated as {}, but need to set a new password", "successfully authenticated as {}, but need to set a new password",
user.quick_identity() user.quick_identity()
), ),
Action::TryLoginWithDisabledAccount(login) => format!( Action::TryLoginWithDisabledAccount(login) => {
"successfully authenticated as {}, but this is a DISABLED ACCOUNT", format!("successfully authenticated as {login}, but this is a DISABLED ACCOUNT")
login }
), Action::FailedLoginWithBadCredentials(login) => {
Action::FailedLoginWithBadCredentials(login) => format!( format!("attempted to authenticate as {login} but with a WRONG PASSWORD")
"attempted to authenticate as {} but with a WRONG PASSWORD", }
login
),
Action::UserChangedPasswordOnLogin(user_id) => { Action::UserChangedPasswordOnLogin(user_id) => {
format!("set a new password at login as user {:?}", user_id) format!("set a new password at login as user {user_id:?}")
} }
Action::OTPLoginAttempt { user, success } => match success { Action::OTPLoginAttempt { user, success } => match success {
true => format!( true => format!(
@ -120,7 +115,7 @@ impl<'a> Action<'a> {
"added a new factor to his account : {}", "added a new factor to his account : {}",
factor.quick_description(), factor.quick_description(),
), ),
Action::Removed2FAFactor { factor_id } => format!("Removed his factor {:?}", factor_id), Action::Removed2FAFactor { factor_id } => format!("Removed his factor {factor_id:?}"),
} }
} }
} }

View File

@ -13,7 +13,7 @@ impl EntityManager<User> {
F: FnOnce(User) -> User, F: FnOnce(User) -> User,
{ {
let user = match self.find_by_user_id(id)? { let user = match self.find_by_user_id(id)? {
None => return new_error(format!("Failed to find user {:?}", id)), None => return new_error(format!("Failed to find user {id:?}")),
Some(user) => user, Some(user) => user,
}; };
@ -134,8 +134,7 @@ impl UsersSyncBackend for EntityManager<User> {
let user = match self.find_by_user_id(id)? { let user = match self.find_by_user_id(id)? {
None => { None => {
return new_error(format!( return new_error(format!(
"Could not delete account {:?} because it was not found!", "Could not delete account {id:?} because it was not found!"
id
)); ));
} }
Some(s) => s, Some(s) => s,

View File

@ -24,8 +24,8 @@ pub fn apply_env_vars(val: &str) -> String {
let value = match std::env::var(varname) { let value = match std::env::var(varname) {
Ok(v) => v, Ok(v) => v,
Err(e) => { Err(e) => {
log::error!("Failed to find environment variable {}!", varname); log::error!("Failed to find environment variable {varname}!");
eprintln!("Failed to find environment variable! {:?}", e); eprintln!("Failed to find environment variable! {e:?}");
std::process::exit(2); std::process::exit(2);
} }
}; };