From 7bb2f53af7b19c5c3c7987e077b580ef3d401493 Mon Sep 17 00:00:00 2001 From: Robbie McKinstry Date: Fri, 19 Dec 2025 22:42:43 -0500 Subject: [PATCH 1/4] Fix lints and warnings, add skeleton for Vercel platform. --- .gitignore | 4 +- src/adapters/backend/deploy_meta.rs | 2 +- src/adapters/backend/mod.rs | 6 +-- src/adapters/cloudflare/metrics.rs | 1 + src/adapters/cloudflare/uploads.rs | 6 +++ src/adapters/mod.rs | 5 ++- src/adapters/platforms/mod.rs | 1 + src/adapters/platforms/vercel.rs | 62 +++++++++++++++++++++++++++++ src/artifacts/cloudflare/mod.rs | 3 ++ src/cmd/init.rs | 3 +- src/config/mod.rs | 1 - src/fs/mod.rs | 4 ++ src/fs/wrangler.rs | 2 + src/numbers/mod.rs | 3 ++ src/stats/contingency.rs | 4 ++ src/stats/histogram.rs | 3 ++ src/subsystems/controller/mod.rs | 3 +- src/subsystems/error_logs/mod.rs | 10 ++++- src/subsystems/handle.rs | 2 +- src/subsystems/mod.rs | 2 +- src/subsystems/monitor/mail.rs | 6 +-- src/utils/mod.rs | 2 +- 22 files changed, 116 insertions(+), 19 deletions(-) create mode 100644 src/adapters/platforms/vercel.rs diff --git a/.gitignore b/.gitignore index c8985e0..224a7ea 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +/docs + /target *.zip *.txt @@ -14,4 +16,4 @@ MultiTool.yaml # Remove any workers user for development /worker/** wrangler.toml -wrangler.json \ No newline at end of file +wrangler.json diff --git a/src/adapters/backend/deploy_meta.rs b/src/adapters/backend/deploy_meta.rs index 7f40969..7769d53 100644 --- a/src/adapters/backend/deploy_meta.rs +++ b/src/adapters/backend/deploy_meta.rs @@ -16,7 +16,7 @@ pub(crate) type RolloutId = u64; /// rollout. This struct is mostly used in conjuction with a `BackendClient` /// to hold the context for the current rollout. #[derive(Builder, Getters, Clone)] -pub(crate) struct RolloutMetadata { +pub struct RolloutMetadata { workspace_id: WorkspaceId, application_id: ApplicationId, rollout_id: RolloutId, diff --git a/src/adapters/backend/mod.rs b/src/adapters/backend/mod.rs index 3c615e3..82bce9d 100644 --- a/src/adapters/backend/mod.rs +++ b/src/adapters/backend/mod.rs @@ -23,7 +23,7 @@ use tokio::sync::mpsc::Sender; use tokio::sync::oneshot; use tokio::time::Duration; -pub(crate) use deploy_meta::*; +pub use deploy_meta::*; use tracing::trace; /// Write the CLI's version to a @@ -427,8 +427,8 @@ impl BackendClient { pub(crate) async fn create_application>( &self, - workspace_id: WorkspaceId, - name: T, + _workspace_id: WorkspaceId, + _name: T, ) -> Result { self.is_authenicated()?; diff --git a/src/adapters/cloudflare/metrics.rs b/src/adapters/cloudflare/metrics.rs index 4de3781..d62738e 100644 --- a/src/adapters/cloudflare/metrics.rs +++ b/src/adapters/cloudflare/metrics.rs @@ -49,6 +49,7 @@ pub struct EventData { #[derive(Deserialize, Debug)] pub struct RequestData { + #[allow(dead_code)] // TODO: Why is this dead? pub url: String, pub method: String, pub path: String, diff --git a/src/adapters/cloudflare/uploads.rs b/src/adapters/cloudflare/uploads.rs index 0704e18..8e7486f 100644 --- a/src/adapters/cloudflare/uploads.rs +++ b/src/adapters/cloudflare/uploads.rs @@ -4,6 +4,9 @@ use serde::{Deserialize, Serialize}; use crate::{adapters::cloudflare::deployments::Binding, fs::wrangler::Wrangler}; +// this is probably dead because we bundle the upload, +// which we won't do in the future. +#[allow(dead_code)] #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] pub struct UploadSessionResponse { pub jwt: String, @@ -11,6 +14,9 @@ pub struct UploadSessionResponse { pub buckets: Vec>, } +// this is probably dead because we bundle the upload, +// which we won't do in the future. +#[allow(dead_code)] #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] pub struct UploadAssetsResponse { pub jwt: String, diff --git a/src/adapters/mod.rs b/src/adapters/mod.rs index 6ff6097..b22c2c7 100644 --- a/src/adapters/mod.rs +++ b/src/adapters/mod.rs @@ -1,7 +1,8 @@ -pub use backend::BackendClient; -pub(crate) use backend::{LockedState, RolloutMetadata}; +pub use backend::{RolloutMetadata, BackendClient}; pub use cloudflare::CloudflareClient; +pub(crate) use backend::{LockedState}; + pub use ingresses::*; pub use monitors::*; pub use platforms::*; diff --git a/src/adapters/platforms/mod.rs b/src/adapters/platforms/mod.rs index e7c9a6a..7bd3776 100644 --- a/src/adapters/platforms/mod.rs +++ b/src/adapters/platforms/mod.rs @@ -36,6 +36,7 @@ impl Shutdownable for MockPlatform { mod cloudflare; mod lambda; +mod vercel; #[cfg(test)] mod tests { diff --git a/src/adapters/platforms/vercel.rs b/src/adapters/platforms/vercel.rs new file mode 100644 index 0000000..b450dc3 --- /dev/null +++ b/src/adapters/platforms/vercel.rs @@ -0,0 +1,62 @@ +#![allow(dead_code)] +// TODO: This module will not be dead code once we allow the Vercel +// platform to be constructed. + +use crate::{ + Shutdownable, + adapters::{backend::PlatformConfig}, + subsystems::ShutdownResult, +}; + +use super::Platform; +use async_trait::async_trait; +use derive_getters::Getters; +use miette::Result; + +// Placeholder: Eventually, we will implement a proper Vercel client. +// For now, we mock this as a unit type since we know it will be a required +// parameter later. +type VercelClient = (); + +#[derive(Getters)] +pub struct Vercel { + client: VercelClient, +} + +impl Vercel { + pub fn new(client: VercelClient) -> Self { + Self { + client, + } + } +} + +#[async_trait] +impl Platform for Vercel { + fn get_config(&self) -> PlatformConfig { + todo!(); + } + + async fn deploy(&mut self) -> Result<(String, String)> { + todo!(); + } + + async fn yank_canary(&mut self) -> Result<()> { + todo!(); + } + + async fn delete_canary(&mut self) -> Result<()> { + todo!(); + } + + async fn promote_rollout(&mut self) -> Result<()> { + todo!(); + } +} + +#[async_trait] +impl Shutdownable for Vercel { + async fn shutdown(&mut self) -> ShutdownResult { + todo!(); + } +} diff --git a/src/artifacts/cloudflare/mod.rs b/src/artifacts/cloudflare/mod.rs index 9e777d2..2d4aa29 100644 --- a/src/artifacts/cloudflare/mod.rs +++ b/src/artifacts/cloudflare/mod.rs @@ -11,6 +11,9 @@ pub(crate) use manifest::CloudflareFileManifest; mod manifest; +// this is probably dead because we bundle the upload, +// which we won't do in the future. +#[allow(dead_code)] pub async fn read_file_as_b64>(filepath: P, sink: &mut impl Write) -> Result<()> { let path = filepath.as_ref(); let mut encoder = EncoderWriter::new(sink, &STANDARD); diff --git a/src/cmd/init.rs b/src/cmd/init.rs index b272f89..d5adb3d 100644 --- a/src/cmd/init.rs +++ b/src/cmd/init.rs @@ -268,6 +268,7 @@ impl InitStateMachine for PromptWorkspace { struct PromptApplication { manifest: Arc>, terminal: Arc, + #[allow(dead_code)] // TODO: why is this field unused? fs: FileSystem, workspace_id: u32, backend: BackendClient, @@ -318,7 +319,7 @@ impl InitStateMachine for PromptApplication { // Create the application // Since we have a todo! in the create_application method, // this code will not actually run until that's implemented - let application = match self + let _application = match self .backend .create_application(self.workspace_id, application_name.clone()) .await diff --git a/src/config/mod.rs b/src/config/mod.rs index 909700d..4aca83e 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -1,7 +1,6 @@ pub use cli::Cli; pub use init::InitSubcommand; pub use login::LoginSubcommand; -pub use proxy::ProxySubcommand; pub use run::RunSubcommand; mod cli; diff --git a/src/fs/mod.rs b/src/fs/mod.rs index f500d5c..b60bad5 100644 --- a/src/fs/mod.rs +++ b/src/fs/mod.rs @@ -227,12 +227,16 @@ pub struct ManifestMissing; #[error("Wrangler JSON or TOML file required for Cloudflare Workers")] pub struct WranglerMissing; + /// A shorthand for referring to one of the $XDG directories. /// As we need additional directories, we'll add them to the enum. pub enum DirectoryType { /// The directory for non-essential project files Cache, /// Persistent data lives here between runs. + // We will probably need this later, like when we need to check + // version expiration dates without phoning home. + #[allow(dead_code)] Data, /// The application root directory is the dir that contains the manifest /// file relevant to the current operating context. It's usually diff --git a/src/fs/wrangler.rs b/src/fs/wrangler.rs index 28317a6..7ed43b0 100644 --- a/src/fs/wrangler.rs +++ b/src/fs/wrangler.rs @@ -3,6 +3,8 @@ use derive_getters::Getters; use serde::{Deserialize, Serialize}; use std::collections::HashMap; +// TODO: Check whether this type is actually needed. +#[allow(dead_code)] #[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq)] pub struct Vars { #[serde(flatten)] diff --git a/src/numbers/mod.rs b/src/numbers/mod.rs index 99f6261..379710a 100644 --- a/src/numbers/mod.rs +++ b/src/numbers/mod.rs @@ -3,7 +3,10 @@ use std::fmt; pub(crate) use errors::OutOfRangeError; +// TODO: why is this type unused? +#[allow(dead_code)] pub type CpuUsage = FixedPrecisionNumber<2>; + pub use whole_number::WholeNumber; pub use whole_percent::WholePercent; diff --git a/src/stats/contingency.rs b/src/stats/contingency.rs index 8a8b10d..953f96c 100644 --- a/src/stats/contingency.rs +++ b/src/stats/contingency.rs @@ -1,3 +1,7 @@ +#![allow(dead_code)] +// We may eventually remove this module, since I think it has been +// superseded by code on the backend, but I'm not totally sure. + use std::num::NonZeroUsize; use crate::stats::{Categorical, histogram::Histogram}; diff --git a/src/stats/histogram.rs b/src/stats/histogram.rs index 066ee2d..a249c3f 100644 --- a/src/stats/histogram.rs +++ b/src/stats/histogram.rs @@ -64,16 +64,19 @@ where } /// Reset the given bins to zero. + #[allow(dead_code)] fn clear_category(&mut self, cat: &C) { let index = cat.category(); self.bins[index] = 0; } + #[allow(dead_code)] pub(super) fn set_count(&mut self, cat: &C, count: u32) { self.clear_category(cat); self.increment_by(cat, count); } + #[allow(dead_code)] pub(super) fn get_count_by_index(&self, i: usize) -> u32 { if i >= N { panic!( diff --git a/src/subsystems/controller/mod.rs b/src/subsystems/controller/mod.rs index c19154f..aa92adc 100644 --- a/src/subsystems/controller/mod.rs +++ b/src/subsystems/controller/mod.rs @@ -2,13 +2,12 @@ use async_trait::async_trait; use bon::bon; use miette::{Report, Result}; use tokio_graceful_shutdown::{IntoSubsystem, SubsystemBuilder, SubsystemHandle}; -use tracing::{debug, error, trace}; +use tracing::{debug, trace}; use crate::adapters::{BackendClient, BoxedIngress, BoxedMonitor, BoxedPlatform, RolloutMetadata}; use crate::subsystems::PLATFORM_SUBSYSTEM_NAME; use crate::{IngressSubsystem, PlatformSubsystem}; -use crate::subsystems::{ERROR_LOGS_SUBSYSTEM_NAME, ErrorLogsController}; use monitor::{MONITOR_CONTROLLER_SUBSYSTEM_NAME, MonitorController}; use super::{INGRESS_SUBSYSTEM_NAME, RELAY_SUBSYSTEM_NAME, RelaySubsystem}; diff --git a/src/subsystems/error_logs/mod.rs b/src/subsystems/error_logs/mod.rs index 8c19d04..89ffd60 100644 --- a/src/subsystems/error_logs/mod.rs +++ b/src/subsystems/error_logs/mod.rs @@ -1,3 +1,9 @@ +#![allow(dead_code)] +// This module temporarily allows dead code, because we initially +// built it to demo the Agentic SRE functionality, which we are +// not currently productionizing. We will remove this code if we +// choose not to productionize, or make use of it if we do. + use std::time::Duration; use crate::adapters::{BackendClient, RolloutMetadata}; @@ -14,8 +20,8 @@ use crate::adapters::{CloudflareClient, backend::MonitorConfig}; /// The frequency with which we poll Cloudflare for error logs. const DEFAULT_POLL_INTERVAL: Duration = Duration::from_secs(60); -/// The name of the error logs subsystem. -pub const ERROR_LOGS_SUBSYSTEM_NAME: &str = "errorlogs"; +// The name of the error logs subsystem. +// pub const ERROR_LOGS_SUBSYSTEM_NAME: &str = "errorlogs"; /// The ErrorLogsController is responsible for periodically fetching /// error logs from Cloudflare. diff --git a/src/subsystems/handle.rs b/src/subsystems/handle.rs index bed94f3..5b7ae04 100644 --- a/src/subsystems/handle.rs +++ b/src/subsystems/handle.rs @@ -9,7 +9,7 @@ use super::{ShutdownResult, Shutdownable}; /// A handle to a thread, communicating over a channel. /// The type `M` can be specialized to implement communication /// with different subsystems. -pub(crate) struct Handle { +pub struct Handle { pub(super) outbox: Arc>, pub(super) shutdown_trigger: Arc>, } diff --git a/src/subsystems/mod.rs b/src/subsystems/mod.rs index 9edeb95..88b8910 100644 --- a/src/subsystems/mod.rs +++ b/src/subsystems/mod.rs @@ -2,7 +2,7 @@ use async_trait::async_trait; use miette::Diagnostic; pub use controller::{CONTROLLER_SUBSYSTEM_NAME, ControllerSubsystem}; -pub use error_logs::{ERROR_LOGS_SUBSYSTEM_NAME, ErrorLogsController}; +// pub use error_logs::{ERROR_LOGS_SUBSYSTEM_NAME, ErrorLogsController}; pub use ingress::{INGRESS_SUBSYSTEM_NAME, IngressSubsystem}; pub use monitor::{MONITOR_SUBSYSTEM_NAME, MonitorSubsystem}; diff --git a/src/subsystems/monitor/mail.rs b/src/subsystems/monitor/mail.rs index 0cb4305..9d53a6f 100644 --- a/src/subsystems/monitor/mail.rs +++ b/src/subsystems/monitor/mail.rs @@ -44,13 +44,13 @@ impl Monitor for MonitorHandle { } } -pub(crate) enum MonitorMail { +pub enum MonitorMail { Query(QueryParams), SetBaselineVersionId(VersionParams), SetCanaryVersionId(VersionParams), } -pub(crate) struct QueryParams { +pub struct QueryParams { /// The sender where the response is written. pub(super) outbox: oneshot::Sender>, } @@ -61,7 +61,7 @@ impl QueryParams { } } -pub(crate) struct VersionParams { +pub struct VersionParams { /// The sender where the response is written. pub(super) outbox: oneshot::Sender, pub(super) version_id: String, diff --git a/src/utils/mod.rs b/src/utils/mod.rs index 32a6f45..b26ebcc 100644 --- a/src/utils/mod.rs +++ b/src/utils/mod.rs @@ -18,7 +18,7 @@ pub async fn load_default_aws_config() -> &'static SdkConfig { async fn load_config() -> SdkConfig { // We don't need a particular version, but we pin to one to ensure // it doesn't accidently slip if `latest` gets updated without our knowledge. - let behavior = BehaviorVersion::v2025_01_17(); + let behavior = BehaviorVersion::v2025_08_07(); aws_config::load_defaults(behavior).await } From 67ca06b76197144e3859e1b178aee2d01877af84 Mon Sep 17 00:00:00 2001 From: Robbie McKinstry Date: Fri, 19 Dec 2025 22:48:56 -0500 Subject: [PATCH 2/4] Apply fmt --- src/adapters/cloudflare/uploads.rs | 4 ++-- src/adapters/mod.rs | 4 ++-- src/adapters/platforms/vercel.rs | 10 ++-------- src/artifacts/cloudflare/mod.rs | 2 +- src/fs/mod.rs | 1 - 5 files changed, 7 insertions(+), 14 deletions(-) diff --git a/src/adapters/cloudflare/uploads.rs b/src/adapters/cloudflare/uploads.rs index 8e7486f..4954a7c 100644 --- a/src/adapters/cloudflare/uploads.rs +++ b/src/adapters/cloudflare/uploads.rs @@ -5,7 +5,7 @@ use serde::{Deserialize, Serialize}; use crate::{adapters::cloudflare::deployments::Binding, fs::wrangler::Wrangler}; // this is probably dead because we bundle the upload, -// which we won't do in the future. +// which we won't do in the future. #[allow(dead_code)] #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] pub struct UploadSessionResponse { @@ -15,7 +15,7 @@ pub struct UploadSessionResponse { } // this is probably dead because we bundle the upload, -// which we won't do in the future. +// which we won't do in the future. #[allow(dead_code)] #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] pub struct UploadAssetsResponse { diff --git a/src/adapters/mod.rs b/src/adapters/mod.rs index b22c2c7..6cd7490 100644 --- a/src/adapters/mod.rs +++ b/src/adapters/mod.rs @@ -1,7 +1,7 @@ -pub use backend::{RolloutMetadata, BackendClient}; +pub use backend::{BackendClient, RolloutMetadata}; pub use cloudflare::CloudflareClient; -pub(crate) use backend::{LockedState}; +pub(crate) use backend::LockedState; pub use ingresses::*; pub use monitors::*; diff --git a/src/adapters/platforms/vercel.rs b/src/adapters/platforms/vercel.rs index b450dc3..02990a6 100644 --- a/src/adapters/platforms/vercel.rs +++ b/src/adapters/platforms/vercel.rs @@ -2,11 +2,7 @@ // TODO: This module will not be dead code once we allow the Vercel // platform to be constructed. -use crate::{ - Shutdownable, - adapters::{backend::PlatformConfig}, - subsystems::ShutdownResult, -}; +use crate::{Shutdownable, adapters::backend::PlatformConfig, subsystems::ShutdownResult}; use super::Platform; use async_trait::async_trait; @@ -25,9 +21,7 @@ pub struct Vercel { impl Vercel { pub fn new(client: VercelClient) -> Self { - Self { - client, - } + Self { client } } } diff --git a/src/artifacts/cloudflare/mod.rs b/src/artifacts/cloudflare/mod.rs index 2d4aa29..1307492 100644 --- a/src/artifacts/cloudflare/mod.rs +++ b/src/artifacts/cloudflare/mod.rs @@ -12,7 +12,7 @@ pub(crate) use manifest::CloudflareFileManifest; mod manifest; // this is probably dead because we bundle the upload, -// which we won't do in the future. +// which we won't do in the future. #[allow(dead_code)] pub async fn read_file_as_b64>(filepath: P, sink: &mut impl Write) -> Result<()> { let path = filepath.as_ref(); diff --git a/src/fs/mod.rs b/src/fs/mod.rs index b60bad5..2c61be6 100644 --- a/src/fs/mod.rs +++ b/src/fs/mod.rs @@ -227,7 +227,6 @@ pub struct ManifestMissing; #[error("Wrangler JSON or TOML file required for Cloudflare Workers")] pub struct WranglerMissing; - /// A shorthand for referring to one of the $XDG directories. /// As we need additional directories, we'll add them to the enum. pub enum DirectoryType { From 92f0572004b36df67a1e74d6570eb14e69cc2583 Mon Sep 17 00:00:00 2001 From: Robbie McKinstry Date: Fri, 19 Dec 2025 22:50:13 -0500 Subject: [PATCH 3/4] Auto-fix lints with `clippy --fix` --- src/adapters/backend/mod.rs | 16 ++++---- src/adapters/cloudflare/deployments.rs | 7 +--- src/adapters/cloudflare/metrics.rs | 6 +-- src/adapters/cloudflare/mod.rs | 5 +-- src/adapters/ingresses/apig.rs | 56 ++++++++------------------ src/adapters/platforms/lambda.rs | 14 ++----- src/artifacts/cloudflare/manifest.rs | 7 ++-- src/cmd/init.rs | 2 +- src/cmd/run/mod.rs | 6 +-- src/config/cli.rs | 2 +- src/fs/manifest/schema.rs | 3 +- src/stats/histogram.rs | 2 +- src/terminal/logging.rs | 2 +- 13 files changed, 46 insertions(+), 82 deletions(-) diff --git a/src/adapters/backend/mod.rs b/src/adapters/backend/mod.rs index 82bce9d..402dc1e 100644 --- a/src/adapters/backend/mod.rs +++ b/src/adapters/backend/mod.rs @@ -84,7 +84,7 @@ impl BackendClient { pub fn is_authenicated(&self) -> Result<()> { if self.session.clone().is_some_and(Session::is_not_expired) { - return Ok(()); + Ok(()) } else { bail!("Please login before running this command."); } @@ -343,9 +343,9 @@ impl BackendClient { }; let metrics = StatusCodeMetrics { app_group: group, - status_2xx_count: item.get_count(&ResponseStatusCode::_2XX) as u32, - status_4xx_count: item.get_count(&ResponseStatusCode::_4XX) as u32, - status_5xx_count: item.get_count(&ResponseStatusCode::_5XX) as u32, + status_2xx_count: item.get_count(&ResponseStatusCode::_2XX), + status_4xx_count: item.get_count(&ResponseStatusCode::_4XX), + status_5xx_count: item.get_count(&ResponseStatusCode::_5XX), created_at: item.created_at().to_rfc3339(), }; @@ -454,7 +454,7 @@ impl BackendClient { if workspaces.len() > 1 { bail!("More than one workspace with the given name found."); - } else if workspaces.len() < 1 { + } else if workspaces.is_empty() { bail!("No workspace with the given name exists for this account"); } else { // TODO: We can simplify this code with .ok_or() @@ -488,7 +488,7 @@ impl BackendClient { let application = if applications.len() > 1 { bail!("More than one application with the given name found."); - } else if applications.len() < 1 { + } else if applications.is_empty() { bail!("No application with the given name exists for this account"); } else { // TODO: We can simplify this code with .ok_or() @@ -535,8 +535,8 @@ impl BackendConfig { // • Convert the Option to a String. let origin = origin.map(|val| val.as_ref().to_owned()); // • Set up the default configuration values. - let jwt = session.and_then(|session| match session { - Session::User(creds) => Some(creds.jwt), + let jwt = session.map(|session| match session { + Session::User(creds) => creds.jwt, }); let conf = Configuration { base_path: origin.unwrap_or(MULTITOOL_ORIGIN.to_string()), diff --git a/src/adapters/cloudflare/deployments.rs b/src/adapters/cloudflare/deployments.rs index a4b83ae..f1cc4af 100644 --- a/src/adapters/cloudflare/deployments.rs +++ b/src/adapters/cloudflare/deployments.rs @@ -3,16 +3,13 @@ use derive_getters::Getters; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] +#[derive(Default)] pub enum DeploymentStrategy { #[serde(rename = "percentage")] + #[default] Percentage, } -impl Default for DeploymentStrategy { - fn default() -> Self { - Self::Percentage - } -} #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Builder, Getters)] pub struct CreateDeploymentRequest { diff --git a/src/adapters/cloudflare/metrics.rs b/src/adapters/cloudflare/metrics.rs index d62738e..4c06798 100644 --- a/src/adapters/cloudflare/metrics.rs +++ b/src/adapters/cloudflare/metrics.rs @@ -79,11 +79,11 @@ pub struct CloudflareErrorLog { pub logs: Vec, } -impl Into> for ErrorLogsResponse { - fn into(self) -> Vec { +impl From for Vec { + fn from(val: ErrorLogsResponse) -> Self { let mut error_logs = Vec::new(); - for (_request_id, invocations) in self.invocations { + for (_request_id, invocations) in val.invocations { // The cf-worker-event entry contains the request/response details let event_entry = invocations .iter() diff --git a/src/adapters/cloudflare/mod.rs b/src/adapters/cloudflare/mod.rs index 2dc6355..56c3ea4 100644 --- a/src/adapters/cloudflare/mod.rs +++ b/src/adapters/cloudflare/mod.rs @@ -397,9 +397,8 @@ impl CloudflareClient { let count = metrics_response .result - .calculations - .get(0) - .and_then(|c| c.aggregates.get(0).cloned()) + .calculations.first() + .and_then(|c| c.aggregates.first().cloned()) .map_or(0, |a| a.count); Ok(count) diff --git a/src/adapters/ingresses/apig.rs b/src/adapters/ingresses/apig.rs index a172508..d60b566 100644 --- a/src/adapters/ingresses/apig.rs +++ b/src/adapters/ingresses/apig.rs @@ -68,14 +68,11 @@ impl AwsApiGateway { let error_message = match err { SdkError::ServiceError(service_err) => { // Extract the specific service error details - format!( - "{}", - service_err + service_err .err() .meta() .message() - .unwrap_or("No error message found") - ) + .unwrap_or("No error message found").to_string() } _ => format!("{:?}", err), }; @@ -110,14 +107,11 @@ impl AwsApiGateway { let error_message = match err { SdkError::ServiceError(service_err) => { // Extract the specific service error details - format!( - "{}", - service_err + service_err .err() .meta() .message() - .unwrap_or("No error message found") - ) + .unwrap_or("No error message found").to_string() } _ => format!("{:?}", err), }; @@ -157,14 +151,11 @@ impl AwsApiGateway { let error_message = match err { SdkError::ServiceError(service_err) => { // Extract the specific service error details - format!( - "{}", - service_err + service_err .err() .meta() .message() - .unwrap_or("No error message found") - ) + .unwrap_or("No error message found").to_string() } _ => format!("{:?}", err), }; @@ -217,14 +208,11 @@ impl Ingress for AwsApiGateway { let error_message = match err { SdkError::ServiceError(service_err) => { // Extract the specific service error details - format!( - "{}", - service_err + service_err .err() .meta() .message() - .unwrap_or("No error message found") - ) + .unwrap_or("No error message found").to_string() } _ => format!("{:?}", err), }; @@ -256,14 +244,11 @@ impl Ingress for AwsApiGateway { let error_message = match err { SdkError::ServiceError(service_err) => { // Extract the specific service error details - format!( - "{}", - service_err + service_err .err() .meta() .message() - .unwrap_or("No error message found") - ) + .unwrap_or("No error message found").to_string() } _ => format!("{:?}", err), }; @@ -291,14 +276,11 @@ impl Ingress for AwsApiGateway { let error_message = match err { SdkError::ServiceError(service_err) => { // Extract the specific service error details - format!( - "{}", - service_err + service_err .err() .meta() .message() - .unwrap_or("No error message found") - ) + .unwrap_or("No error message found").to_string() } _ => format!("{:?}", err), }; @@ -337,14 +319,11 @@ impl Ingress for AwsApiGateway { let error_message = match err { SdkError::ServiceError(service_err) => { // Extract the specific service error details - format!( - "{}", - service_err + service_err .err() .meta() .message() - .unwrap_or("No error message found") - ) + .unwrap_or("No error message found").to_string() } _ => format!("{:?}", err), }; @@ -394,14 +373,11 @@ impl Ingress for AwsApiGateway { let error_message = match err { SdkError::ServiceError(service_err) => { // Extract the specific service error details - format!( - "{}", - service_err + service_err .err() .meta() .message() - .unwrap_or("No error message found") - ) + .unwrap_or("No error message found").to_string() } _ => format!("{:?}", err), }; diff --git a/src/adapters/platforms/lambda.rs b/src/adapters/platforms/lambda.rs index 443dae1..c83b92a 100644 --- a/src/adapters/platforms/lambda.rs +++ b/src/adapters/platforms/lambda.rs @@ -72,14 +72,11 @@ impl Platform for LambdaPlatform { let error_message = match err { SdkError::ServiceError(service_err) => { // Extract the specific service error details - format!( - "{}", - service_err + service_err .err() .meta() .message() - .unwrap_or("No error message found") - ) + .unwrap_or("No error message found").to_string() } _ => format!("{:?}", err), }; @@ -115,14 +112,11 @@ impl Platform for LambdaPlatform { let error_message = match err { SdkError::ServiceError(service_err) => { // Extract the specific service error details - format!( - "{}", - service_err + service_err .err() .meta() .message() - .unwrap_or("No error message found") - ) + .unwrap_or("No error message found").to_string() } _ => format!("{:?}", err), }; diff --git a/src/artifacts/cloudflare/manifest.rs b/src/artifacts/cloudflare/manifest.rs index ecb5138..f1b2919 100644 --- a/src/artifacts/cloudflare/manifest.rs +++ b/src/artifacts/cloudflare/manifest.rs @@ -45,18 +45,17 @@ impl CloudflareFileManifest { let file_entry = entry.into_diagnostic()?; // Ignore directories, we only want files. - if file_entry.file_type().map_or(false, |ft| ft.is_dir()) { + if file_entry.file_type().is_some_and(|ft| ft.is_dir()) { continue; } let file_path = file_entry.path().to_path_buf(); // Skip files with names that match manifest filenames - if let Some(filename) = file_path.file_name().and_then(|n| n.to_str()) { - if manifest_filenames.contains(&filename.to_string()) { + if let Some(filename) = file_path.file_name().and_then(|n| n.to_str()) + && manifest_filenames.contains(&filename.to_string()) { continue; } - } files.push(file_path); } diff --git a/src/cmd/init.rs b/src/cmd/init.rs index d5adb3d..817c1e7 100644 --- a/src/cmd/init.rs +++ b/src/cmd/init.rs @@ -53,7 +53,7 @@ impl Init { // the toml and toml_edit crates to preserve comments // in the TOML files we read. // https://docs.rs/toml_edit/latest/toml_edit/ - if let Ok(_) = fs.application_manifest() { + if fs.application_manifest().is_ok() { info!( "It looks like you already have an initialized application manifest. Exiting." ); diff --git a/src/cmd/run/mod.rs b/src/cmd/run/mod.rs index 348d94f..f30b255 100644 --- a/src/cmd/run/mod.rs +++ b/src/cmd/run/mod.rs @@ -10,7 +10,7 @@ use multitool_sdk::models::{ApplicationDetails, WorkspaceSummary}; use thiserror::Error; use tokio::join; use tokio::runtime::Runtime; -use tracing::{debug, error, info}; +use tracing::{debug, info}; use crate::Terminal; @@ -102,7 +102,7 @@ impl Run { let workspace_not_found = miette!("The workspace {name} does not exist within your account."); self.backend - .get_workspace_by_name(&name) + .get_workspace_by_name(name) .await .context(workspace_not_found) } @@ -135,7 +135,7 @@ impl Run { let application_not_found = miette!("The application {name} does not exist within the workspace {workspace_name}."); self.backend - .get_application_by_name(workspace.id, &name) + .get_application_by_name(workspace.id, name) .await .context(application_not_found) } diff --git a/src/config/cli.rs b/src/config/cli.rs index d6017f6..a573f36 100644 --- a/src/config/cli.rs +++ b/src/config/cli.rs @@ -1,4 +1,4 @@ -use clap::{Parser, command}; +use clap::Parser; use derive_getters::Getters; use tracing::level_filters::LevelFilter; diff --git a/src/fs/manifest/schema.rs b/src/fs/manifest/schema.rs index aa899ba..871f97c 100644 --- a/src/fs/manifest/schema.rs +++ b/src/fs/manifest/schema.rs @@ -3,7 +3,6 @@ use std::{path::PathBuf, sync::OnceLock}; use miette::{Diagnostic, miette}; use serde::{Deserialize, Serialize}; use thiserror::Error; -use tracing::error; use crate::{ adapters::{ @@ -307,7 +306,7 @@ impl AwsLambdaConfig { return Ok(path.to_path_buf()); } - return Ok(PathBuf::from(&self.artifact_path)); + Ok(PathBuf::from(&self.artifact_path)) } async fn load_platform(&self, args: &RunSubcommand) -> Result { diff --git a/src/stats/histogram.rs b/src/stats/histogram.rs index a249c3f..409be48 100644 --- a/src/stats/histogram.rs +++ b/src/stats/histogram.rs @@ -60,7 +60,7 @@ where /// Reset all bins to zero. pub fn clear(&mut self) { - self.bins = Box::new([0; N]); + *self.bins = [0; N]; } /// Reset the given bins to zero. diff --git a/src/terminal/logging.rs b/src/terminal/logging.rs index ff0a7bd..652575d 100644 --- a/src/terminal/logging.rs +++ b/src/terminal/logging.rs @@ -26,7 +26,7 @@ pub(super) fn setup_logger(level: LevelFilter) { .with_line_number(false) .with_target(false) // Scope the subscriber to ONLY the multitool module. - .with_env_filter(format!("multitool={}", level.to_string())) + .with_env_filter(format!("multitool={}", level)) .compact() .finish(); From f159ba66157b60d7b593ac7882c7e13f0ef67434 Mon Sep 17 00:00:00 2001 From: Robbie McKinstry Date: Fri, 19 Dec 2025 22:58:41 -0500 Subject: [PATCH 4/4] Apply fmt --- src/adapters/cloudflare/deployments.rs | 4 +- src/adapters/cloudflare/mod.rs | 3 +- src/adapters/ingresses/apig.rs | 72 ++++++++++++++------------ src/adapters/platforms/lambda.rs | 18 ++++--- src/artifacts/cloudflare/manifest.rs | 7 +-- 5 files changed, 57 insertions(+), 47 deletions(-) diff --git a/src/adapters/cloudflare/deployments.rs b/src/adapters/cloudflare/deployments.rs index f1cc4af..02825a8 100644 --- a/src/adapters/cloudflare/deployments.rs +++ b/src/adapters/cloudflare/deployments.rs @@ -2,15 +2,13 @@ use bon::Builder; use derive_getters::Getters; use serde::{Deserialize, Serialize}; -#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] -#[derive(Default)] +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)] pub enum DeploymentStrategy { #[serde(rename = "percentage")] #[default] Percentage, } - #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Builder, Getters)] pub struct CreateDeploymentRequest { #[serde(default)] diff --git a/src/adapters/cloudflare/mod.rs b/src/adapters/cloudflare/mod.rs index 56c3ea4..14e03ca 100644 --- a/src/adapters/cloudflare/mod.rs +++ b/src/adapters/cloudflare/mod.rs @@ -397,7 +397,8 @@ impl CloudflareClient { let count = metrics_response .result - .calculations.first() + .calculations + .first() .and_then(|c| c.aggregates.first().cloned()) .map_or(0, |a| a.count); diff --git a/src/adapters/ingresses/apig.rs b/src/adapters/ingresses/apig.rs index d60b566..ec16485 100644 --- a/src/adapters/ingresses/apig.rs +++ b/src/adapters/ingresses/apig.rs @@ -69,10 +69,11 @@ impl AwsApiGateway { SdkError::ServiceError(service_err) => { // Extract the specific service error details service_err - .err() - .meta() - .message() - .unwrap_or("No error message found").to_string() + .err() + .meta() + .message() + .unwrap_or("No error message found") + .to_string() } _ => format!("{:?}", err), }; @@ -108,10 +109,11 @@ impl AwsApiGateway { SdkError::ServiceError(service_err) => { // Extract the specific service error details service_err - .err() - .meta() - .message() - .unwrap_or("No error message found").to_string() + .err() + .meta() + .message() + .unwrap_or("No error message found") + .to_string() } _ => format!("{:?}", err), }; @@ -152,10 +154,11 @@ impl AwsApiGateway { SdkError::ServiceError(service_err) => { // Extract the specific service error details service_err - .err() - .meta() - .message() - .unwrap_or("No error message found").to_string() + .err() + .meta() + .message() + .unwrap_or("No error message found") + .to_string() } _ => format!("{:?}", err), }; @@ -209,10 +212,11 @@ impl Ingress for AwsApiGateway { SdkError::ServiceError(service_err) => { // Extract the specific service error details service_err - .err() - .meta() - .message() - .unwrap_or("No error message found").to_string() + .err() + .meta() + .message() + .unwrap_or("No error message found") + .to_string() } _ => format!("{:?}", err), }; @@ -245,10 +249,11 @@ impl Ingress for AwsApiGateway { SdkError::ServiceError(service_err) => { // Extract the specific service error details service_err - .err() - .meta() - .message() - .unwrap_or("No error message found").to_string() + .err() + .meta() + .message() + .unwrap_or("No error message found") + .to_string() } _ => format!("{:?}", err), }; @@ -277,10 +282,11 @@ impl Ingress for AwsApiGateway { SdkError::ServiceError(service_err) => { // Extract the specific service error details service_err - .err() - .meta() - .message() - .unwrap_or("No error message found").to_string() + .err() + .meta() + .message() + .unwrap_or("No error message found") + .to_string() } _ => format!("{:?}", err), }; @@ -320,10 +326,11 @@ impl Ingress for AwsApiGateway { SdkError::ServiceError(service_err) => { // Extract the specific service error details service_err - .err() - .meta() - .message() - .unwrap_or("No error message found").to_string() + .err() + .meta() + .message() + .unwrap_or("No error message found") + .to_string() } _ => format!("{:?}", err), }; @@ -374,10 +381,11 @@ impl Ingress for AwsApiGateway { SdkError::ServiceError(service_err) => { // Extract the specific service error details service_err - .err() - .meta() - .message() - .unwrap_or("No error message found").to_string() + .err() + .meta() + .message() + .unwrap_or("No error message found") + .to_string() } _ => format!("{:?}", err), }; diff --git a/src/adapters/platforms/lambda.rs b/src/adapters/platforms/lambda.rs index c83b92a..20f1751 100644 --- a/src/adapters/platforms/lambda.rs +++ b/src/adapters/platforms/lambda.rs @@ -73,10 +73,11 @@ impl Platform for LambdaPlatform { SdkError::ServiceError(service_err) => { // Extract the specific service error details service_err - .err() - .meta() - .message() - .unwrap_or("No error message found").to_string() + .err() + .meta() + .message() + .unwrap_or("No error message found") + .to_string() } _ => format!("{:?}", err), }; @@ -113,10 +114,11 @@ impl Platform for LambdaPlatform { SdkError::ServiceError(service_err) => { // Extract the specific service error details service_err - .err() - .meta() - .message() - .unwrap_or("No error message found").to_string() + .err() + .meta() + .message() + .unwrap_or("No error message found") + .to_string() } _ => format!("{:?}", err), }; diff --git a/src/artifacts/cloudflare/manifest.rs b/src/artifacts/cloudflare/manifest.rs index f1b2919..c3e9107 100644 --- a/src/artifacts/cloudflare/manifest.rs +++ b/src/artifacts/cloudflare/manifest.rs @@ -53,9 +53,10 @@ impl CloudflareFileManifest { // Skip files with names that match manifest filenames if let Some(filename) = file_path.file_name().and_then(|n| n.to_str()) - && manifest_filenames.contains(&filename.to_string()) { - continue; - } + && manifest_filenames.contains(&filename.to_string()) + { + continue; + } files.push(file_path); }