Skip to content

Commit

Permalink
Fix for clippy errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexhuszagh committed Jun 8, 2022
1 parent f696978 commit e4b9515
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
16 changes: 11 additions & 5 deletions cross-dev/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![deny(missing_debug_implementations, rust_2018_idioms)]

use std::path::PathBuf;
use std::path::{Path, PathBuf};
use std::process::{Command, Stdio};

use clap::{Parser, Subcommand};
Expand Down Expand Up @@ -115,7 +115,7 @@ fn format_image(registry: &str, repository: &str, target: &str, tag: &str) -> St
output
}

fn pull_image(engine: &PathBuf, image: &str, verbose: bool) -> cross::Result<()> {
fn pull_image(engine: &Path, image: &str, verbose: bool) -> cross::Result<()> {
let mut command = Command::new(engine);
command.arg("pull");
command.arg(image);
Expand All @@ -127,7 +127,13 @@ fn pull_image(engine: &PathBuf, image: &str, verbose: bool) -> cross::Result<()>
command.run(verbose)
}

fn image_info(engine: &PathBuf, target: &str, image: &str, tag: &str, verbose: bool) -> cross::Result<()> {
fn image_info(
engine: &Path,
target: &str,
image: &str,
tag: &str,
verbose: bool,
) -> cross::Result<()> {
if !tag.starts_with("local") {
pull_image(engine, image, verbose)?;
}
Expand All @@ -149,7 +155,7 @@ fn image_info(engine: &PathBuf, target: &str, image: &str, tag: &str, verbose: b

fn target_info(
mut targets: Vec<String>,
engine: &PathBuf,
engine: &Path,
verbose: bool,
registry: &str,
repository: &str,
Expand All @@ -162,7 +168,7 @@ fn target_info(
targets = matrix
.iter()
.map(|t| t.target.clone())
.filter(|t| target_has_image(&t))
.filter(|t| target_has_image(t))
.collect();
}

Expand Down
17 changes: 6 additions & 11 deletions src/bin/cross-util.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![deny(missing_debug_implementations, rust_2018_idioms)]

use std::path::PathBuf;
use std::path::{Path, PathBuf};
use std::process::Command;

use clap::{Parser, Subcommand};
Expand Down Expand Up @@ -68,7 +68,7 @@ fn is_local_image(image: &str) -> bool {
tag.starts_with("local")
}

fn get_cross_images(engine: &PathBuf, verbose: bool, local: bool) -> cross::Result<Vec<String>> {
fn get_cross_images(engine: &Path, verbose: bool, local: bool) -> cross::Result<Vec<String>> {
let stdout = Command::new(engine)
.arg("images")
.arg("--format")
Expand Down Expand Up @@ -119,7 +119,7 @@ fn get_image_target(image: &str) -> cross::Result<String> {
}
}

fn list_images(engine: &PathBuf, verbose: bool) -> cross::Result<()> {
fn list_images(engine: &Path, verbose: bool) -> cross::Result<()> {
get_cross_images(engine, verbose, true)?
.iter()
.for_each(|line| println!("{}", line));
Expand All @@ -128,7 +128,7 @@ fn list_images(engine: &PathBuf, verbose: bool) -> cross::Result<()> {
}

fn remove_images(
engine: &PathBuf,
engine: &Path,
images: &[String],
verbose: bool,
force: bool,
Expand All @@ -142,18 +142,13 @@ fn remove_images(
command.run(verbose)
}

fn remove_all_images(
engine: &PathBuf,
verbose: bool,
force: bool,
local: bool,
) -> cross::Result<()> {
fn remove_all_images(engine: &Path, verbose: bool, force: bool, local: bool) -> cross::Result<()> {
let images = get_cross_images(engine, verbose, local)?;
remove_images(engine, &images, verbose, force)
}

fn remove_target_images(
engine: &PathBuf,
engine: &Path,
targets: &[String],
verbose: bool,
force: bool,
Expand Down

0 comments on commit e4b9515

Please sign in to comment.