mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2026-05-12 17:09:39 -06:00
Add redundant_else clippy lint
Removes 8 redundant else blocks where the preceding if arm always diverges, and adds the lint to the workspace deny list to prevent regressions.
This commit is contained in:
parent
f21a3adae2
commit
def93ae78f
@ -325,6 +325,7 @@ needless_continue = "deny"
|
||||
needless_lifetimes = "deny"
|
||||
option_option = "deny"
|
||||
redundant_clone = "deny"
|
||||
redundant_else = "deny"
|
||||
ref_option = "deny"
|
||||
string_add_assign = "deny"
|
||||
unnecessary_join = "deny"
|
||||
|
||||
@ -851,9 +851,8 @@ impl<'r> FromRequest<'r> for AdminToken {
|
||||
// Else, return a 401 failure, which will be caught
|
||||
if requested_page.is_empty() {
|
||||
return Outcome::Forward(Status::Unauthorized);
|
||||
} else {
|
||||
return Outcome::Error((Status::Unauthorized, "Unauthorized"));
|
||||
}
|
||||
return Outcome::Error((Status::Unauthorized, "Unauthorized"));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -1085,13 +1085,12 @@ async fn send_invite(
|
||||
Some(user) => {
|
||||
if Membership::find_by_user_and_org(&user.uuid, &org_id, &conn).await.is_some() {
|
||||
err!(format!("User already in organization: {email}"))
|
||||
} else {
|
||||
// automatically accept existing users if mail is disabled
|
||||
if !CONFIG.mail_enabled() && !user.password_hash.is_empty() {
|
||||
member_status = MembershipStatus::Accepted as i32;
|
||||
}
|
||||
user
|
||||
}
|
||||
// automatically accept existing users if mail is disabled
|
||||
if !CONFIG.mail_enabled() && !user.password_hash.is_empty() {
|
||||
member_status = MembershipStatus::Accepted as i32;
|
||||
}
|
||||
user
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -1037,9 +1037,8 @@ fn validate_config(cfg: &ConfigItems, on_update: bool) -> Result<(), Error> {
|
||||
Supported flags: {:?}\n", invalid_flags, SUPPORTED_FEATURE_FLAGS);
|
||||
if on_update {
|
||||
err!(feature_flags_error);
|
||||
} else {
|
||||
println!("[WARNING] {feature_flags_error}");
|
||||
}
|
||||
println!("[WARNING] {feature_flags_error}");
|
||||
}
|
||||
|
||||
const MAX_FILESIZE_KB: i64 = i64::MAX >> 10;
|
||||
|
||||
@ -271,15 +271,14 @@ impl DbConnType {
|
||||
|
||||
#[cfg(not(postgresql))]
|
||||
err!("`DATABASE_URL` is a PostgreSQL URL, but the 'postgresql' feature is not enabled")
|
||||
|
||||
//Sqlite
|
||||
} else {
|
||||
#[cfg(sqlite)]
|
||||
return Ok(DbConnType::Sqlite);
|
||||
|
||||
#[cfg(not(sqlite))]
|
||||
err!("`DATABASE_URL` looks like a SQLite URL, but 'sqlite' feature is not enabled")
|
||||
}
|
||||
|
||||
// Sqlite
|
||||
#[cfg(sqlite)]
|
||||
return Ok(DbConnType::Sqlite);
|
||||
|
||||
#[cfg(not(sqlite))]
|
||||
err!("`DATABASE_URL` looks like a SQLite URL, but 'sqlite' feature is not enabled")
|
||||
}
|
||||
|
||||
pub fn get_init_stmts(&self) -> String {
|
||||
|
||||
@ -124,9 +124,8 @@ impl Cipher {
|
||||
"object": "error"
|
||||
});
|
||||
err_json!(err_json, "Import validation errors")
|
||||
} else {
|
||||
Ok(())
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@ -584,9 +583,8 @@ impl Cipher {
|
||||
if let Some(ref org_uuid) = self.organization_uuid {
|
||||
if let Some(cipher_sync_data) = cipher_sync_data {
|
||||
return cipher_sync_data.user_group_full_access_for_organizations.contains(org_uuid);
|
||||
} else {
|
||||
return Group::is_in_full_access_group(user_uuid, org_uuid, conn).await;
|
||||
}
|
||||
return Group::is_in_full_access_group(user_uuid, org_uuid, conn).await;
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
10
src/mail.rs
10
src/mail.rs
@ -664,10 +664,9 @@ async fn send_with_selected_transport(email: Message) -> EmptyResult {
|
||||
} else if e.is_response() {
|
||||
debug!("Sendmail response error: {e:?}");
|
||||
err!(format!("Sendmail response error: {e}"));
|
||||
} else {
|
||||
debug!("Sendmail error: {e:?}");
|
||||
err!(format!("Sendmail error: {e}"));
|
||||
}
|
||||
debug!("Sendmail error: {e:?}");
|
||||
err!(format!("Sendmail error: {e}"));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -695,10 +694,9 @@ async fn send_with_selected_transport(email: Message) -> EmptyResult {
|
||||
} else if e.is_tls() {
|
||||
debug!("SMTP encryption error: {e:#?}");
|
||||
err!(format!("SMTP encryption error: {e}"));
|
||||
} else {
|
||||
debug!("SMTP error: {e:#?}");
|
||||
err!(format!("SMTP error: {e}"));
|
||||
}
|
||||
debug!("SMTP error: {e:#?}");
|
||||
err!(format!("SMTP error: {e}"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user