chore: Clippy fixes
This commit is contained in:
parent
4a0fc3b4a1
commit
67cbca3218
6 changed files with 23 additions and 20 deletions
|
|
@ -78,6 +78,7 @@ static BUILD_ID: std::sync::LazyLock<Uuid> = std::sync::LazyLock::new(Uuid::new_
|
||||||
/// If the args are left uninitialized, the program will determine
|
/// If the args are left uninitialized, the program will determine
|
||||||
/// the best one available.
|
/// the best one available.
|
||||||
#[derive(Default, Clone, Copy, Debug, Builder, Args)]
|
#[derive(Default, Clone, Copy, Debug, Builder, Args)]
|
||||||
|
#[allow(clippy::struct_field_names)]
|
||||||
pub struct DriverArgs {
|
pub struct DriverArgs {
|
||||||
/// Select which driver to use to build
|
/// Select which driver to use to build
|
||||||
/// your image.
|
/// your image.
|
||||||
|
|
|
||||||
|
|
@ -466,7 +466,7 @@ fn build_tag_push_cmd(opts: &BuildTagPushOpts<'_>, first_image: &str) -> Command
|
||||||
fn get_final_images(opts: &BuildTagPushOpts<'_>) -> Vec<String> {
|
fn get_final_images(opts: &BuildTagPushOpts<'_>) -> Vec<String> {
|
||||||
match &opts.image {
|
match &opts.image {
|
||||||
ImageRef::Remote(image) => {
|
ImageRef::Remote(image) => {
|
||||||
let images = if opts.tags.is_empty() {
|
if opts.tags.is_empty() {
|
||||||
let image = image.to_string();
|
let image = image.to_string();
|
||||||
string_vec![image]
|
string_vec![image]
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -474,9 +474,7 @@ fn get_final_images(opts: &BuildTagPushOpts<'_>) -> Vec<String> {
|
||||||
.iter()
|
.iter()
|
||||||
.map(|tag| format!("{}/{}:{tag}", image.resolve_registry(), image.repository()))
|
.map(|tag| format!("{}/{}:{tag}", image.resolve_registry(), image.repository()))
|
||||||
.collect()
|
.collect()
|
||||||
};
|
}
|
||||||
|
|
||||||
images
|
|
||||||
}
|
}
|
||||||
ImageRef::LocalTar(archive_path) => {
|
ImageRef::LocalTar(archive_path) => {
|
||||||
string_vec![archive_path.display().to_string()]
|
string_vec![archive_path.display().to_string()]
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@ pub struct ModuleExt<'a> {
|
||||||
impl FromFileList for ModuleExt<'_> {
|
impl FromFileList for ModuleExt<'_> {
|
||||||
const LIST_KEY: &'static str = "modules";
|
const LIST_KEY: &'static str = "modules";
|
||||||
|
|
||||||
#[must_use]
|
|
||||||
fn get_from_file_paths(&self) -> Vec<PathBuf> {
|
fn get_from_file_paths(&self) -> Vec<PathBuf> {
|
||||||
self.modules
|
self.modules
|
||||||
.iter()
|
.iter()
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@ pub struct StagesExt<'a> {
|
||||||
impl FromFileList for StagesExt<'_> {
|
impl FromFileList for StagesExt<'_> {
|
||||||
const LIST_KEY: &'static str = "stages";
|
const LIST_KEY: &'static str = "stages";
|
||||||
|
|
||||||
#[must_use]
|
|
||||||
fn get_from_file_paths(&self) -> Vec<PathBuf> {
|
fn get_from_file_paths(&self) -> Vec<PathBuf> {
|
||||||
self.stages
|
self.stages
|
||||||
.iter()
|
.iter()
|
||||||
|
|
|
||||||
|
|
@ -427,7 +427,7 @@ impl InitCommand {
|
||||||
.ok_or_else(|| miette!("Couldn't get parent directory from {ci_file_path:?}"))?;
|
.ok_or_else(|| miette!("Couldn't get parent directory from {ci_file_path:?}"))?;
|
||||||
fs::create_dir_all(parent_path)
|
fs::create_dir_all(parent_path)
|
||||||
.into_diagnostic()
|
.into_diagnostic()
|
||||||
.with_context(|| format!("Couldn't create directory path {parent_path:?}"))?;
|
.with_context(|| format!("Couldn't create directory path {}", parent_path.display()))?;
|
||||||
|
|
||||||
let file = &mut BufWriter::new(
|
let file = &mut BufWriter::new(
|
||||||
OpenOptions::new()
|
OpenOptions::new()
|
||||||
|
|
@ -436,14 +436,14 @@ impl InitCommand {
|
||||||
.write(true)
|
.write(true)
|
||||||
.open(&ci_file_path)
|
.open(&ci_file_path)
|
||||||
.into_diagnostic()
|
.into_diagnostic()
|
||||||
.with_context(|| format!("Failed to open file at {ci_file_path:?}"))?,
|
.with_context(|| format!("Failed to open file at {}", ci_file_path.display()))?,
|
||||||
);
|
);
|
||||||
|
|
||||||
let template = ci_provider.render_file()?;
|
let template = ci_provider.render_file()?;
|
||||||
|
|
||||||
writeln!(file, "{template}")
|
writeln!(file, "{template}")
|
||||||
.into_diagnostic()
|
.into_diagnostic()
|
||||||
.with_context(|| format!("Failed to write CI file {ci_file_path:?}"))
|
.with_context(|| format!("Failed to write CI file {}", ci_file_path.display()))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update_recipe_file(&self, answers: &Answers) -> Result<()> {
|
fn update_recipe_file(&self, answers: &Answers) -> Result<()> {
|
||||||
|
|
@ -456,10 +456,10 @@ impl InitCommand {
|
||||||
.join(RECIPE_PATH)
|
.join(RECIPE_PATH)
|
||||||
.join(RECIPE_FILE);
|
.join(RECIPE_FILE);
|
||||||
|
|
||||||
debug!("Reading {recipe_path:?}");
|
debug!("Reading {}", recipe_path.display());
|
||||||
let file = fs::read_to_string(&recipe_path)
|
let file = fs::read_to_string(&recipe_path)
|
||||||
.into_diagnostic()
|
.into_diagnostic()
|
||||||
.with_context(|| format!("Failed to read {recipe_path:?}"))?;
|
.with_context(|| format!("Failed to read {}", recipe_path.display()))?;
|
||||||
|
|
||||||
let description = self
|
let description = self
|
||||||
.common
|
.common
|
||||||
|
|
@ -502,11 +502,11 @@ impl InitCommand {
|
||||||
.write(true)
|
.write(true)
|
||||||
.open(&recipe_path)
|
.open(&recipe_path)
|
||||||
.into_diagnostic()
|
.into_diagnostic()
|
||||||
.with_context(|| format!("Failed to open {recipe_path:?}"))?,
|
.with_context(|| format!("Failed to open {}", recipe_path.display()))?,
|
||||||
);
|
);
|
||||||
write!(file, "{new_file_str}")
|
write!(file, "{new_file_str}")
|
||||||
.into_diagnostic()
|
.into_diagnostic()
|
||||||
.with_context(|| format!("Failed to write to file {recipe_path:?}"))
|
.with_context(|| format!("Failed to write to file {}", recipe_path.display()))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn generate_signing_files(&self) -> Result<()> {
|
fn generate_signing_files(&self) -> Result<()> {
|
||||||
|
|
|
||||||
|
|
@ -22,15 +22,18 @@ pub struct CommandOutput {
|
||||||
///
|
///
|
||||||
fn create_command<T: AsRef<OsStr>>(binary_name: T) -> Result<Command> {
|
fn create_command<T: AsRef<OsStr>>(binary_name: T) -> Result<Command> {
|
||||||
let binary_name = binary_name.as_ref();
|
let binary_name = binary_name.as_ref();
|
||||||
log::trace!("Creating Command for binary {binary_name:?}");
|
log::trace!("Creating Command for binary {}", binary_name.display());
|
||||||
|
|
||||||
let full_path = match which::which(binary_name) {
|
let full_path = match which::which(binary_name) {
|
||||||
Ok(full_path) => {
|
Ok(full_path) => {
|
||||||
log::trace!("Using {full_path:?} as {binary_name:?}");
|
log::trace!("Using {} as {}", full_path.display(), binary_name.display());
|
||||||
full_path
|
full_path
|
||||||
}
|
}
|
||||||
Err(error) => {
|
Err(error) => {
|
||||||
log::trace!("Unable to find {binary_name:?} in PATH, {error:?}");
|
log::trace!(
|
||||||
|
"Unable to find {} in PATH, {error:?}",
|
||||||
|
binary_name.display()
|
||||||
|
);
|
||||||
return Err(Error::new(ErrorKind::NotFound, error));
|
return Err(Error::new(ErrorKind::NotFound, error));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -68,7 +71,7 @@ fn exec_timeout(cmd: &mut Command, time_limit: Duration) -> Option<CommandOutput
|
||||||
let process = match cmd.spawn() {
|
let process = match cmd.spawn() {
|
||||||
Ok(process) => process,
|
Ok(process) => process,
|
||||||
Err(error) => {
|
Err(error) => {
|
||||||
log::trace!("Unable to run {:?}, {:?}", cmd.get_program(), error);
|
log::trace!("Unable to run {}, {:?}", cmd.get_program().display(), error);
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -112,7 +115,10 @@ fn exec_timeout(cmd: &mut Command, time_limit: Duration) -> Option<CommandOutput
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
Ok(None) => {
|
Ok(None) => {
|
||||||
log::warn!("Executing command {:?} timed out.", cmd.get_program());
|
log::warn!(
|
||||||
|
"Executing command {} timed out.",
|
||||||
|
cmd.get_program().display()
|
||||||
|
);
|
||||||
log::warn!(
|
log::warn!(
|
||||||
"You can set command_timeout in your config to a higher value to allow longer-running commands to keep executing."
|
"You can set command_timeout in your config to a higher value to allow longer-running commands to keep executing."
|
||||||
);
|
);
|
||||||
|
|
@ -120,8 +126,8 @@ fn exec_timeout(cmd: &mut Command, time_limit: Duration) -> Option<CommandOutput
|
||||||
}
|
}
|
||||||
Err(error) => {
|
Err(error) => {
|
||||||
log::trace!(
|
log::trace!(
|
||||||
"Executing command {:?} failed by: {:?}",
|
"Executing command {} failed by: {:?}",
|
||||||
cmd.get_program(),
|
cmd.get_program().display(),
|
||||||
error
|
error
|
||||||
);
|
);
|
||||||
None
|
None
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue