Skip to content

Commit c8299de

Browse files
dphmadampetro
andcommitted
Minor fixes
Co-authored-by: Adam Petro <[email protected]>
1 parent a1e2331 commit c8299de

File tree

1 file changed

+4
-7
lines changed
  • shopify_function_macro/src

1 file changed

+4
-7
lines changed

shopify_function_macro/src/lib.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ pub fn generate_types(attr: proc_macro::TokenStream) -> proc_macro::TokenStream
156156
let schema_path = extract_attr(&params, "schema_path");
157157

158158
let input_struct = generate_struct("Input", &query_path, &schema_path);
159-
let output_struct = generate_struct("Output", &OUTPUT_QUERY_FILE_NAME, &schema_path);
159+
let output_struct = generate_struct("Output", OUTPUT_QUERY_FILE_NAME, &schema_path);
160160
let output_query =
161161
"mutation Output($result: FunctionResult!) {\n handleResult(result: $result)\n}\n";
162162

@@ -174,7 +174,6 @@ fn generate_struct(name: &str, query_path: &str, schema_path: &str) -> TokenStre
174174

175175
quote! {
176176
#[derive(graphql_client::GraphQLQuery, Clone, Debug, serde::Deserialize, PartialEq)]
177-
#[serde(rename_all(deserialize = "camelCase"))]
178177
#[graphql(
179178
query_path = #query_path,
180179
schema_path = #schema_path,
@@ -184,17 +183,15 @@ fn generate_struct(name: &str, query_path: &str, schema_path: &str) -> TokenStre
184183
)]
185184
struct #name_ident;
186185
}
187-
.into()
188186
}
189187

190188
fn write_output_query_file(output_query_file_name: &str, contents: &str) {
191189
let cargo_manifest_dir = std::env::var("CARGO_MANIFEST_DIR").unwrap();
192-
let mut output_query_path = Path::new(&cargo_manifest_dir).to_path_buf();
193-
output_query_path.push(output_query_file_name);
194-
std::fs::File::create(&output_query_path)
190+
let output_query_path = Path::new(&cargo_manifest_dir).join(output_query_file_name);
191+
std::fs::File::create(output_query_path)
195192
.expect("Could not create output query file")
196193
.write_all(contents.as_bytes())
197-
.expect(&format!("Could not write to {}", output_query_file_name));
194+
.unwrap_or_else(|_| panic!("Could not write to {}", output_query_file_name));
198195
}
199196

200197
#[cfg(test)]

0 commit comments

Comments
 (0)