From c6aa39d9ad9c679e3e34fd561899786ba37e4a69 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Fri, 2 Apr 2021 17:56:08 +0100 Subject: [PATCH] if_let: Let variants be paths Signed-off-by: Ian Jackson --- base/misc.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/base/misc.rs b/base/misc.rs index 26a7ca67..7ee1c6f5 100644 --- a/base/misc.rs +++ b/base/misc.rs @@ -67,12 +67,12 @@ pub fn space_rect_attrs(table_size: PosC) -> SvgAttrs { #[macro_export] macro_rules! if_let { - { $variant:ident($binding:pat) = $input:expr; + { $($variant:ident)::+ ($binding:pat) = $input:expr; else $($otherwise:tt)* } => { let $binding = match $input { - $variant(y) => y, + $($variant)::+ (y) => y, _ => { $($otherwise)* }, }; - } + }; } -- 2.30.2