Browse Source

Fix fmt and clippy on Rust 1.95

The rebase onto upstream main bumped rust-toolchain to 1.95, which
flagged two things the 1.94 compiler didn't catch:

- rustfmt collapses build_redirect_uri's signature onto one line
- clippy's collapsible_if catches the nested if in validate_config

Style only, no behavior change.
pull/7127/head
nathanmoreton 3 weeks ago
parent
commit
a2d60c352b
  1. 5
      src/api/core/sso_cookie_vendor.rs
  2. 11
      src/config.rs

5
src/api/core/sso_cookie_vendor.rs

@ -69,10 +69,7 @@ fn sso_cookie_vendor(cookies: &CookieJar<'_>) -> Result<Redirect, (Status, Html<
/// ///
/// Checks for a single (non-sharded) cookie first. If found, it takes precedence. /// Checks for a single (non-sharded) cookie first. If found, it takes precedence.
/// Otherwise, checks for sharded cookies ({name}-0 through {name}-19). /// Otherwise, checks for sharded cookies ({name}-0 through {name}-19).
fn build_redirect_uri( fn build_redirect_uri(cookie_name: &str, cookies: &HashMap<String, String>) -> Result<String, (Status, Html<String>)> {
cookie_name: &str,
cookies: &HashMap<String, String>,
) -> Result<String, (Status, Html<String>)> {
// Check for the single (non-sharded) cookie — takes precedence over shards // Check for the single (non-sharded) cookie — takes precedence over shards
if let Some(value) = cookies.get(cookie_name) { if let Some(value) = cookies.get(cookie_name) {
let encoded_value = url_encode(value); let encoded_value = url_encode(value);

11
src/config.rs

@ -1091,13 +1091,12 @@ fn validate_config(cfg: &ConfigItems, on_update: bool) -> Result<(), Error> {
validate_sso_master_password_policy(cfg.sso_master_password_policy.as_ref())?; validate_sso_master_password_policy(cfg.sso_master_password_policy.as_ref())?;
} }
if cfg.sso_cookie_vendor_enabled { if cfg.sso_cookie_vendor_enabled
if cfg.sso_cookie_vendor_idp_login_url.is_empty() && (cfg.sso_cookie_vendor_idp_login_url.is_empty()
|| cfg.sso_cookie_vendor_cookie_name.is_empty() || cfg.sso_cookie_vendor_cookie_name.is_empty()
|| cfg.sso_cookie_vendor_cookie_domain.is_empty() || cfg.sso_cookie_vendor_cookie_domain.is_empty())
{ {
err!("`SSO_COOKIE_VENDOR_IDP_LOGIN_URL`, `SSO_COOKIE_VENDOR_COOKIE_NAME` and `SSO_COOKIE_VENDOR_COOKIE_DOMAIN` must be set when SSO cookie vendor is enabled") err!("`SSO_COOKIE_VENDOR_IDP_LOGIN_URL`, `SSO_COOKIE_VENDOR_COOKIE_NAME` and `SSO_COOKIE_VENDOR_COOKIE_DOMAIN` must be set when SSO cookie vendor is enabled")
}
} }
if cfg._enable_yubico { if cfg._enable_yubico {

Loading…
Cancel
Save