From 44cecab3f43428e47e0f5d5b93aa8d0ecec2485c Mon Sep 17 00:00:00 2001 From: Gerald Pinder Date: Tue, 29 Apr 2025 00:50:28 -0400 Subject: [PATCH] chore: Format files --- process/drivers.rs | 4 +-- process/drivers/buildah_driver.rs | 4 +-- process/drivers/cosign_driver.rs | 6 ++-- process/drivers/docker_driver.rs | 4 +-- process/drivers/docker_driver/metadata.rs | 2 +- process/drivers/functions.rs | 4 +-- process/drivers/github_driver.rs | 4 +-- process/drivers/gitlab_driver.rs | 4 +-- process/drivers/local_driver.rs | 2 +- process/drivers/podman_driver.rs | 10 +++---- process/drivers/sigstore_driver.rs | 16 +++++------ process/drivers/skopeo_driver.rs | 4 +-- process/drivers/traits.rs | 4 +-- process/drivers/types.rs | 4 +-- process/logging.rs | 14 +++++----- process/signal_handler.rs | 6 ++-- recipe/src/lib.rs | 4 ++- recipe/src/maybe_version.rs | 2 +- recipe/src/module.rs | 4 +-- recipe/src/module_ext.rs | 2 +- recipe/src/recipe.rs | 2 +- recipe/src/stage.rs | 4 +-- recipe/src/stages_ext.rs | 2 +- src/commands.rs | 2 +- src/commands/bug_report.rs | 17 ++++++++---- src/commands/build.rs | 6 ++-- src/commands/generate.rs | 4 +-- src/commands/generate_iso.rs | 6 ++-- src/commands/init.rs | 11 ++++---- src/commands/login.rs | 2 +- src/commands/prune.rs | 2 +- src/commands/switch.rs | 2 +- src/commands/validate.rs | 2 +- src/commands/validate/yaml_span.rs | 10 +++---- src/rpm_ostree_status.rs | 34 ++++++++++++++--------- template/src/lib.rs | 10 +++++-- utils/build.rs | 2 +- utils/src/command_output.rs | 4 ++- utils/src/lib.rs | 6 ++-- utils/src/semver.rs | 2 +- utils/src/syntax_highlighting.rs | 2 +- utils/src/test_utils.rs | 2 +- 42 files changed, 130 insertions(+), 108 deletions(-) diff --git a/process/drivers.rs b/process/drivers.rs index 37f5e81..3e5a6ac 100644 --- a/process/drivers.rs +++ b/process/drivers.rs @@ -14,13 +14,13 @@ use std::{ time::Duration, }; -use bon::{bon, Builder}; +use bon::{Builder, bon}; use cached::proc_macro::cached; use clap::Args; use colored::Colorize; use indicatif::{ProgressBar, ProgressStyle}; use log::{info, trace, warn}; -use miette::{miette, IntoDiagnostic, Result}; +use miette::{IntoDiagnostic, Result, miette}; use oci_distribution::Reference; use opts::{ BuildOpts, BuildTagPushOpts, CheckKeyPairOpts, CreateContainerOpts, GenerateImageNameOpts, diff --git a/process/drivers/buildah_driver.rs b/process/drivers/buildah_driver.rs index 124704e..7a35484 100644 --- a/process/drivers/buildah_driver.rs +++ b/process/drivers/buildah_driver.rs @@ -4,14 +4,14 @@ use blue_build_utils::{credentials::Credentials, semver::Version}; use colored::Colorize; use comlexr::cmd; use log::{debug, error, info, trace}; -use miette::{bail, miette, IntoDiagnostic, Result}; +use miette::{IntoDiagnostic, Result, bail, miette}; use serde::Deserialize; use crate::{drivers::types::Platform, logging::CommandLogging}; use super::{ - opts::{BuildOpts, PushOpts, TagOpts}, BuildDriver, DriverVersion, + opts::{BuildOpts, PushOpts, TagOpts}, }; #[derive(Debug, Deserialize)] diff --git a/process/drivers/cosign_driver.rs b/process/drivers/cosign_driver.rs index d2fd7cd..e1bd0a5 100644 --- a/process/drivers/cosign_driver.rs +++ b/process/drivers/cosign_driver.rs @@ -7,14 +7,14 @@ use blue_build_utils::{ use colored::Colorize; use comlexr::{cmd, pipe}; use log::{debug, trace}; -use miette::{bail, Context, IntoDiagnostic, Result}; +use miette::{Context, IntoDiagnostic, Result, bail}; use crate::drivers::opts::VerifyType; use super::{ + SigningDriver, functions::get_private_key, opts::{CheckKeyPairOpts, GenerateKeyPairOpts, SignOpts, VerifyOpts}, - SigningDriver, }; #[derive(Debug)] @@ -195,8 +195,8 @@ mod test { use tempfile::TempDir; use crate::drivers::{ - opts::{CheckKeyPairOpts, GenerateKeyPairOpts}, SigningDriver, + opts::{CheckKeyPairOpts, GenerateKeyPairOpts}, }; use super::CosignDriver; diff --git a/process/drivers/docker_driver.rs b/process/drivers/docker_driver.rs index b742d5b..731cc40 100644 --- a/process/drivers/docker_driver.rs +++ b/process/drivers/docker_driver.rs @@ -15,7 +15,7 @@ use cached::proc_macro::cached; use colored::Colorize; use comlexr::{cmd, pipe}; use log::{debug, info, trace, warn}; -use miette::{bail, Context, IntoDiagnostic, Result}; +use miette::{Context, IntoDiagnostic, Result, bail}; use oci_distribution::Reference; use serde::Deserialize; use tempfile::TempDir; @@ -32,7 +32,7 @@ use crate::{ types::{ContainerId, ImageMetadata, Platform}, }, logging::CommandLogging, - signal_handler::{add_cid, remove_cid, ContainerRuntime, ContainerSignalId}, + signal_handler::{ContainerRuntime, ContainerSignalId, add_cid, remove_cid}, }; use super::opts::{CreateContainerOpts, RemoveContainerOpts, RemoveImageOpts}; diff --git a/process/drivers/docker_driver/metadata.rs b/process/drivers/docker_driver/metadata.rs index 75c9d8d..5fe5faf 100644 --- a/process/drivers/docker_driver/metadata.rs +++ b/process/drivers/docker_driver/metadata.rs @@ -1,6 +1,6 @@ use std::collections::HashMap; -use miette::{bail, Report}; +use miette::{Report, bail}; use serde::Deserialize; use crate::drivers::types::{ImageMetadata, Platform}; diff --git a/process/drivers/functions.rs b/process/drivers/functions.rs index e569ba2..3020ebe 100644 --- a/process/drivers/functions.rs +++ b/process/drivers/functions.rs @@ -1,10 +1,10 @@ use std::{env, path::Path}; use blue_build_utils::{ - constants::{BB_PRIVATE_KEY, COSIGN_PRIVATE_KEY, COSIGN_PRIV_PATH, COSIGN_PUB_PATH}, + constants::{BB_PRIVATE_KEY, COSIGN_PRIV_PATH, COSIGN_PRIVATE_KEY, COSIGN_PUB_PATH}, string, }; -use miette::{bail, Result}; +use miette::{Result, bail}; use super::opts::PrivateKey; diff --git a/process/drivers/github_driver.rs b/process/drivers/github_driver.rs index 6bcf894..7acccc6 100644 --- a/process/drivers/github_driver.rs +++ b/process/drivers/github_driver.rs @@ -16,7 +16,7 @@ use blue_build_utils::get_env_var; #[cfg(test)] use blue_build_utils::test_utils::get_env_var; -use super::{opts::GenerateTagsOpts, CiDriver, Driver}; +use super::{CiDriver, Driver, opts::GenerateTagsOpts}; mod event; @@ -153,7 +153,7 @@ mod test { use rstest::rstest; use crate::{ - drivers::{opts::GenerateTagsOpts, types::Platform, CiDriver}, + drivers::{CiDriver, opts::GenerateTagsOpts, types::Platform}, test::{TEST_TAG_1, TEST_TAG_2, TIMESTAMP}, }; diff --git a/process/drivers/gitlab_driver.rs b/process/drivers/gitlab_driver.rs index 1891fd5..3145787 100644 --- a/process/drivers/gitlab_driver.rs +++ b/process/drivers/gitlab_driver.rs @@ -18,7 +18,7 @@ use blue_build_utils::test_utils::get_env_var; use crate::drivers::Driver; -use super::{opts::GenerateTagsOpts, CiDriver}; +use super::{CiDriver, opts::GenerateTagsOpts}; pub struct GitlabDriver; @@ -165,7 +165,7 @@ mod test { use rstest::rstest; use crate::{ - drivers::{opts::GenerateTagsOpts, CiDriver}, + drivers::{CiDriver, opts::GenerateTagsOpts}, test::{TEST_TAG_1, TEST_TAG_2, TIMESTAMP}, }; diff --git a/process/drivers/local_driver.rs b/process/drivers/local_driver.rs index 85aecfa..2c3d11f 100644 --- a/process/drivers/local_driver.rs +++ b/process/drivers/local_driver.rs @@ -4,7 +4,7 @@ use blue_build_utils::string_vec; use comlexr::cmd; use log::trace; -use super::{opts::GenerateTagsOpts, CiDriver, Driver}; +use super::{CiDriver, Driver, opts::GenerateTagsOpts}; pub struct LocalDriver; diff --git a/process/drivers/podman_driver.rs b/process/drivers/podman_driver.rs index 3016306..95e4f8e 100644 --- a/process/drivers/podman_driver.rs +++ b/process/drivers/podman_driver.rs @@ -14,27 +14,27 @@ use colored::Colorize; use comlexr::{cmd, pipe}; use indicatif::{ProgressBar, ProgressStyle}; use log::{debug, error, info, trace}; -use miette::{bail, miette, IntoDiagnostic, Report, Result}; +use miette::{IntoDiagnostic, Report, Result, bail, miette}; use oci_distribution::Reference; use serde::Deserialize; use tempfile::TempDir; use crate::{ drivers::{ + BuildDriver, DriverVersion, InspectDriver, RunDriver, opts::{BuildOpts, GetMetadataOpts, PushOpts, RunOpts, RunOptsEnv, RunOptsVolume, TagOpts}, types::{ImageMetadata, Platform}, - BuildDriver, DriverVersion, InspectDriver, RunDriver, }, logging::{CommandLogging, Logger}, - signal_handler::{add_cid, remove_cid, ContainerRuntime, ContainerSignalId}, + signal_handler::{ContainerRuntime, ContainerSignalId, add_cid, remove_cid}, }; +#[cfg(feature = "rechunk")] +use super::{ContainerMountDriver, RechunkDriver, types::MountId}; use super::{ opts::{CreateContainerOpts, RemoveContainerOpts, RemoveImageOpts}, types::ContainerId, }; -#[cfg(feature = "rechunk")] -use super::{types::MountId, ContainerMountDriver, RechunkDriver}; const SUDO_PROMPT: &str = "Password for %u required to run 'podman' as privileged"; diff --git a/process/drivers/sigstore_driver.rs b/process/drivers/sigstore_driver.rs index dbe5d0f..49a0e71 100644 --- a/process/drivers/sigstore_driver.rs +++ b/process/drivers/sigstore_driver.rs @@ -1,14 +1,14 @@ use std::{fs, path::Path}; use crate::{ - drivers::opts::{PrivateKeyContents, VerifyType}, ASYNC_RUNTIME, + drivers::opts::{PrivateKeyContents, VerifyType}, }; use super::{ + SigningDriver, functions::get_private_key, opts::{CheckKeyPairOpts, GenerateKeyPairOpts, SignOpts, VerifyOpts}, - SigningDriver, }; use blue_build_utils::{ constants::{COSIGN_PRIV_PATH, COSIGN_PUB_PATH}, @@ -17,14 +17,14 @@ use blue_build_utils::{ }; use colored::Colorize; use log::{debug, trace}; -use miette::{bail, miette, Context, IntoDiagnostic}; +use miette::{Context, IntoDiagnostic, bail, miette}; use sigstore::{ cosign::{ + ClientBuilder, Constraint, CosignCapabilities, SignatureLayer, constraint::PrivateKeySigner, verification_constraint::{PublicKeyVerifier, VerificationConstraintVec}, - ClientBuilder, Constraint, CosignCapabilities, SignatureLayer, }, - crypto::{signing_key::SigStoreKeyPair, SigningScheme}, + crypto::{SigningScheme, signing_key::SigStoreKeyPair}, errors::SigstoreVerifyConstraintsError, registry::{Auth, OciReference}, }; @@ -167,8 +167,8 @@ impl SigningDriver for SigstoreDriver { .into_diagnostic() .with_context(|| { format!( - "Failed to push signature {cosign_signature_image} for image {image_digest}" - ) + "Failed to push signature {cosign_signature_image} for image {image_digest}" + ) }) })?; debug!("Successfully pushed signature"); @@ -242,9 +242,9 @@ mod test { use tempfile::TempDir; use crate::drivers::{ + SigningDriver, cosign_driver::CosignDriver, opts::{CheckKeyPairOpts, GenerateKeyPairOpts}, - SigningDriver, }; use super::SigstoreDriver; diff --git a/process/drivers/skopeo_driver.rs b/process/drivers/skopeo_driver.rs index 1616d5b..b78beb5 100644 --- a/process/drivers/skopeo_driver.rs +++ b/process/drivers/skopeo_driver.rs @@ -5,11 +5,11 @@ use colored::Colorize; use comlexr::cmd; use indicatif::{ProgressBar, ProgressStyle}; use log::{debug, trace}; -use miette::{bail, IntoDiagnostic, Result}; +use miette::{IntoDiagnostic, Result, bail}; use crate::{drivers::types::Platform, logging::Logger}; -use super::{opts::GetMetadataOpts, types::ImageMetadata, InspectDriver}; +use super::{InspectDriver, opts::GetMetadataOpts, types::ImageMetadata}; #[derive(Debug)] pub struct SkopeoDriver; diff --git a/process/drivers/traits.rs b/process/drivers/traits.rs index 8d22f02..f23d4a5 100644 --- a/process/drivers/traits.rs +++ b/process/drivers/traits.rs @@ -6,11 +6,11 @@ use std::{ use blue_build_utils::{constants::COSIGN_PUB_PATH, retry, semver::Version, string_vec}; use log::{debug, info, trace}; -use miette::{bail, Context, IntoDiagnostic, Result}; +use miette::{Context, IntoDiagnostic, Result, bail}; use oci_distribution::Reference; use semver::VersionReq; -use crate::drivers::{functions::get_private_key, types::CiDriverType, Driver}; +use crate::drivers::{Driver, functions::get_private_key, types::CiDriverType}; #[cfg(feature = "sigstore")] use super::sigstore_driver::SigstoreDriver; diff --git a/process/drivers/types.rs b/process/drivers/types.rs index edf540f..0e7cbc6 100644 --- a/process/drivers/types.rs +++ b/process/drivers/types.rs @@ -10,8 +10,8 @@ use serde::Deserialize; use serde_json::Value; use crate::drivers::{ - buildah_driver::BuildahDriver, docker_driver::DockerDriver, podman_driver::PodmanDriver, - DriverVersion, + DriverVersion, buildah_driver::BuildahDriver, docker_driver::DockerDriver, + podman_driver::PodmanDriver, }; pub(super) trait DetermineDriver { diff --git a/process/logging.rs b/process/logging.rs index 547741f..6cb7b2c 100644 --- a/process/logging.rs +++ b/process/logging.rs @@ -12,23 +12,23 @@ use std::{ use bon::Builder; use chrono::Local; -use colored::{control::ShouldColorize, ColoredString, Colorize}; +use colored::{ColoredString, Colorize, control::ShouldColorize}; use indicatif::{MultiProgress, ProgressBar}; use indicatif_log_bridge::LogWrapper; -use log::{warn, Level, LevelFilter, Record}; +use log::{Level, LevelFilter, Record, warn}; use log4rs::{ + Config, Logger as L4RSLogger, append::{ console::ConsoleAppender, rolling_file::{ - policy::compound::{ - roll::fixed_window::FixedWindowRoller, trigger::size::SizeTrigger, CompoundPolicy, - }, RollingFileAppender, + policy::compound::{ + CompoundPolicy, roll::fixed_window::FixedWindowRoller, trigger::size::SizeTrigger, + }, }, }, config::{Appender, Root}, - encode::{pattern::PatternEncoder, Encode, Write}, - Config, Logger as L4RSLogger, + encode::{Encode, Write, pattern::PatternEncoder}, }; use nu_ansi_term::Color; use private::Private; diff --git a/process/signal_handler.rs b/process/signal_handler.rs index 02a2831..4ff6c1d 100644 --- a/process/signal_handler.rs +++ b/process/signal_handler.rs @@ -2,7 +2,7 @@ use std::{ fs, path::PathBuf, process, - sync::{atomic::AtomicBool, Arc, Mutex}, + sync::{Arc, Mutex, atomic::AtomicBool}, thread, }; @@ -11,13 +11,13 @@ use comlexr::cmd; use log::{debug, error, trace, warn}; use nix::{ libc::{SIGABRT, SIGCONT, SIGHUP, SIGTSTP}, - sys::signal::{kill, Signal}, + sys::signal::{Signal, kill}, unistd::Pid, }; use signal_hook::{ consts::TERM_SIGNALS, flag, - iterator::{exfiltrator::WithOrigin, SignalsInfo}, + iterator::{SignalsInfo, exfiltrator::WithOrigin}, low_level, }; diff --git a/recipe/src/lib.rs b/recipe/src/lib.rs index 7e369f6..93274c5 100644 --- a/recipe/src/lib.rs +++ b/recipe/src/lib.rs @@ -36,7 +36,9 @@ pub(crate) fn base_recipe_path() -> &'static Path { if recipe_path.exists() && recipe_path.is_dir() { recipe_path } else { - warn!("Use of {CONFIG_PATH} for recipes is deprecated, please move your recipe files into {RECIPE_PATH}"); + warn!( + "Use of {CONFIG_PATH} for recipes is deprecated, please move your recipe files into {RECIPE_PATH}" + ); legacy_path } } diff --git a/recipe/src/maybe_version.rs b/recipe/src/maybe_version.rs index 4f8b0c6..8e14863 100644 --- a/recipe/src/maybe_version.rs +++ b/recipe/src/maybe_version.rs @@ -1,5 +1,5 @@ use blue_build_utils::semver::Version; -use serde::{de::Error, Deserialize, Serialize}; +use serde::{Deserialize, Serialize, de::Error}; #[derive(Default, Clone, Debug)] pub enum MaybeVersion { diff --git a/recipe/src/module.rs b/recipe/src/module.rs index 16c7e0a..7810879 100644 --- a/recipe/src/module.rs +++ b/recipe/src/module.rs @@ -7,11 +7,11 @@ use bon::Builder; use colored::Colorize; use indexmap::IndexMap; use log::trace; -use miette::{bail, Result}; +use miette::{Result, bail}; use serde::{Deserialize, Serialize}; use serde_yaml::Value; -use crate::{base_recipe_path, AkmodsInfo, ModuleExt}; +use crate::{AkmodsInfo, ModuleExt, base_recipe_path}; mod type_ver; diff --git a/recipe/src/module_ext.rs b/recipe/src/module_ext.rs index 193355b..d7147eb 100644 --- a/recipe/src/module_ext.rs +++ b/recipe/src/module_ext.rs @@ -9,7 +9,7 @@ use log::trace; use miette::{Context, IntoDiagnostic, Report, Result}; use serde::{Deserialize, Serialize}; -use crate::{base_recipe_path, AkmodsInfo, FromFileList, Module}; +use crate::{AkmodsInfo, FromFileList, Module, base_recipe_path}; #[derive(Default, Serialize, Clone, Deserialize, Debug, Builder)] pub struct ModuleExt<'a> { diff --git a/recipe/src/recipe.rs b/recipe/src/recipe.rs index c967c18..796222d 100644 --- a/recipe/src/recipe.rs +++ b/recipe/src/recipe.rs @@ -6,7 +6,7 @@ use miette::{Context, IntoDiagnostic, Result}; use oci_distribution::Reference; use serde::{Deserialize, Serialize}; -use crate::{maybe_version::MaybeVersion, Module, ModuleExt, StagesExt}; +use crate::{Module, ModuleExt, StagesExt, maybe_version::MaybeVersion}; /// The build recipe. /// diff --git a/recipe/src/stage.rs b/recipe/src/stage.rs index 4e5d77e..68397be 100644 --- a/recipe/src/stage.rs +++ b/recipe/src/stage.rs @@ -3,10 +3,10 @@ use std::{borrow::Cow, path::PathBuf}; use blue_build_utils::syntax_highlighting::highlight_ser; use bon::Builder; use colored::Colorize; -use miette::{bail, Result}; +use miette::{Result, bail}; use serde::{Deserialize, Serialize}; -use crate::{base_recipe_path, Module, ModuleExt, StagesExt}; +use crate::{Module, ModuleExt, StagesExt, base_recipe_path}; /// Contains the required fields for a stage. #[derive(Serialize, Deserialize, Debug, Clone, Builder)] diff --git a/recipe/src/stages_ext.rs b/recipe/src/stages_ext.rs index 2b903e0..4a6ab34 100644 --- a/recipe/src/stages_ext.rs +++ b/recipe/src/stages_ext.rs @@ -7,7 +7,7 @@ use bon::Builder; use miette::{Context, IntoDiagnostic, Report, Result}; use serde::{Deserialize, Serialize}; -use crate::{base_recipe_path, FromFileList, Module, Stage}; +use crate::{FromFileList, Module, Stage, base_recipe_path}; #[derive(Default, Serialize, Clone, Deserialize, Debug, Builder)] pub struct StagesExt<'a> { diff --git a/src/commands.rs b/src/commands.rs index 1b5ff7e..ef66d61 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -2,7 +2,7 @@ use std::path::PathBuf; use log::error; -use clap::{command, crate_authors, Parser, Subcommand}; +use clap::{Parser, Subcommand, command, crate_authors}; use clap_verbosity_flag::{InfoLevel, Verbosity}; use crate::shadow; diff --git a/src/commands/bug_report.rs b/src/commands/bug_report.rs index cded0e0..f4a4b92 100644 --- a/src/commands/bug_report.rs +++ b/src/commands/bug_report.rs @@ -8,10 +8,10 @@ use bon::Builder; use clap::Args; use clap_complete::Shell; use colored::Colorize; -use fuzzy_matcher::{skim::SkimMatcherV2, FuzzyMatcher}; +use fuzzy_matcher::{FuzzyMatcher, skim::SkimMatcherV2}; use log::{debug, error, trace}; use miette::{IntoDiagnostic, Result}; -use requestty::question::{completions, Completions}; +use requestty::question::{Completions, completions}; use std::time::Duration; use super::BlueBuildCommand; @@ -85,15 +85,22 @@ impl BugReportCommand { .default(true) .build(); - println!("{} To avoid any sensitive data from being exposed, please review the included information before proceeding.", "Warning:".on_bright_red().bright_white()); - println!("Data forwarded to GitHub is subject to GitHub's privacy policy. For more information, see https://docs.github.com/en/github/site-policy/github-privacy-statement.\n"); + println!( + "{} To avoid any sensitive data from being exposed, please review the included information before proceeding.", + "Warning:".on_bright_red().bright_white() + ); + println!( + "Data forwarded to GitHub is subject to GitHub's privacy policy. For more information, see https://docs.github.com/en/github/site-policy/github-privacy-statement.\n" + ); match requestty::prompt_one(question) { Ok(answer) => { if answer.as_bool().unwrap() { let link = make_github_issue_link(&issue_body); if let Err(e) = open::that(&link) { println!("Failed to open issue report in your browser: {e}"); - println!("Please copy the above report and open an issue manually, or try opening the following link:\n{link}"); + println!( + "Please copy the above report and open an issue manually, or try opening the following link:\n{link}" + ); return Err(e).into_diagnostic(); } } else { diff --git a/src/commands/build.rs b/src/commands/build.rs index 6efe40b..c157893 100644 --- a/src/commands/build.rs +++ b/src/commands/build.rs @@ -2,12 +2,12 @@ use std::path::{Path, PathBuf}; use blue_build_process_management::{ drivers::{ + BuildDriver, CiDriver, Driver, DriverArgs, SigningDriver, opts::{ BuildTagPushOpts, CheckKeyPairOpts, CompressionType, GenerateImageNameOpts, GenerateTagsOpts, SignVerifyOpts, }, types::Platform, - BuildDriver, CiDriver, Driver, DriverArgs, SigningDriver, }, logging::{color_str, gen_random_ansi_color}, }; @@ -25,7 +25,7 @@ use blue_build_utils::{ use bon::Builder; use clap::Args; use log::{info, trace, warn}; -use miette::{bail, IntoDiagnostic, Result}; +use miette::{IntoDiagnostic, Result, bail}; use oci_distribution::Reference; use tempfile::TempDir; @@ -332,8 +332,8 @@ impl BuildCommand { #[cfg(feature = "rechunk")] let images = if self.rechunk { use blue_build_process_management::drivers::{ - opts::{GetMetadataOpts, RechunkOpts}, InspectDriver, RechunkDriver, + opts::{GetMetadataOpts, RechunkOpts}, }; let base_image: Reference = format!("{}:{}", &recipe.base_image, &recipe.image_version) diff --git a/src/commands/generate.rs b/src/commands/generate.rs index ffd886b..869e171 100644 --- a/src/commands/generate.rs +++ b/src/commands/generate.rs @@ -4,7 +4,7 @@ use std::{ }; use blue_build_process_management::drivers::{ - opts::GetMetadataOpts, types::Platform, CiDriver, Driver, DriverArgs, InspectDriver, + CiDriver, Driver, DriverArgs, InspectDriver, opts::GetMetadataOpts, types::Platform, }; use blue_build_recipe::Recipe; use blue_build_template::{ContainerFileTemplate, Template}; @@ -14,7 +14,7 @@ use blue_build_utils::{ }; use bon::Builder; use cached::proc_macro::cached; -use clap::{crate_version, Args}; +use clap::{Args, crate_version}; use log::{debug, info, trace, warn}; use miette::{IntoDiagnostic, Result}; use oci_distribution::Reference; diff --git a/src/commands/generate_iso.rs b/src/commands/generate_iso.rs index 5201a7b..db67c43 100644 --- a/src/commands/generate_iso.rs +++ b/src/commands/generate_iso.rs @@ -7,16 +7,16 @@ use blue_build_recipe::Recipe; use blue_build_utils::{constants::ARCHIVE_SUFFIX, string_vec, traits::CowCollecter}; use bon::Builder; use clap::{Args, Subcommand, ValueEnum}; -use miette::{bail, Context, IntoDiagnostic, Result}; +use miette::{Context, IntoDiagnostic, Result, bail}; use oci_distribution::Reference; use tempfile::TempDir; use blue_build_process_management::{ - drivers::{opts::RunOpts, Driver, DriverArgs, RunDriver}, + drivers::{Driver, DriverArgs, RunDriver, opts::RunOpts}, run_volumes, }; -use super::{build::BuildCommand, BlueBuildCommand}; +use super::{BlueBuildCommand, build::BuildCommand}; #[derive(Clone, Debug, Builder, Args)] pub struct GenerateIsoCommand { diff --git a/src/commands/init.rs b/src/commands/init.rs index 1690331..ab3904a 100644 --- a/src/commands/init.rs +++ b/src/commands/init.rs @@ -8,16 +8,16 @@ use std::{ }; use blue_build_process_management::drivers::{ - opts::GenerateKeyPairOpts, CiDriver, Driver, DriverArgs, GitlabDriver, SigningDriver, + CiDriver, Driver, DriverArgs, GitlabDriver, SigningDriver, opts::GenerateKeyPairOpts, }; use blue_build_template::{GitlabCiTemplate, InitReadmeTemplate, Template}; use blue_build_utils::constants::{COSIGN_PUB_PATH, RECIPE_FILE, RECIPE_PATH, TEMPLATE_REPO_URL}; use bon::Builder; -use clap::{crate_version, Args, ValueEnum}; +use clap::{Args, ValueEnum, crate_version}; use comlexr::cmd; use log::{debug, info, trace}; -use miette::{bail, miette, Context, IntoDiagnostic, Report, Result}; -use requestty::{questions, Answer, Answers, OnEsc}; +use miette::{Context, IntoDiagnostic, Report, Result, bail, miette}; +use requestty::{Answer, Answers, OnEsc, questions}; use semver::Version; use crate::commands::BlueBuildCommand; @@ -202,8 +202,7 @@ impl InitCommand { }, Input { name: Self::REGISTRY, - message: - "What is the registry for the image? (e.g. ghcr.io or registry.gitlab.com)", + message: "What is the registry for the image? (e.g. ghcr.io or registry.gitlab.com)", when: when!(self.common.registry.is_none()), on_esc: OnEsc::Terminate, }, diff --git a/src/commands/login.rs b/src/commands/login.rs index e034b21..2fd28c7 100644 --- a/src/commands/login.rs +++ b/src/commands/login.rs @@ -3,7 +3,7 @@ use std::io::{self, Read}; use blue_build_process_management::drivers::{BuildDriver, Driver, DriverArgs, SigningDriver}; use blue_build_utils::credentials::{Credentials, CredentialsArgs}; use clap::Args; -use miette::{bail, IntoDiagnostic, Result}; +use miette::{IntoDiagnostic, Result, bail}; use requestty::questions; use super::BlueBuildCommand; diff --git a/src/commands/prune.rs b/src/commands/prune.rs index b972ecf..da0f188 100644 --- a/src/commands/prune.rs +++ b/src/commands/prune.rs @@ -1,4 +1,4 @@ -use blue_build_process_management::drivers::{opts::PruneOpts, BuildDriver, Driver, DriverArgs}; +use blue_build_process_management::drivers::{BuildDriver, Driver, DriverArgs, opts::PruneOpts}; use bon::Builder; use clap::Args; use colored::Colorize; diff --git a/src/commands/switch.rs b/src/commands/switch.rs index 2d934f8..1de336a 100644 --- a/src/commands/switch.rs +++ b/src/commands/switch.rs @@ -17,7 +17,7 @@ use clap::Args; use comlexr::cmd; use indicatif::ProgressBar; use log::{debug, trace}; -use miette::{bail, IntoDiagnostic, Result}; +use miette::{IntoDiagnostic, Result, bail}; use tempfile::TempDir; use crate::{commands::build::BuildCommand, rpm_ostree_status::RpmOstreeStatus}; diff --git a/src/commands/validate.rs b/src/commands/validate.rs index 8b50b14..dbda822 100644 --- a/src/commands/validate.rs +++ b/src/commands/validate.rs @@ -16,7 +16,7 @@ use bon::Builder; use clap::Args; use colored::Colorize; use log::{debug, info, trace}; -use miette::{bail, miette, Context, IntoDiagnostic, Report}; +use miette::{Context, IntoDiagnostic, Report, bail, miette}; use rayon::prelude::*; use schema_validator::SchemaValidator; use serde::de::DeserializeOwned; diff --git a/src/commands/validate/yaml_span.rs b/src/commands/validate/yaml_span.rs index b374a0c..4fb81f7 100644 --- a/src/commands/validate/yaml_span.rs +++ b/src/commands/validate/yaml_span.rs @@ -5,9 +5,9 @@ use bon::bon; use jsonschema::paths::LocationSegment; use miette::SourceSpan; use yaml_rust2::{ + Event, parser::{MarkedEventReceiver, Parser}, scanner::Marker, - Event, }; #[cfg(not(test))] @@ -147,7 +147,7 @@ where return Err(YamlSpanError::ExpectIndexFoundKey { key: key.to_owned(), index, - }) + }); } (Event::SequenceStart(_, _), LocationSegment::Index(index)) => { break self.sequence(index, 0); @@ -159,7 +159,7 @@ where self.skip_mapping(marker.index()); } (Event::MappingEnd, _) => { - return Err(YamlSpanError::EndOfMapNoKey(expected_key.to_string())) + return Err(YamlSpanError::EndOfMapNoKey(expected_key.to_string())); } event => unreachable!("{event:?}"), } @@ -265,7 +265,7 @@ where return Err(YamlSpanError::UnexpectedScalar { value: value.to_owned(), segment: segment.to_string(), - }) + }); } (Event::MappingStart(_, _), Some(LocationSegment::Property(key))) => { self.key(LocationSegment::Property(key))? @@ -290,7 +290,7 @@ where mod test { use std::sync::Arc; - use miette::{miette, LabeledSpan}; + use miette::{LabeledSpan, miette}; use rstest::rstest; use crate::commands::validate::location::Location; diff --git a/src/rpm_ostree_status.rs b/src/rpm_ostree_status.rs index 0413dbf..163b5ed 100644 --- a/src/rpm_ostree_status.rs +++ b/src/rpm_ostree_status.rs @@ -2,7 +2,7 @@ use std::{borrow::Cow, path::Path}; use comlexr::cmd; use log::trace; -use miette::{bail, IntoDiagnostic, Result}; +use miette::{IntoDiagnostic, Result, bail}; use serde::Deserialize; #[derive(Debug, Clone, Deserialize)] @@ -208,18 +208,22 @@ mod test { #[test] fn test_booted_image() { - assert!(create_image_status() - .booted_image() - .expect("Contains image") - .ends_with("cli/test")); + assert!( + create_image_status() + .booted_image() + .expect("Contains image") + .ends_with("cli/test") + ); } #[test] fn test_staged_image() { - assert!(create_archive_staged_status() - .staged_image() - .expect("Contains image") - .ends_with(&format!("cli_test.{ARCHIVE_SUFFIX}"))); + assert!( + create_archive_staged_status() + .staged_image() + .expect("Contains image") + .ends_with(&format!("cli_test.{ARCHIVE_SUFFIX}")) + ); } #[test] @@ -230,8 +234,10 @@ mod test { #[test] fn test_is_booted_archive() { - assert!(!create_archive_status() - .is_booted_on_archive(Path::new(LOCAL_BUILD).join(format!("cli.{ARCHIVE_SUFFIX}")))); + assert!( + !create_archive_status() + .is_booted_on_archive(Path::new(LOCAL_BUILD).join(format!("cli.{ARCHIVE_SUFFIX}"))) + ); assert!(create_archive_status().is_booted_on_archive( Path::new(LOCAL_BUILD).join(format!("cli_test.{ARCHIVE_SUFFIX}")) )); @@ -239,8 +245,10 @@ mod test { #[test] fn test_is_staged_archive() { - assert!(!create_archive_staged_status() - .is_staged_on_archive(Path::new(LOCAL_BUILD).join(format!("cli.{ARCHIVE_SUFFIX}")))); + assert!( + !create_archive_staged_status() + .is_staged_on_archive(Path::new(LOCAL_BUILD).join(format!("cli.{ARCHIVE_SUFFIX}"))) + ); assert!(create_archive_staged_status().is_staged_on_archive( Path::new(LOCAL_BUILD).join(format!("cli_test.{ARCHIVE_SUFFIX}")) )); diff --git a/template/src/lib.rs b/template/src/lib.rs index 7d5cc2f..cb51328 100644 --- a/template/src/lib.rs +++ b/template/src/lib.rs @@ -2,7 +2,7 @@ use std::{borrow::Cow, fs, path::Path, process}; use blue_build_recipe::{MaybeVersion, Recipe}; use blue_build_utils::constants::{ - CONFIG_PATH, CONTAINERFILES_PATH, CONTAINER_FILE, COSIGN_PUB_PATH, FILES_PATH, + CONFIG_PATH, CONTAINER_FILE, CONTAINERFILES_PATH, COSIGN_PUB_PATH, FILES_PATH, }; use bon::Builder; use chrono::Utc; @@ -102,7 +102,9 @@ fn print_containerfile(containerfile: &str) -> String { let path = if containerfiles_path.exists() && containerfiles_path.is_dir() { containerfiles_path.join(format!("{containerfile}/{CONTAINER_FILE}")) } else { - warn!("Use of {CONFIG_PATH} is deprecated for the containerfile module, please move your containerfile directories into {CONTAINERFILES_PATH}"); + warn!( + "Use of {CONFIG_PATH} is deprecated for the containerfile module, please move your containerfile directories into {CONTAINERFILES_PATH}" + ); legacy_path.join(format!("containerfiles/{containerfile}/{CONTAINER_FILE}")) }; @@ -131,7 +133,9 @@ fn config_dir_exists() -> bool { let exists = path.exists() && path.is_dir(); if exists { - warn!("Use of the {CONFIG_PATH} directory is deprecated. Please move your non-recipe files into {FILES_PATH}"); + warn!( + "Use of the {CONFIG_PATH} directory is deprecated. Please move your non-recipe files into {FILES_PATH}" + ); } exists diff --git a/utils/build.rs b/utils/build.rs index 1a9779c..d89eac8 100644 --- a/utils/build.rs +++ b/utils/build.rs @@ -1,8 +1,8 @@ use std::env; use std::path::PathBuf; use syntect::dumps; -use syntect::parsing::syntax_definition::SyntaxDefinition; use syntect::parsing::SyntaxSetBuilder; +use syntect::parsing::syntax_definition::SyntaxDefinition; fn main() { let mut ssb = SyntaxSetBuilder::new(); diff --git a/utils/src/command_output.rs b/utils/src/command_output.rs index 111109e..b1e74ab 100644 --- a/utils/src/command_output.rs +++ b/utils/src/command_output.rs @@ -113,7 +113,9 @@ fn exec_timeout(cmd: &mut Command, time_limit: Duration) -> Option { log::warn!("Executing command {:?} timed out.", cmd.get_program()); - log::warn!("You can set command_timeout in your config to a higher value to allow longer-running commands to keep executing."); + log::warn!( + "You can set command_timeout in your config to a higher value to allow longer-running commands to keep executing." + ); None } Err(error) => { diff --git a/utils/src/lib.rs b/utils/src/lib.rs index 386ef13..ddfd489 100644 --- a/utils/src/lib.rs +++ b/utils/src/lib.rs @@ -18,15 +18,15 @@ use std::{ use base64::prelude::*; use blake2::{ - digest::{Update, VariableOutput}, Blake2bVar, + digest::{Update, VariableOutput}, }; use cached::proc_macro::once; use chrono::Local; use comlexr::cmd; use format_serde_error::SerdeError; use log::{trace, warn}; -use miette::{miette, Context, IntoDiagnostic, Result}; +use miette::{Context, IntoDiagnostic, Result, miette}; use crate::constants::CONTAINER_FILE; @@ -110,7 +110,7 @@ where warn!("Failed operation, will retry {retries} more time(s). Error:\n{e:?}"); thread::sleep(Duration::from_secs(delay_secs)); } - }; + } } } diff --git a/utils/src/semver.rs b/utils/src/semver.rs index 42c012a..79e7418 100644 --- a/utils/src/semver.rs +++ b/utils/src/semver.rs @@ -2,7 +2,7 @@ use std::str::FromStr; use miette::bail; use semver::Prerelease; -use serde::{de::Error, Deserialize, Serialize}; +use serde::{Deserialize, Serialize, de::Error}; #[derive(Debug, Clone, Serialize)] pub struct Version(semver::Version); diff --git a/utils/src/syntax_highlighting.rs b/utils/src/syntax_highlighting.rs index aff2344..7ed2e59 100644 --- a/utils/src/syntax_highlighting.rs +++ b/utils/src/syntax_highlighting.rs @@ -1,6 +1,6 @@ use clap::ValueEnum; use log::trace; -use miette::{miette, IntoDiagnostic, Result}; +use miette::{IntoDiagnostic, Result, miette}; use serde::ser::Serialize; use syntect::{dumps, easy::HighlightLines, highlighting::ThemeSet, parsing::SyntaxSet}; diff --git a/utils/src/test_utils.rs b/utils/src/test_utils.rs index dc1a637..ea64bb6 100644 --- a/utils/src/test_utils.rs +++ b/utils/src/test_utils.rs @@ -4,7 +4,7 @@ use std::{ thread::{self, ThreadId}, }; -use miette::{miette, Result}; +use miette::{Result, miette}; use crate::string;