From 3174bd5a39fbca7e611069d2ebd4fd55af955e47 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Tue, 23 Jun 2026 11:24:04 +0100 Subject: [PATCH] rustfmt again --- crates/integration-tests/src/test/mod.rs | 2 +- crates/kcli/src/main.rs | 2 +- crates/kcli/src/resolve_egress_path.rs | 17 ++++--- crates/kumo-api-types/src/egress_path.rs | 5 +- .../src/http_server/resolve_egress_path_v1.rs | 48 ++++++++++--------- crates/kumod/src/mod_kumo.rs | 2 +- 6 files changed, 43 insertions(+), 33 deletions(-) diff --git a/crates/integration-tests/src/test/mod.rs b/crates/integration-tests/src/test/mod.rs index b99f9ff3..a28c5285 100644 --- a/crates/integration-tests/src/test/mod.rs +++ b/crates/integration-tests/src/test/mod.rs @@ -28,7 +28,6 @@ mod http_inject_template_syntax_error; mod http_liveness; mod idna_starttls; mod inspect_ready_q; -mod resolve_egress_path; mod log_oob_arf; mod maildir_batch; mod maildir_batch_452; @@ -46,6 +45,7 @@ mod rebind; mod rebind_event_defined; mod rebind_event_missing; mod rebind_port; +mod resolve_egress_path; mod retry_schedule; mod rewrite_server_response; mod source_health; diff --git a/crates/kcli/src/main.rs b/crates/kcli/src/main.rs index 20a2730f..3998da27 100644 --- a/crates/kcli/src/main.rs +++ b/crates/kcli/src/main.rs @@ -11,11 +11,11 @@ mod bounce_list; mod inspect_message; mod inspect_ready_q; mod inspect_sched_q; -mod resolve_egress_path; mod logfilter; mod provider_summary; mod queue_summary; mod rebind; +mod resolve_egress_path; mod spool_compact; mod suspend; mod suspend_cancel; diff --git a/crates/kcli/src/resolve_egress_path.rs b/crates/kcli/src/resolve_egress_path.rs index 768eb914..08878834 100644 --- a/crates/kcli/src/resolve_egress_path.rs +++ b/crates/kcli/src/resolve_egress_path.rs @@ -60,7 +60,11 @@ impl ResolveEgressPathCommand { let mut out = std::io::stdout().lock(); if self.config { - write!(out, "{}", mod_serde::toml_encode_pretty_compact(&response.path_config)?)?; + write!( + out, + "{}", + mod_serde::toml_encode_pretty_compact(&response.path_config)? + )?; return Ok(()); } if self.constraints { @@ -73,10 +77,7 @@ impl ResolveEgressPathCommand { } } -fn render_default( - r: &ResolveEgressPathV1Response, - out: &mut dyn Write, -) -> anyhow::Result<()> { +fn render_default(r: &ResolveEgressPathV1Response, out: &mut dyn Write) -> anyhow::Result<()> { writeln!(out, "domain: {}", r.domain)?; writeln!(out, "source: {}", r.source)?; writeln!(out, "queue: {}", r.queue_name)?; @@ -90,7 +91,11 @@ fn render_default( writeln!(out)?; writeln!(out, "--- egress path config ---")?; writeln!(out)?; - writeln!(out, "{}", mod_serde::toml_encode_pretty_compact(&r.path_config)?)?; + writeln!( + out, + "{}", + mod_serde::toml_encode_pretty_compact(&r.path_config)? + )?; writeln!(out, "--- effective ceilings ---")?; writeln!(out)?; diff --git a/crates/kumo-api-types/src/egress_path.rs b/crates/kumo-api-types/src/egress_path.rs index 15f7ec62..b6d84eb9 100644 --- a/crates/kumo-api-types/src/egress_path.rs +++ b/crates/kumo-api-types/src/egress_path.rs @@ -849,7 +849,10 @@ impl EffectiveConstraints { .map(|c| c.display.clone()) .or_else(|| self.max_message_rate_declared.clone()); - merge_axis(&mut self.max_concurrent_dispatchers, &other.max_concurrent_dispatchers); + merge_axis( + &mut self.max_concurrent_dispatchers, + &other.max_concurrent_dispatchers, + ); merge_optional(&mut self.max_message_rate, &other.max_message_rate); merge_optional(&mut self.max_connection_rate, &other.max_connection_rate); merge_optional( diff --git a/crates/kumod/src/http_server/resolve_egress_path_v1.rs b/crates/kumod/src/http_server/resolve_egress_path_v1.rs index 2170828e..444d4ff1 100644 --- a/crates/kumod/src/http_server/resolve_egress_path_v1.rs +++ b/crates/kumod/src/http_server/resolve_egress_path_v1.rs @@ -1,13 +1,11 @@ use crate::queue::Queue; use crate::ready_queue::{ReadyQueueManager, GET_EGRESS_PATH_CONFIG_SIG}; use axum::extract::{Json, Query}; -use kumo_api_types::egress_path::{ - EgressPathConfig, EffectiveConstraints, MxResolution, -}; +use kumo_api_types::egress_path::{EffectiveConstraints, EgressPathConfig, MxResolution}; use kumo_api_types::{ResolveEgressPathV1Request, ResolveEgressPathV1Response}; -use serde_json::Value; use kumo_server_common::config_handle::ConfigHandle; use kumo_server_common::http_server::AppError; +use serde_json::Value; /// Resolve the effective egress path configuration and throughput /// ceilings for a destination domain and egress source. @@ -40,25 +38,29 @@ pub async fn resolve_v1( let queue_config_value: Value = serde_json::to_value(&queue_config)?; let queue_config = ConfigHandle::new(queue_config); - let (queue_name, site_name, mx) = - match ReadyQueueManager::compute_queue_name(&request.domain, &queue_config, &source).await - { - Ok(ready_name) => { - let mx = ready_name.mx.as_ref().map(|m| MxResolution::from(&**m)); - (ready_name.name, ready_name.site_name, mx) - } - Err(_) => { - // DNS resolution failed (or wasn't applicable). Fall - // back to using `domain` as the site name so we can - // still synthesize a queue name and look up the path - // config, matching the behavior of - // resolve-shaping-domain. - let site_name = request.domain.clone(); - let proto_part = queue_config.borrow().protocol.ready_queue_name(); - let queue_name = format!("{source}->{site_name}@{proto_part}"); - (queue_name, site_name, None) - } - }; + let (queue_name, site_name, mx) = match ReadyQueueManager::compute_queue_name( + &request.domain, + &queue_config, + &source, + ) + .await + { + Ok(ready_name) => { + let mx = ready_name.mx.as_ref().map(|m| MxResolution::from(&**m)); + (ready_name.name, ready_name.site_name, mx) + } + Err(_) => { + // DNS resolution failed (or wasn't applicable). Fall + // back to using `domain` as the site name so we can + // still synthesize a queue name and look up the path + // config, matching the behavior of + // resolve-shaping-domain. + let site_name = request.domain.clone(); + let proto_part = queue_config.borrow().protocol.ready_queue_name(); + let queue_name = format!("{source}->{site_name}@{proto_part}"); + (queue_name, site_name, None) + } + }; let path_config: EgressPathConfig = config .async_call_callback( diff --git a/crates/kumod/src/mod_kumo.rs b/crates/kumod/src/mod_kumo.rs index 6984a64a..d5f5ba4c 100644 --- a/crates/kumod/src/mod_kumo.rs +++ b/crates/kumod/src/mod_kumo.rs @@ -7,7 +7,7 @@ use crate::smtp_server::{ }; use anyhow::Context; use config::{any_err, from_lua_value, get_or_create_module, SerdeWrappedValue}; -use kumo_api_types::egress_path::{EgressPathConfig, EffectiveConstraints}; +use kumo_api_types::egress_path::{EffectiveConstraints, EgressPathConfig}; use kumo_log_types::rfc3464::ReportGenerationParams; use kumo_log_types::JsonLogRecord; use kumo_server_common::http_server::HttpListenerParams;