Skip to content

Commit b731209

Browse files
dphmadampetro
andcommitted
Replace arg parse panic! with lookahead.error()
Remove unnecessary .to_string() Co-authored-by: Adam Petro <[email protected]>
1 parent a0e9d48 commit b731209

File tree

1 file changed

+1
-3
lines changed
  • shopify_function_macro/src

1 file changed

+1
-3
lines changed

shopify_function_macro/src/lib.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ impl Parse for ShopifyFunctionTargetArgs {
157157
} else if lookahead.peek(kw::output_stream) {
158158
args.output_stream = Some(Self::parse::<kw::output_stream, Expr>(&input)?);
159159
} else {
160-
panic!("Unknown shopify_function_target parameter");
160+
return Err(lookahead.error());
161161
}
162162
}
163163
Ok(args)
@@ -211,12 +211,10 @@ pub fn shopify_function_target(
211211
let target_handle_string = args.target.map_or(function_name_string.clone(), |target| {
212212
target
213213
.value()
214-
.to_string()
215214
.split('.')
216215
.collect::<Vec<&str>>()
217216
.last()
218217
.unwrap()
219-
.to_string()
220218
.to_case(Case::Snake)
221219
});
222220
let module_name = args.module_name.map_or(

0 commit comments

Comments
 (0)