Skip to content

Commit f175e85

Browse files
committed
Avoid useless allocation + keep track of the parse error
1 parent 7c626da commit f175e85

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

graphql_client_codegen/src/codegen.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,8 @@ fn generate_scalar_definitions<'a, 'schema: 'a>(
167167
fn render_derives<'a>(derives: impl Iterator<Item = &'a str>) -> impl quote::ToTokens {
168168
let idents = derives.map(|s| {
169169
syn::parse_str::<syn::Path>(s)
170-
.expect(format!("couldn't parse {} as a derive Path", s).as_str())
170+
.map_err(|e| format!("couldn't parse {} as a derive Path: {}", s, e))
171+
.unwrap()
171172
});
172173

173174
quote!(#[derive(#(#idents),*)])

0 commit comments

Comments
 (0)