Skip to content

Commit

Permalink
cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Dherse committed Jun 7, 2024
1 parent c764edf commit 683de0d
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions macros/src/memoize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,19 +146,20 @@ fn process(function: &Function) -> Result<TokenStream> {

let param_redefinitions = function.args.iter().filter_map(|arg| match arg {
Argument::Receiver(_) => None,
Argument::Ident(_, mutability, ident) => Some(quote! { let #mutability #ident = #ident; }),
Argument::Ident(_, mutability, ident) => {
Some(quote! { let #mutability #ident = #ident; })
}
});

// Bypass for disabled memoization.
let bypass = function
.enabled
.as_ref()
.map(|enabled| quote! {
let bypass = function.enabled.as_ref().map(|enabled| {
quote! {
if !(#enabled) {
#(#param_redefinitions)*
return #body;
}
});
}
});

wrapped.block = parse_quote! { {
static __CACHE: ::comemo::internal::Cache<
Expand Down

0 comments on commit 683de0d

Please sign in to comment.