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
|
||||
/// the best one available.
|
||||
#[derive(Default, Clone, Copy, Debug, Builder, Args)]
|
||||
#[allow(clippy::struct_field_names)]
|
||||
pub struct DriverArgs {
|
||||
/// Select which driver to use to build
|
||||
/// 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> {
|
||||
match &opts.image {
|
||||
ImageRef::Remote(image) => {
|
||||
let images = if opts.tags.is_empty() {
|
||||
if opts.tags.is_empty() {
|
||||
let image = image.to_string();
|
||||
string_vec![image]
|
||||
} else {
|
||||
|
|
@ -474,9 +474,7 @@ fn get_final_images(opts: &BuildTagPushOpts<'_>) -> Vec<String> {
|
|||
.iter()
|
||||
.map(|tag| format!("{}/{}:{tag}", image.resolve_registry(), image.repository()))
|
||||
.collect()
|
||||
};
|
||||
|
||||
images
|
||||
}
|
||||
}
|
||||
ImageRef::LocalTar(archive_path) => {
|
||||
string_vec![archive_path.display().to_string()]
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ pub struct ModuleExt<'a> {
|
|||
impl FromFileList for ModuleExt<'_> {
|
||||
const LIST_KEY: &'static str = "modules";
|
||||
|
||||
#[must_use]
|
||||
fn get_from_file_paths(&self) -> Vec<PathBuf> {
|
||||
self.modules
|
||||
.iter()
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ pub struct StagesExt<'a> {
|
|||
impl FromFileList for StagesExt<'_> {
|
||||
const LIST_KEY: &'static str = "stages";
|
||||
|
||||
#[must_use]
|
||||
fn get_from_file_paths(&self) -> Vec<PathBuf> {
|
||||
self.stages
|
||||
.iter()
|
||||
|
|
|
|||
|
|
@ -427,7 +427,7 @@ impl InitCommand {
|
|||
.ok_or_else(|| miette!("Couldn't get parent directory from {ci_file_path:?}"))?;
|
||||
fs::create_dir_all(parent_path)
|
||||
.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(
|
||||
OpenOptions::new()
|
||||
|
|
@ -436,14 +436,14 @@ impl InitCommand {
|
|||
.write(true)
|
||||
.open(&ci_file_path)
|
||||
.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()?;
|
||||
|
||||
writeln!(file, "{template}")
|
||||
.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<()> {
|
||||
|
|
@ -456,10 +456,10 @@ impl InitCommand {
|
|||
.join(RECIPE_PATH)
|
||||
.join(RECIPE_FILE);
|
||||
|
||||
debug!("Reading {recipe_path:?}");
|
||||
debug!("Reading {}", recipe_path.display());
|
||||
let file = fs::read_to_string(&recipe_path)
|
||||
.into_diagnostic()
|
||||
.with_context(|| format!("Failed to read {recipe_path:?}"))?;
|
||||
.with_context(|| format!("Failed to read {}", recipe_path.display()))?;
|
||||
|
||||
let description = self
|
||||
.common
|
||||
|
|
@ -502,11 +502,11 @@ impl InitCommand {
|
|||
.write(true)
|
||||
.open(&recipe_path)
|
||||
.into_diagnostic()
|
||||
.with_context(|| format!("Failed to open {recipe_path:?}"))?,
|
||||
.with_context(|| format!("Failed to open {}", recipe_path.display()))?,
|
||||
);
|
||||
write!(file, "{new_file_str}")
|
||||
.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<()> {
|
||||
|
|
|
|||
|
|
@ -22,15 +22,18 @@ pub struct CommandOutput {
|
|||
///
|
||||
fn create_command<T: AsRef<OsStr>>(binary_name: T) -> Result<Command> {
|
||||
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) {
|
||||
Ok(full_path) => {
|
||||
log::trace!("Using {full_path:?} as {binary_name:?}");
|
||||
log::trace!("Using {} as {}", full_path.display(), binary_name.display());
|
||||
full_path
|
||||
}
|
||||
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));
|
||||
}
|
||||
};
|
||||
|
|
@ -68,7 +71,7 @@ fn exec_timeout(cmd: &mut Command, time_limit: Duration) -> Option<CommandOutput
|
|||
let process = match cmd.spawn() {
|
||||
Ok(process) => process,
|
||||
Err(error) => {
|
||||
log::trace!("Unable to run {:?}, {:?}", cmd.get_program(), error);
|
||||
log::trace!("Unable to run {}, {:?}", cmd.get_program().display(), error);
|
||||
return None;
|
||||
}
|
||||
};
|
||||
|
|
@ -112,7 +115,10 @@ fn exec_timeout(cmd: &mut Command, time_limit: Duration) -> Option<CommandOutput
|
|||
})
|
||||
}
|
||||
Ok(None) => {
|
||||
log::warn!("Executing command {:?} timed out.", cmd.get_program());
|
||||
log::warn!(
|
||||
"Executing command {} timed out.",
|
||||
cmd.get_program().display()
|
||||
);
|
||||
log::warn!(
|
||||
"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) => {
|
||||
log::trace!(
|
||||
"Executing command {:?} failed by: {:?}",
|
||||
cmd.get_program(),
|
||||
"Executing command {} failed by: {:?}",
|
||||
cmd.get_program().display(),
|
||||
error
|
||||
);
|
||||
None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue