We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 710d03a commit 83bde3aCopy full SHA for 83bde3a
src/lib.rs
@@ -499,13 +499,12 @@ impl Traits {
499
500
/// Internal derive function for handling errors.
501
fn derive_where_internal(attr: TokenStream, item: TokenStream) -> Result<TokenStream> {
502
- // The item needs to be added, as it is consumed by the derive.
503
- let mut output = quote! { #item };
504
-
505
- // Parse derive macro.
506
let derive_where: DeriveWhere = syn::parse2(attr)?;
507
508
- // Parse item.
+ // The item needs to be added, as it is consumed by the derive. Parsing
+ // consumes `item` so we do it beforehand to avoid cloning.
+ let mut output = quote! { #item };
+
509
let DeriveInput {
510
ident,
511
generics,
0 commit comments