diff --git a/apps/toolgate/crates/switchyard-adapters/src/native/public.rs b/apps/toolgate/crates/switchyard-adapters/src/native/public.rs index abe4c9a6..20762f25 100644 --- a/apps/toolgate/crates/switchyard-adapters/src/native/public.rs +++ b/apps/toolgate/crates/switchyard-adapters/src/native/public.rs @@ -121,8 +121,8 @@ pub fn filings_from_submissions(cik: &str, sub: &Value, form: Option<&str>, max: let (forms, dates, accs, docs) = (col("form"), col("filingDate"), col("accessionNumber"), col("primaryDocument")); let cik_num = cik.trim_start_matches('0'); let mut out = Vec::new(); - for i in 0..forms.len() { - let f = forms[i].as_str().unwrap_or(""); + for (i, f) in forms.iter().enumerate() { + let f = f.as_str().unwrap_or(""); if form.map(|want| !f.eq_ignore_ascii_case(want)).unwrap_or(false) { continue; } diff --git a/apps/toolgate/crates/switchyard-auth/src/oauth.rs b/apps/toolgate/crates/switchyard-auth/src/oauth.rs index 3c4dfadd..af314ef9 100644 --- a/apps/toolgate/crates/switchyard-auth/src/oauth.rs +++ b/apps/toolgate/crates/switchyard-auth/src/oauth.rs @@ -330,6 +330,7 @@ impl AuthServer { u.to_string() } + #[allow(clippy::too_many_arguments)] async fn issue_tokens( &self, family_id: &str, diff --git a/apps/toolgate/crates/switchyard-cli/src/lib.rs b/apps/toolgate/crates/switchyard-cli/src/lib.rs index d1d24b5e..bf05b6fb 100644 --- a/apps/toolgate/crates/switchyard-cli/src/lib.rs +++ b/apps/toolgate/crates/switchyard-cli/src/lib.rs @@ -30,7 +30,7 @@ pub async fn main_entry() -> i32 { pub fn usd(micros: i64) -> String { let sign = if micros < 0 { "-" } else { "" }; let m = micros.unsigned_abs(); - if m % 10_000 == 0 { + if m.is_multiple_of(10_000) { format!("{sign}${}.{:02}", m / 1_000_000, (m % 1_000_000) / 10_000) } else { format!("{sign}${}.{:06}", m / 1_000_000, m % 1_000_000) diff --git a/apps/toolgate/crates/switchyard-core/src/price.rs b/apps/toolgate/crates/switchyard-core/src/price.rs index 7093f592..aa351d47 100644 --- a/apps/toolgate/crates/switchyard-core/src/price.rs +++ b/apps/toolgate/crates/switchyard-core/src/price.rs @@ -105,7 +105,7 @@ impl Price { /// /// - `status`: provider HTTP status class of the final attempt (0 = network/timeout). /// - `units`: units the adapter observed (results returned, seconds rendered). - /// - `reported_cost`: the provider's own reported charge, when it has one. + /// - `reported_cost`: amount the upstream billed us for this call, if it tells us. /// - `bill_on_4xx`: tool flag; only applies to `per_call` pricing. /// - `hold`: the reserved amount; a capture never exceeds it. pub fn settle(&self, status: u16, units: Option, reported_cost: Option, bill_on_4xx: bool, hold: i64) -> i64 { diff --git a/apps/toolgate/crates/switchyard-mcp/src/lib.rs b/apps/toolgate/crates/switchyard-mcp/src/lib.rs index 3383cc9c..aac70f05 100644 --- a/apps/toolgate/crates/switchyard-mcp/src/lib.rs +++ b/apps/toolgate/crates/switchyard-mcp/src/lib.rs @@ -144,7 +144,7 @@ pub async fn handle_http_body(backend: &dyn McpBackend, body: &Value) -> Option< out.push(r); } } - (!out.is_empty()).then(|| Value::Array(out)) + (!out.is_empty()).then_some(Value::Array(out)) } single => handle_message(backend, single).await, } diff --git a/apps/toolgate/crates/switchyard-server/src/vaultops.rs b/apps/toolgate/crates/switchyard-server/src/vaultops.rs index 268f9742..fccb9965 100644 --- a/apps/toolgate/crates/switchyard-server/src/vaultops.rs +++ b/apps/toolgate/crates/switchyard-server/src/vaultops.rs @@ -109,8 +109,5 @@ pub async fn resolve(st: &AppState, org_id: &str, tool: &ToolManifest) -> Result /// Team keys for third-party providers are unmetered; our own products and /// platform credentials are metered at the tool's price. pub fn metered(kind: ProviderKind, cred: Option<&Credential>) -> bool { - match (kind, cred) { - (ProviderKind::Byo | ProviderKind::Public, Some(c)) if !c.platform => false, - _ => true, - } + !matches!((kind, cred), (ProviderKind::Byo | ProviderKind::Public, Some(c)) if !c.platform) }