From 49c2b1dbb730b484bd6ef47de784d36da2026db2 Mon Sep 17 00:00:00 2001 From: Folkert Date: Sat, 18 Nov 2023 22:46:40 +0100 Subject: [PATCH] redundant closure call --- crates/compiler/types/src/types.rs | 10 +++++++--- crates/wasm_module/src/sections.rs | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/crates/compiler/types/src/types.rs b/crates/compiler/types/src/types.rs index e7fc675b25..6310d9c628 100644 --- a/crates/compiler/types/src/types.rs +++ b/crates/compiler/types/src/types.rs @@ -1300,17 +1300,21 @@ mod debug_types { Arg, } + fn always_true() -> bool { + true + } + macro_rules! maybe_paren { ($paren_if_above:expr, $my_prec:expr, $doc:expr) => { - maybe_paren!($paren_if_above, $my_prec, || true, $doc) + maybe_paren!($paren_if_above, $my_prec, always_true, $doc) }; - ($paren_if_above:expr, $my_prec:expr, $extra_cond:expr, $doc:expr) => { + ($paren_if_above:expr, $my_prec:expr, $extra_cond:expr, $doc:expr) => {{ if $my_prec > $paren_if_above && $extra_cond() { $doc.parens().group() } else { $doc } - }; + }}; } fn typ<'a>( diff --git a/crates/wasm_module/src/sections.rs b/crates/wasm_module/src/sections.rs index 99ef4db60c..224bb3b956 100644 --- a/crates/wasm_module/src/sections.rs +++ b/crates/wasm_module/src/sections.rs @@ -90,6 +90,7 @@ macro_rules! section_impl { let mut bytes = Vec::::with_capacity_in(range.len() * 2, arena); *cursor = range.end; bytes.extend_from_slice(&module_bytes[range]); + #[allow(clippy::redundant_closure_call)] Ok($from_count_and_bytes(count, bytes)) } }