fix all clippy

This commit is contained in:
Kasper Juul Hermansen 2023-02-17 17:51:39 +01:00
parent 0cbd1790b0
commit 6be8482b46
Signed by: kjuulh
GPG Key ID: 57B6E1465221F912
5 changed files with 48 additions and 48 deletions

View File

@ -37,7 +37,7 @@ impl FormatTypeFuncs for FormatTypeFunc {
&self, &self,
representation: &str, representation: &str,
ref_name: &str, ref_name: &str,
input: bool, _input: bool,
) -> String { ) -> String {
let mut rep = representation.to_string(); let mut rep = representation.to_string();
rep.push_str(&format_name(ref_name)); rep.push_str(&format_name(ref_name));

View File

@ -5,8 +5,8 @@ use genco::quote;
use genco::tokens::quoted; use genco::tokens::quoted;
use crate::functions::{ use crate::functions::{
type_field_has_optional, type_ref_is_list, type_ref_is_list_of_objects, type_ref_is_object, type_field_has_optional, type_ref_is_list_of_objects, type_ref_is_object,
type_ref_is_optional, type_ref_is_scalar, CommonFunctions, type_ref_is_optional, CommonFunctions,
}; };
use crate::utility::OptionExt; use crate::utility::OptionExt;
@ -53,7 +53,7 @@ pub fn format_function(funcs: &CommonFunctions, field: &FullTypeFields) -> Optio
}) })
} }
fn render_required_args(funcs: &CommonFunctions, field: &FullTypeFields) -> Option<rust::Tokens> { fn render_required_args(_funcs: &CommonFunctions, field: &FullTypeFields) -> Option<rust::Tokens> {
if let Some(args) = field.args.as_ref() { if let Some(args) = field.args.as_ref() {
let args = args let args = args
.into_iter() .into_iter()
@ -83,7 +83,7 @@ fn render_required_args(funcs: &CommonFunctions, field: &FullTypeFields) -> Opti
} }
} }
fn render_optional_args(funcs: &CommonFunctions, field: &FullTypeFields) -> Option<rust::Tokens> { fn render_optional_args(_funcs: &CommonFunctions, field: &FullTypeFields) -> Option<rust::Tokens> {
if let Some(args) = field.args.as_ref() { if let Some(args) = field.args.as_ref() {
let args = args let args = args
.into_iter() .into_iter()

View File

@ -31,7 +31,7 @@ impl Generator for RustGenerator {
handlers: VisitHandlers { handlers: VisitHandlers {
visit_scalar: Arc::new({ visit_scalar: Arc::new({
let render = render.clone(); let render = render.clone();
let common_funcs = common_funcs.clone(); let _common_funcs = common_funcs.clone();
move |t| { move |t| {
println!("generating scalar"); println!("generating scalar");
@ -83,7 +83,7 @@ impl Generator for RustGenerator {
}), }),
visit_enum: Arc::new({ visit_enum: Arc::new({
let render = render.clone(); let render = render.clone();
let common_funcs = common_funcs.clone(); let _common_funcs = common_funcs.clone();
move |t| { move |t| {
println!("generating enum"); println!("generating enum");

View File

@ -1,4 +1,4 @@
use dagger_sdk::gen::HostDirectoryOpts;
use rand::Rng; use rand::Rng;
fn main() -> eyre::Result<()> { fn main() -> eyre::Result<()> {

View File

@ -32,7 +32,7 @@ pub struct CacheVolume {
impl CacheVolume { impl CacheVolume {
pub fn id(&self) -> CacheId { pub fn id(&self) -> CacheId {
let mut query = self.selection.select("id"); let query = self.selection.select("id");
query.execute(&graphql_client(&self.conn)).unwrap().unwrap() query.execute(&graphql_client(&self.conn)).unwrap().unwrap()
} }
@ -112,7 +112,7 @@ impl Container {
}; };
} }
pub fn default_args(&self) -> Vec<String> { pub fn default_args(&self) -> Vec<String> {
let mut query = self.selection.select("defaultArgs"); let query = self.selection.select("defaultArgs");
query.execute(&graphql_client(&self.conn)).unwrap().unwrap() query.execute(&graphql_client(&self.conn)).unwrap().unwrap()
} }
@ -128,7 +128,7 @@ impl Container {
}; };
} }
pub fn entrypoint(&self) -> Vec<String> { pub fn entrypoint(&self) -> Vec<String> {
let mut query = self.selection.select("entrypoint"); let query = self.selection.select("entrypoint");
query.execute(&graphql_client(&self.conn)).unwrap().unwrap() query.execute(&graphql_client(&self.conn)).unwrap().unwrap()
} }
@ -140,7 +140,7 @@ impl Container {
query.execute(&graphql_client(&self.conn)).unwrap().unwrap() query.execute(&graphql_client(&self.conn)).unwrap().unwrap()
} }
pub fn env_variables(&self) -> Vec<EnvVariable> { pub fn env_variables(&self) -> Vec<EnvVariable> {
let mut query = self.selection.select("envVariables"); let query = self.selection.select("envVariables");
return vec![EnvVariable { return vec![EnvVariable {
proc: self.proc.clone(), proc: self.proc.clone(),
@ -181,7 +181,7 @@ impl Container {
}; };
} }
pub fn exit_code(&self) -> isize { pub fn exit_code(&self) -> isize {
let mut query = self.selection.select("exitCode"); let query = self.selection.select("exitCode");
query.execute(&graphql_client(&self.conn)).unwrap().unwrap() query.execute(&graphql_client(&self.conn)).unwrap().unwrap()
} }
@ -220,7 +220,7 @@ impl Container {
}; };
} }
pub fn fs(&self) -> Directory { pub fn fs(&self) -> Directory {
let mut query = self.selection.select("fs"); let query = self.selection.select("fs");
return Directory { return Directory {
proc: self.proc.clone(), proc: self.proc.clone(),
@ -229,7 +229,7 @@ impl Container {
}; };
} }
pub fn id(&self) -> ContainerId { pub fn id(&self) -> ContainerId {
let mut query = self.selection.select("id"); let query = self.selection.select("id");
query.execute(&graphql_client(&self.conn)).unwrap().unwrap() query.execute(&graphql_client(&self.conn)).unwrap().unwrap()
} }
@ -241,7 +241,7 @@ impl Container {
query.execute(&graphql_client(&self.conn)).unwrap().unwrap() query.execute(&graphql_client(&self.conn)).unwrap().unwrap()
} }
pub fn labels(&self) -> Vec<Label> { pub fn labels(&self) -> Vec<Label> {
let mut query = self.selection.select("labels"); let query = self.selection.select("labels");
return vec![Label { return vec![Label {
proc: self.proc.clone(), proc: self.proc.clone(),
@ -250,7 +250,7 @@ impl Container {
}]; }];
} }
pub fn mounts(&self) -> Vec<String> { pub fn mounts(&self) -> Vec<String> {
let mut query = self.selection.select("mounts"); let query = self.selection.select("mounts");
query.execute(&graphql_client(&self.conn)).unwrap().unwrap() query.execute(&graphql_client(&self.conn)).unwrap().unwrap()
} }
@ -271,7 +271,7 @@ impl Container {
}; };
} }
pub fn platform(&self) -> Platform { pub fn platform(&self) -> Platform {
let mut query = self.selection.select("platform"); let query = self.selection.select("platform");
query.execute(&graphql_client(&self.conn)).unwrap().unwrap() query.execute(&graphql_client(&self.conn)).unwrap().unwrap()
} }
@ -288,7 +288,7 @@ impl Container {
query.execute(&graphql_client(&self.conn)).unwrap().unwrap() query.execute(&graphql_client(&self.conn)).unwrap().unwrap()
} }
pub fn rootfs(&self) -> Directory { pub fn rootfs(&self) -> Directory {
let mut query = self.selection.select("rootfs"); let query = self.selection.select("rootfs");
return Directory { return Directory {
proc: self.proc.clone(), proc: self.proc.clone(),
@ -297,17 +297,17 @@ impl Container {
}; };
} }
pub fn stderr(&self) -> String { pub fn stderr(&self) -> String {
let mut query = self.selection.select("stderr"); let query = self.selection.select("stderr");
query.execute(&graphql_client(&self.conn)).unwrap().unwrap() query.execute(&graphql_client(&self.conn)).unwrap().unwrap()
} }
pub fn stdout(&self) -> String { pub fn stdout(&self) -> String {
let mut query = self.selection.select("stdout"); let query = self.selection.select("stdout");
query.execute(&graphql_client(&self.conn)).unwrap().unwrap() query.execute(&graphql_client(&self.conn)).unwrap().unwrap()
} }
pub fn user(&self) -> String { pub fn user(&self) -> String {
let mut query = self.selection.select("user"); let query = self.selection.select("user");
query.execute(&graphql_client(&self.conn)).unwrap().unwrap() query.execute(&graphql_client(&self.conn)).unwrap().unwrap()
} }
@ -639,7 +639,7 @@ impl Container {
}; };
} }
pub fn workdir(&self) -> String { pub fn workdir(&self) -> String {
let mut query = self.selection.select("workdir"); let query = self.selection.select("workdir");
query.execute(&graphql_client(&self.conn)).unwrap().unwrap() query.execute(&graphql_client(&self.conn)).unwrap().unwrap()
} }
@ -753,7 +753,7 @@ impl Directory {
}; };
} }
pub fn id(&self) -> DirectoryId { pub fn id(&self) -> DirectoryId {
let mut query = self.selection.select("id"); let query = self.selection.select("id");
query.execute(&graphql_client(&self.conn)).unwrap().unwrap() query.execute(&graphql_client(&self.conn)).unwrap().unwrap()
} }
@ -915,12 +915,12 @@ pub struct EnvVariable {
impl EnvVariable { impl EnvVariable {
pub fn name(&self) -> String { pub fn name(&self) -> String {
let mut query = self.selection.select("name"); let query = self.selection.select("name");
query.execute(&graphql_client(&self.conn)).unwrap().unwrap() query.execute(&graphql_client(&self.conn)).unwrap().unwrap()
} }
pub fn value(&self) -> String { pub fn value(&self) -> String {
let mut query = self.selection.select("value"); let query = self.selection.select("value");
query.execute(&graphql_client(&self.conn)).unwrap().unwrap() query.execute(&graphql_client(&self.conn)).unwrap().unwrap()
} }
@ -933,7 +933,7 @@ pub struct File {
impl File { impl File {
pub fn contents(&self) -> String { pub fn contents(&self) -> String {
let mut query = self.selection.select("contents"); let query = self.selection.select("contents");
query.execute(&graphql_client(&self.conn)).unwrap().unwrap() query.execute(&graphql_client(&self.conn)).unwrap().unwrap()
} }
@ -945,12 +945,12 @@ impl File {
query.execute(&graphql_client(&self.conn)).unwrap().unwrap() query.execute(&graphql_client(&self.conn)).unwrap().unwrap()
} }
pub fn id(&self) -> FileId { pub fn id(&self) -> FileId {
let mut query = self.selection.select("id"); let query = self.selection.select("id");
query.execute(&graphql_client(&self.conn)).unwrap().unwrap() query.execute(&graphql_client(&self.conn)).unwrap().unwrap()
} }
pub fn secret(&self) -> Secret { pub fn secret(&self) -> Secret {
let mut query = self.selection.select("secret"); let query = self.selection.select("secret");
return Secret { return Secret {
proc: self.proc.clone(), proc: self.proc.clone(),
@ -959,7 +959,7 @@ impl File {
}; };
} }
pub fn size(&self) -> isize { pub fn size(&self) -> isize {
let mut query = self.selection.select("size"); let query = self.selection.select("size");
query.execute(&graphql_client(&self.conn)).unwrap().unwrap() query.execute(&graphql_client(&self.conn)).unwrap().unwrap()
} }
@ -988,7 +988,7 @@ pub struct GitRefTreeOpts {
impl GitRef { impl GitRef {
pub fn digest(&self) -> String { pub fn digest(&self) -> String {
let mut query = self.selection.select("digest"); let query = self.selection.select("digest");
query.execute(&graphql_client(&self.conn)).unwrap().unwrap() query.execute(&graphql_client(&self.conn)).unwrap().unwrap()
} }
@ -1030,7 +1030,7 @@ impl GitRepository {
}; };
} }
pub fn branches(&self) -> Vec<String> { pub fn branches(&self) -> Vec<String> {
let mut query = self.selection.select("branches"); let query = self.selection.select("branches");
query.execute(&graphql_client(&self.conn)).unwrap().unwrap() query.execute(&graphql_client(&self.conn)).unwrap().unwrap()
} }
@ -1057,7 +1057,7 @@ impl GitRepository {
}; };
} }
pub fn tags(&self) -> Vec<String> { pub fn tags(&self) -> Vec<String> {
let mut query = self.selection.select("tags"); let query = self.selection.select("tags");
query.execute(&graphql_client(&self.conn)).unwrap().unwrap() query.execute(&graphql_client(&self.conn)).unwrap().unwrap()
} }
@ -1146,7 +1146,7 @@ pub struct HostVariable {
impl HostVariable { impl HostVariable {
pub fn secret(&self) -> Secret { pub fn secret(&self) -> Secret {
let mut query = self.selection.select("secret"); let query = self.selection.select("secret");
return Secret { return Secret {
proc: self.proc.clone(), proc: self.proc.clone(),
@ -1155,7 +1155,7 @@ impl HostVariable {
}; };
} }
pub fn value(&self) -> String { pub fn value(&self) -> String {
let mut query = self.selection.select("value"); let query = self.selection.select("value");
query.execute(&graphql_client(&self.conn)).unwrap().unwrap() query.execute(&graphql_client(&self.conn)).unwrap().unwrap()
} }
@ -1168,12 +1168,12 @@ pub struct Label {
impl Label { impl Label {
pub fn name(&self) -> String { pub fn name(&self) -> String {
let mut query = self.selection.select("name"); let query = self.selection.select("name");
query.execute(&graphql_client(&self.conn)).unwrap().unwrap() query.execute(&graphql_client(&self.conn)).unwrap().unwrap()
} }
pub fn value(&self) -> String { pub fn value(&self) -> String {
let mut query = self.selection.select("value"); let query = self.selection.select("value");
query.execute(&graphql_client(&self.conn)).unwrap().unwrap() query.execute(&graphql_client(&self.conn)).unwrap().unwrap()
} }
@ -1186,7 +1186,7 @@ pub struct Project {
impl Project { impl Project {
pub fn extensions(&self) -> Vec<Project> { pub fn extensions(&self) -> Vec<Project> {
let mut query = self.selection.select("extensions"); let query = self.selection.select("extensions");
return vec![Project { return vec![Project {
proc: self.proc.clone(), proc: self.proc.clone(),
@ -1195,7 +1195,7 @@ impl Project {
}]; }];
} }
pub fn generated_code(&self) -> Directory { pub fn generated_code(&self) -> Directory {
let mut query = self.selection.select("generatedCode"); let query = self.selection.select("generatedCode");
return Directory { return Directory {
proc: self.proc.clone(), proc: self.proc.clone(),
@ -1204,22 +1204,22 @@ impl Project {
}; };
} }
pub fn install(&self) -> bool { pub fn install(&self) -> bool {
let mut query = self.selection.select("install"); let query = self.selection.select("install");
query.execute(&graphql_client(&self.conn)).unwrap().unwrap() query.execute(&graphql_client(&self.conn)).unwrap().unwrap()
} }
pub fn name(&self) -> String { pub fn name(&self) -> String {
let mut query = self.selection.select("name"); let query = self.selection.select("name");
query.execute(&graphql_client(&self.conn)).unwrap().unwrap() query.execute(&graphql_client(&self.conn)).unwrap().unwrap()
} }
pub fn schema(&self) -> String { pub fn schema(&self) -> String {
let mut query = self.selection.select("schema"); let query = self.selection.select("schema");
query.execute(&graphql_client(&self.conn)).unwrap().unwrap() query.execute(&graphql_client(&self.conn)).unwrap().unwrap()
} }
pub fn sdk(&self) -> String { pub fn sdk(&self) -> String {
let mut query = self.selection.select("sdk"); let query = self.selection.select("sdk");
query.execute(&graphql_client(&self.conn)).unwrap().unwrap() query.execute(&graphql_client(&self.conn)).unwrap().unwrap()
} }
@ -1278,7 +1278,7 @@ impl Query {
}; };
} }
pub fn default_platform(&self) -> Platform { pub fn default_platform(&self) -> Platform {
let mut query = self.selection.select("defaultPlatform"); let query = self.selection.select("defaultPlatform");
query.execute(&graphql_client(&self.conn)).unwrap().unwrap() query.execute(&graphql_client(&self.conn)).unwrap().unwrap()
} }
@ -1325,7 +1325,7 @@ impl Query {
}; };
} }
pub fn host(&self) -> Host { pub fn host(&self) -> Host {
let mut query = self.selection.select("host"); let query = self.selection.select("host");
return Host { return Host {
proc: self.proc.clone(), proc: self.proc.clone(),
@ -1406,12 +1406,12 @@ pub struct Secret {
impl Secret { impl Secret {
pub fn id(&self) -> SecretId { pub fn id(&self) -> SecretId {
let mut query = self.selection.select("id"); let query = self.selection.select("id");
query.execute(&graphql_client(&self.conn)).unwrap().unwrap() query.execute(&graphql_client(&self.conn)).unwrap().unwrap()
} }
pub fn plaintext(&self) -> String { pub fn plaintext(&self) -> String {
let mut query = self.selection.select("plaintext"); let query = self.selection.select("plaintext");
query.execute(&graphql_client(&self.conn)).unwrap().unwrap() query.execute(&graphql_client(&self.conn)).unwrap().unwrap()
} }
@ -1424,7 +1424,7 @@ pub struct Socket {
impl Socket { impl Socket {
pub fn id(&self) -> SocketId { pub fn id(&self) -> SocketId {
let mut query = self.selection.select("id"); let query = self.selection.select("id");
query.execute(&graphql_client(&self.conn)).unwrap().unwrap() query.execute(&graphql_client(&self.conn)).unwrap().unwrap()
} }