chore(rust): clippy fix

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
Kasper Juul Hermansen 2023-08-04 01:18:58 +02:00
parent d6e6dcb032
commit 78307ec8a3
Signed by: kjuulh
GPG Key ID: 9AA7BC13CE474394
2 changed files with 40 additions and 40 deletions

View File

@ -2,19 +2,19 @@ use std::path::Path;
use std::path::PathBuf;
use std::sync::Arc;
use build::build_and_deploy;
use clap::Args;
use clap::Parser;
use clap::Subcommand;
use clap::ValueEnum;
use dagger_sdk::ContainerId;
use dagger_sdk::ContainerPublishOpts;
use dagger_sdk::Platform;
use dagger_sdk::QueryContainerOpts;
use futures::StreamExt;
use tokio::sync::Mutex;
use tokio::task::JoinHandle;
use crate::please_release::run_release_please;
@ -137,7 +137,7 @@ async fn main() -> eyre::Result<()> {
&cli.global,
&base_image,
&prod_image,
&bin_name,
bin_name,
&None,
)
.await?;
@ -158,11 +158,11 @@ async fn main() -> eyre::Result<()> {
image,
bin_name,
} => {
build::build_and_deploy(client, &cli.global, &bin_name, &image, &tag).await?;
build::build_and_deploy(client, &cli.global, bin_name, image, tag).await?;
}
LocalCommands::PleaseRelease => todo!(),
LocalCommands::BuildDocs {} => {
let image = docs::execute(
let _image = docs::execute(
client.clone(),
&cli.global,
&Some("linux/amd64".to_string()),
@ -179,10 +179,10 @@ async fn main() -> eyre::Result<()> {
let args = &cli.global;
let base_image =
base_rust_image(client.clone(), &args, &None, bin_name, &"debug".into())
base_rust_image(client.clone(), args, &None, bin_name, &"debug".into())
.await
.unwrap();
test::execute(client.clone(), &args, base_image)
test::execute(client.clone(), args, base_image)
.await
.unwrap();
}
@ -195,14 +195,14 @@ async fn main() -> eyre::Result<()> {
) {
let args = &cli.global;
build::build(client.clone(), &args, bin_name, image, tag)
build::build(client.clone(), args, bin_name, image, tag)
.await
.unwrap();
}
tokio::join!(
test(client.clone(), &cli, &bin_name),
build(client.clone(), &cli, &bin_name, &image, &tag),
test(client.clone(), &cli, bin_name),
build(client.clone(), &cli, bin_name, image, tag),
);
}
Commands::Main {
@ -214,10 +214,10 @@ async fn main() -> eyre::Result<()> {
let args = &cli.global;
let base_image =
base_rust_image(client.clone(), &args, &None, bin_name, &"debug".into())
base_rust_image(client.clone(), args, &None, bin_name, &"debug".into())
.await
.unwrap();
test::execute(client.clone(), &args, base_image)
test::execute(client.clone(), args, base_image)
.await
.unwrap();
}
@ -230,7 +230,7 @@ async fn main() -> eyre::Result<()> {
) {
let args = &cli.global;
build::build_and_deploy(client.clone(), &args, bin_name, image, tag)
build::build_and_deploy(client.clone(), args, bin_name, image, tag)
.await
.unwrap();
}
@ -242,8 +242,8 @@ async fn main() -> eyre::Result<()> {
}
tokio::join!(
test(client.clone(), &cli, &bin_name),
build(client.clone(), &cli, &bin_name, &image, &tag),
test(client.clone(), &cli, bin_name),
build(client.clone(), &cli, bin_name, image, tag),
cuddle_please(client.clone(), &cli)
);
}
@ -257,9 +257,9 @@ mod please_release {
use std::sync::Arc;
use dagger_sdk::Container;
use crate::{base_rust_image, build, get_base_debian_image, get_rust_dep_src, GlobalArgs};
use crate::{base_rust_image, GlobalArgs};
pub async fn run_release_please(
client: Arc<dagger_sdk::Query>,
@ -366,7 +366,7 @@ mod docs {
pub async fn execute(
client: Arc<dagger_sdk::Query>,
args: &GlobalArgs,
platform: &Option<String>,
_platform: &Option<String>,
) -> eyre::Result<Container> {
let mkdocs_container = client.container().from(
args.mkdocs_image
@ -429,9 +429,9 @@ mod build {
use dagger_sdk::Container;
use futures::StreamExt;
use tokio::sync::Mutex;
use tokio::task::JoinHandle;
use crate::{base_rust_image, get_base_debian_image, GlobalArgs};
@ -453,7 +453,7 @@ mod build {
let container = base_rust_image(
client.clone(),
&args,
args,
&Some("linux/amd64".to_string()),
&bin_name.clone(),
&"release".into(),
@ -461,10 +461,10 @@ mod build {
.await?;
let build_image = execute(
client.clone(),
&args,
args,
&container,
&base_image,
&bin_name,
bin_name,
&Some("linux/amd64".to_string()),
)
.await?;
@ -487,8 +487,8 @@ mod build {
client: Arc<dagger_sdk::Query>,
args: &GlobalArgs,
bin_name: &String,
image: &String,
tag: &String,
_image: &String,
_tag: &String,
) -> eyre::Result<()> {
// let containers = vec!["linux/amd64", "linux/arm64"];
@ -501,7 +501,7 @@ mod build {
let container = base_rust_image(
client.clone(),
&args,
args,
&Some("linux/amd64".to_string()),
&bin_name.clone(),
&"release".into(),
@ -509,10 +509,10 @@ mod build {
.await?;
let build_image = execute(
client.clone(),
&args,
args,
&container,
&base_image,
&bin_name,
bin_name,
&Some("linux/amd64".to_string()),
)
.await?;
@ -545,7 +545,7 @@ mod build {
rust_target,
"--release",
"-p",
&bin_name,
bin_name,
]);
let final_image = base_image
@ -556,7 +556,7 @@ mod build {
.id()
.await?,
)
.with_exec(vec![&bin_name, "--help"]);
.with_exec(vec![bin_name, "--help"]);
let output = final_image.stdout().await?;
println!("{output}");
@ -654,12 +654,12 @@ pub async fn get_rust_dep_src(
.build()?,
);
return Ok(directory);
Ok(directory)
}
pub async fn get_rust_skeleton_files(
client: Arc<dagger_sdk::Query>,
args: &GlobalArgs,
_args: &GlobalArgs,
) -> eyre::Result<(dagger_sdk::Directory, Vec<String>)> {
let mut rust_crates = vec![PathBuf::from("ci")];
let mut dirs = tokio::fs::read_dir("crates").await?;
@ -701,7 +701,7 @@ pub async fn get_rust_skeleton_files(
if let Some(file_name) = rust_crate.file_name() {
crate_names.push(file_name.to_str().unwrap().to_string());
}
directory = create_skeleton_files(directory, &rust_crate)?;
directory = create_skeleton_files(directory, rust_crate)?;
}
Ok((directory, crate_names))
@ -739,7 +739,7 @@ pub async fn base_rust_image(
.with_exec(vec!["rustup", "target", "add", rust_target]);
let target_cache = client.cache_volume(format!("rust_target_{}", profile));
let mut build_options = vec!["cargo", "build", "--target", rust_target, "-p", &bin_name];
let mut build_options = vec!["cargo", "build", "--target", rust_target, "-p", bin_name];
if profile == "release" {
build_options.push("--release");
@ -754,7 +754,7 @@ pub async fn base_rust_image(
let exclude = crates
.iter()
.filter(|c| **c != "ci")
.map(|c| format!("**/*{}*", c.replace("-", "_")))
.map(|c| format!("**/*{}*", c.replace('-', "_")))
.collect::<Vec<_>>();
let exclude = exclude.iter().map(|c| c.as_str()).collect();

View File

@ -67,7 +67,7 @@ impl VcsClient {
"-c",
&format!("http.extraHeader='Authorization: token {}'", token),
"-c",
&format!("http.extraHeader='Sudo: kjuulh'"),
"http.extraHeader='Sudo: kjuulh'",
"-c",
&format!("user.name={}", username),
"-c",