Skip to content

Commit 15d7e00

Browse files
committed
Touch up PR 227
1 parent f0f9309 commit 15d7e00

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/expand.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -362,11 +362,11 @@ fn transform_block(context: Context, sig: &mut Signature, block: &mut Block) {
362362
quote!(let #mutability #ident = #self_token;)
363363
}
364364
FnArg::Typed(arg) => {
365-
// If there is a `#[cfg(..)]` attribute that selectively
366-
// enables the parameter, forward it to the variable.
365+
// If there is a #[cfg(...)] attribute that selectively enables
366+
// the parameter, forward it to the variable.
367367
//
368-
// This is currently not applied to the `self` parameter
369-
let attrs = arg.attrs.iter();
368+
// This is currently not applied to the `self` parameter.
369+
let attrs = arg.attrs.iter().filter(|attr| attr.path.is_ident("cfg"));
370370

371371
if let Pat::Ident(PatIdent {
372372
ident, mutability, ..
@@ -377,24 +377,24 @@ fn transform_block(context: Context, sig: &mut Signature, block: &mut Block) {
377377
let prefixed = Ident::new("__self", ident.span());
378378
quote!(let #mutability #prefixed = #ident;)
379379
} else {
380-
quote!(
380+
quote! {
381381
#(#attrs)*
382382
let #mutability #ident = #ident;
383-
)
383+
}
384384
}
385385
} else {
386386
let pat = &arg.pat;
387387
let ident = positional_arg(i, pat);
388388
if let Pat::Wild(_) = **pat {
389-
quote!(
389+
quote! {
390390
#(#attrs)*
391391
let #ident = #ident;
392-
)
392+
}
393393
} else {
394-
quote!(
394+
quote! {
395395
#(#attrs)*
396396
let #pat = #ident;
397-
)
397+
}
398398
}
399399
}
400400
}

0 commit comments

Comments
 (0)