Skip to content

Commit 83bde3a

Browse files
committed
Some code shuffling
1 parent 710d03a commit 83bde3a

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/lib.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -499,13 +499,12 @@ impl Traits {
499499

500500
/// Internal derive function for handling errors.
501501
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.
506502
let derive_where: DeriveWhere = syn::parse2(attr)?;
507503

508-
// Parse item.
504+
// The item needs to be added, as it is consumed by the derive. Parsing
505+
// consumes `item` so we do it beforehand to avoid cloning.
506+
let mut output = quote! { #item };
507+
509508
let DeriveInput {
510509
ident,
511510
generics,

0 commit comments

Comments
 (0)