chore: Clippy fixes
This commit is contained in:
parent
6bae48bd88
commit
5f648af104
15 changed files with 74 additions and 78 deletions
|
|
@ -16,7 +16,6 @@ blue-build-utils = { version = "=0.9.11", path = "../utils" }
|
|||
indicatif-log-bridge = "0.2"
|
||||
log4rs = { version = "1", features = ["background_rotation"] }
|
||||
nu-ansi-term = { version = "0.50", features = ["gnu_legacy"] }
|
||||
once_cell = "1"
|
||||
os_pipe = { version = "1", features = ["io_safety"] }
|
||||
rand = "0.9"
|
||||
signal-hook = { version = "0.3", features = ["extended-siginfo"] }
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ use indicatif::{ProgressBar, ProgressStyle};
|
|||
use log::{info, trace, warn};
|
||||
use miette::{miette, IntoDiagnostic, Result};
|
||||
use oci_distribution::Reference;
|
||||
use once_cell::sync::Lazy;
|
||||
use opts::{
|
||||
BuildOpts, BuildTagPushOpts, CheckKeyPairOpts, CreateContainerOpts, GenerateImageNameOpts,
|
||||
GenerateKeyPairOpts, GenerateTagsOpts, GetMetadataOpts, PushOpts, RemoveContainerOpts,
|
||||
|
|
@ -59,18 +58,20 @@ mod skopeo_driver;
|
|||
mod traits;
|
||||
pub mod types;
|
||||
|
||||
static INIT: Lazy<Mutex<bool>> = Lazy::new(|| Mutex::new(false));
|
||||
static SELECTED_BUILD_DRIVER: Lazy<RwLock<Option<BuildDriverType>>> =
|
||||
Lazy::new(|| RwLock::new(None));
|
||||
static SELECTED_INSPECT_DRIVER: Lazy<RwLock<Option<InspectDriverType>>> =
|
||||
Lazy::new(|| RwLock::new(None));
|
||||
static SELECTED_RUN_DRIVER: Lazy<RwLock<Option<RunDriverType>>> = Lazy::new(|| RwLock::new(None));
|
||||
static SELECTED_SIGNING_DRIVER: Lazy<RwLock<Option<SigningDriverType>>> =
|
||||
Lazy::new(|| RwLock::new(None));
|
||||
static SELECTED_CI_DRIVER: Lazy<RwLock<Option<CiDriverType>>> = Lazy::new(|| RwLock::new(None));
|
||||
static INIT: std::sync::LazyLock<Mutex<bool>> = std::sync::LazyLock::new(|| Mutex::new(false));
|
||||
static SELECTED_BUILD_DRIVER: std::sync::LazyLock<RwLock<Option<BuildDriverType>>> =
|
||||
std::sync::LazyLock::new(|| RwLock::new(None));
|
||||
static SELECTED_INSPECT_DRIVER: std::sync::LazyLock<RwLock<Option<InspectDriverType>>> =
|
||||
std::sync::LazyLock::new(|| RwLock::new(None));
|
||||
static SELECTED_RUN_DRIVER: std::sync::LazyLock<RwLock<Option<RunDriverType>>> =
|
||||
std::sync::LazyLock::new(|| RwLock::new(None));
|
||||
static SELECTED_SIGNING_DRIVER: std::sync::LazyLock<RwLock<Option<SigningDriverType>>> =
|
||||
std::sync::LazyLock::new(|| RwLock::new(None));
|
||||
static SELECTED_CI_DRIVER: std::sync::LazyLock<RwLock<Option<CiDriverType>>> =
|
||||
std::sync::LazyLock::new(|| RwLock::new(None));
|
||||
|
||||
/// UUID used to mark the current builds
|
||||
static BUILD_ID: Lazy<Uuid> = Lazy::new(Uuid::new_v4);
|
||||
static BUILD_ID: std::sync::LazyLock<Uuid> = std::sync::LazyLock::new(Uuid::new_v4);
|
||||
|
||||
/// Args for selecting the various drivers to use for runtime.
|
||||
///
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ use comlexr::{cmd, pipe};
|
|||
use log::{debug, info, trace, warn};
|
||||
use miette::{bail, Context, IntoDiagnostic, Result};
|
||||
use oci_distribution::Reference;
|
||||
use once_cell::sync::Lazy;
|
||||
use serde::Deserialize;
|
||||
use tempfile::TempDir;
|
||||
|
||||
|
|
@ -50,7 +49,8 @@ struct DockerVersionJson {
|
|||
pub client: DockerVerisonJsonClient,
|
||||
}
|
||||
|
||||
static DOCKER_SETUP: Lazy<Mutex<bool>> = Lazy::new(|| Mutex::new(false));
|
||||
static DOCKER_SETUP: std::sync::LazyLock<Mutex<bool>> =
|
||||
std::sync::LazyLock::new(|| Mutex::new(false));
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct DockerDriver;
|
||||
|
|
@ -411,9 +411,9 @@ impl BuildDriver for DockerDriver {
|
|||
|
||||
if status.success() {
|
||||
if opts.push {
|
||||
info!("Successfully built and pushed image {}", first_image);
|
||||
info!("Successfully built and pushed image {first_image}");
|
||||
} else {
|
||||
info!("Successfully built image {}", first_image);
|
||||
info!("Successfully built image {first_image}");
|
||||
}
|
||||
} else {
|
||||
bail!("Failed to build image {}", first_image);
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ use log4rs::{
|
|||
Config, Logger as L4RSLogger,
|
||||
};
|
||||
use nu_ansi_term::Color;
|
||||
use once_cell::sync::Lazy;
|
||||
use private::Private;
|
||||
use rand::Rng;
|
||||
|
||||
|
|
@ -43,8 +42,10 @@ mod private {
|
|||
|
||||
impl Private for Command {}
|
||||
|
||||
static MULTI_PROGRESS: Lazy<MultiProgress> = Lazy::new(MultiProgress::new);
|
||||
static LOG_DIR: Lazy<Mutex<PathBuf>> = Lazy::new(|| Mutex::new(PathBuf::new()));
|
||||
static MULTI_PROGRESS: std::sync::LazyLock<MultiProgress> =
|
||||
std::sync::LazyLock::new(MultiProgress::new);
|
||||
static LOG_DIR: std::sync::LazyLock<Mutex<PathBuf>> =
|
||||
std::sync::LazyLock::new(|| Mutex::new(PathBuf::new()));
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct Logger {
|
||||
|
|
@ -76,7 +77,7 @@ impl Logger {
|
|||
self
|
||||
}
|
||||
|
||||
pub fn filter_level(&mut self, filter_level: LevelFilter) -> &mut Self {
|
||||
pub const fn filter_level(&mut self, filter_level: LevelFilter) -> &mut Self {
|
||||
self.level = filter_level;
|
||||
self
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,22 +2,18 @@
|
|||
//! by this tool. It contains drivers for running, building, inspecting, and signing
|
||||
//! images that interface with tools like docker or podman.
|
||||
|
||||
#[cfg(any(feature = "sigstore", feature = "validate"))]
|
||||
use once_cell::sync::Lazy;
|
||||
#[cfg(any(feature = "sigstore", feature = "validate"))]
|
||||
use tokio::runtime::Runtime;
|
||||
|
||||
pub mod drivers;
|
||||
pub mod logging;
|
||||
pub mod signal_handler;
|
||||
|
||||
#[cfg(any(feature = "sigstore", feature = "validate"))]
|
||||
pub static ASYNC_RUNTIME: Lazy<Runtime> = Lazy::new(|| {
|
||||
tokio::runtime::Builder::new_multi_thread()
|
||||
.enable_all()
|
||||
.build()
|
||||
.unwrap()
|
||||
});
|
||||
pub static ASYNC_RUNTIME: std::sync::LazyLock<tokio::runtime::Runtime> =
|
||||
std::sync::LazyLock::new(|| {
|
||||
tokio::runtime::Builder::new_multi_thread()
|
||||
.enable_all()
|
||||
.build()
|
||||
.unwrap()
|
||||
});
|
||||
|
||||
#[cfg(test)]
|
||||
pub(crate) mod test {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ use nix::{
|
|||
sys::signal::{kill, Signal},
|
||||
unistd::Pid,
|
||||
};
|
||||
use once_cell::sync::Lazy;
|
||||
use signal_hook::{
|
||||
consts::TERM_SIGNALS,
|
||||
flag,
|
||||
|
|
@ -60,9 +59,10 @@ impl ContainerSignalId {
|
|||
}
|
||||
}
|
||||
|
||||
static PID_LIST: Lazy<Arc<Mutex<Vec<i32>>>> = Lazy::new(|| Arc::new(Mutex::new(vec![])));
|
||||
static CID_LIST: Lazy<Arc<Mutex<Vec<ContainerSignalId>>>> =
|
||||
Lazy::new(|| Arc::new(Mutex::new(vec![])));
|
||||
static PID_LIST: std::sync::LazyLock<Arc<Mutex<Vec<i32>>>> =
|
||||
std::sync::LazyLock::new(|| Arc::new(Mutex::new(vec![])));
|
||||
static CID_LIST: std::sync::LazyLock<Arc<Mutex<Vec<ContainerSignalId>>>> =
|
||||
std::sync::LazyLock::new(|| Arc::new(Mutex::new(vec![])));
|
||||
|
||||
/// Initialize Ctrl-C handler. This should be done at the start
|
||||
/// of a binary.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue