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:
Taylor Tumlin 2026-05-08 15:26:15 -04:00
parent f21a3adae2
commit def93ae78f
7 changed files with 21 additions and 28 deletions

View File

@ -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"

View File

@ -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"));
}
};

View File

@ -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
}
};

View File

@ -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;

View File

@ -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 {

View File

@ -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
}

View File

@ -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}"));
}
}
}