From 079093996c718017986d1ed3f69e4fef5797c07b Mon Sep 17 00:00:00 2001 From: Lewin Bormann Date: Sat, 23 Dec 2023 15:43:15 +0100 Subject: [PATCH] Suppress warning about unused mut in memoizer function Workaround for issue #32 --- examples/issue32.rs | 11 +++++++++++ inner/src/lib.rs | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 examples/issue32.rs diff --git a/examples/issue32.rs b/examples/issue32.rs new file mode 100644 index 0000000..ba34a47 --- /dev/null +++ b/examples/issue32.rs @@ -0,0 +1,11 @@ +use memoize::memoize; + +#[memoize] +fn expensive(mut foo: i32) -> i32 { + foo += 1; + foo +} + +fn main() { + expensive(7); +} diff --git a/inner/src/lib.rs b/inner/src/lib.rs index c7d708b..1ce5efe 100644 --- a/inner/src/lib.rs +++ b/inner/src/lib.rs @@ -435,7 +435,7 @@ pub fn memoize(attr: TokenStream, item: TokenStream) -> TokenStream { #flusher #store - #[allow(unused_variables)] + #[allow(unused_variables, unused_mut)] #vis #sig { #memoizer }