diff --git a/crates/dagger-codegen/src/rust/functions.rs b/crates/dagger-codegen/src/rust/functions.rs index 31604a2..011409c 100644 --- a/crates/dagger-codegen/src/rust/functions.rs +++ b/crates/dagger-codegen/src/rust/functions.rs @@ -5,8 +5,8 @@ use genco::quote; use genco::tokens::quoted; use crate::functions::{ - type_field_has_optional, type_ref_is_list_of_objects, type_ref_is_object, - type_ref_is_optional, CommonFunctions, + type_field_has_optional, type_ref_is_list_of_objects, type_ref_is_object, type_ref_is_optional, + CommonFunctions, }; use crate::utility::OptionExt; @@ -67,7 +67,7 @@ fn render_required_args(_funcs: &CommonFunctions, field: &FullTypeFields) -> Opt let name = &s.input_value.name; Some(quote! { - query = query.arg($(quoted(name)), $(n)).unwrap(); + query = query.arg($(quoted(name)), $(n)); }) }) }) @@ -98,7 +98,7 @@ fn render_optional_args(_funcs: &CommonFunctions, field: &FullTypeFields) -> Opt Some(quote! { if let Some($(&n)) = opts.$(&n) { - query = query.arg($(quoted(name)), $(&n)).unwrap(); + query = query.arg($(quoted(name)), $(&n)); } }) }) @@ -163,7 +163,7 @@ fn render_execution(funcs: &CommonFunctions, field: &FullTypeFields) -> rust::To let graphql_client = rust::import("crate::client", "graphql_client"); quote! { - query.execute(&$graphql_client(&self.conn)).unwrap().unwrap() + query.execute(&$graphql_client(&self.conn)).unwrap() } } diff --git a/crates/dagger-sdk/src/gen.rs b/crates/dagger-sdk/src/gen.rs index 962b8c5..c8e74fe 100644 --- a/crates/dagger-sdk/src/gen.rs +++ b/crates/dagger-sdk/src/gen.rs @@ -34,7 +34,7 @@ impl CacheVolume { pub fn id(&self) -> CacheId { let mut query = self.selection.select("id"); - query.execute(&graphql_client(&self.conn)).unwrap().unwrap() + query.execute(&graphql_client(&self.conn)).unwrap() } } pub struct Container { @@ -93,16 +93,16 @@ impl Container { pub fn build(&self, context: DirectoryId, opts: Option) -> Container { let mut query = self.selection.select("build"); - query = query.arg("context", context).unwrap(); + query = query.arg("context", context); if let Some(opts) = opts { if let Some(dockerfile) = opts.dockerfile { - query = query.arg("dockerfile", dockerfile).unwrap(); + query = query.arg("dockerfile", dockerfile); } if let Some(build_args) = opts.build_args { - query = query.arg("buildArgs", build_args).unwrap(); + query = query.arg("buildArgs", build_args); } if let Some(target) = opts.target { - query = query.arg("target", target).unwrap(); + query = query.arg("target", target); } } @@ -115,12 +115,12 @@ impl Container { pub fn default_args(&self) -> Vec { let mut query = self.selection.select("defaultArgs"); - query.execute(&graphql_client(&self.conn)).unwrap().unwrap() + query.execute(&graphql_client(&self.conn)).unwrap() } pub fn directory(&self, path: String) -> Directory { let mut query = self.selection.select("directory"); - query = query.arg("path", path).unwrap(); + query = query.arg("path", path); return Directory { proc: self.proc.clone(), @@ -131,14 +131,14 @@ impl Container { pub fn entrypoint(&self) -> Vec { let mut query = self.selection.select("entrypoint"); - query.execute(&graphql_client(&self.conn)).unwrap().unwrap() + query.execute(&graphql_client(&self.conn)).unwrap() } pub fn env_variable(&self, name: String) -> String { let mut query = self.selection.select("envVariable"); - query = query.arg("name", name).unwrap(); + query = query.arg("name", name); - query.execute(&graphql_client(&self.conn)).unwrap().unwrap() + query.execute(&graphql_client(&self.conn)).unwrap() } pub fn env_variables(&self) -> Vec { let mut query = self.selection.select("envVariables"); @@ -154,24 +154,22 @@ impl Container { if let Some(opts) = opts { if let Some(args) = opts.args { - query = query.arg("args", args).unwrap(); + query = query.arg("args", args); } if let Some(stdin) = opts.stdin { - query = query.arg("stdin", stdin).unwrap(); + query = query.arg("stdin", stdin); } if let Some(redirect_stdout) = opts.redirect_stdout { - query = query.arg("redirectStdout", redirect_stdout).unwrap(); + query = query.arg("redirectStdout", redirect_stdout); } if let Some(redirect_stderr) = opts.redirect_stderr { - query = query.arg("redirectStderr", redirect_stderr).unwrap(); + query = query.arg("redirectStderr", redirect_stderr); } if let Some(experimental_privileged_nesting) = opts.experimental_privileged_nesting { - query = query - .arg( - "experimentalPrivilegedNesting", - experimental_privileged_nesting, - ) - .unwrap(); + query = query.arg( + "experimentalPrivilegedNesting", + experimental_privileged_nesting, + ); } } @@ -184,24 +182,24 @@ impl Container { pub fn exit_code(&self) -> isize { let mut query = self.selection.select("exitCode"); - query.execute(&graphql_client(&self.conn)).unwrap().unwrap() + query.execute(&graphql_client(&self.conn)).unwrap() } pub fn export(&self, path: String, opts: Option) -> bool { let mut query = self.selection.select("export"); - query = query.arg("path", path).unwrap(); + query = query.arg("path", path); if let Some(opts) = opts { if let Some(platform_variants) = opts.platform_variants { - query = query.arg("platformVariants", platform_variants).unwrap(); + query = query.arg("platformVariants", platform_variants); } } - query.execute(&graphql_client(&self.conn)).unwrap().unwrap() + query.execute(&graphql_client(&self.conn)).unwrap() } pub fn file(&self, path: String) -> File { let mut query = self.selection.select("file"); - query = query.arg("path", path).unwrap(); + query = query.arg("path", path); return File { proc: self.proc.clone(), @@ -212,7 +210,7 @@ impl Container { pub fn from(&self, address: String) -> Container { let mut query = self.selection.select("from"); - query = query.arg("address", address).unwrap(); + query = query.arg("address", address); return Container { proc: self.proc.clone(), @@ -232,14 +230,14 @@ impl Container { pub fn id(&self) -> ContainerId { let mut query = self.selection.select("id"); - query.execute(&graphql_client(&self.conn)).unwrap().unwrap() + query.execute(&graphql_client(&self.conn)).unwrap() } pub fn label(&self, name: String) -> String { let mut query = self.selection.select("label"); - query = query.arg("name", name).unwrap(); + query = query.arg("name", name); - query.execute(&graphql_client(&self.conn)).unwrap().unwrap() + query.execute(&graphql_client(&self.conn)).unwrap() } pub fn labels(&self) -> Vec