From 381edab97959041178fe12f434d7a428c175c623 Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Tue, 18 Oct 2016 17:56:09 +0200 Subject: [PATCH] Remove unnecessary hack --- macros/match_token.rs | 35 ++++++++++++++++------------------- src/tree_builder/mod.rs | 5 ----- 2 files changed, 16 insertions(+), 24 deletions(-) diff --git a/macros/match_token.rs b/macros/match_token.rs index 0d8e7e91..9213fbcc 100644 --- a/macros/match_token.rs +++ b/macros/match_token.rs @@ -441,25 +441,22 @@ fn expand_match_token_macro(to_be_matched: syn::Ident, mut arms: Vec) -> To }; quote! { - // Use a no-op macro to work around a bug(?) in syn::parse_exr. - as_expr! { - match #to_be_matched { - #( - #arms_code - )* - last_arm_token => { - let enable_wildcards = match last_arm_token { - #( - #wild_excluded_patterns => false, - )* - _ => true, - }; - match (enable_wildcards, last_arm_token) { - #( - (true, #wildcards_patterns) => #wildcards_expressions - )* - (_, #last_pat) => #last_expr - } + match #to_be_matched { + #( + #arms_code + )* + last_arm_token => { + let enable_wildcards = match last_arm_token { + #( + #wild_excluded_patterns => false, + )* + _ => true, + }; + match (enable_wildcards, last_arm_token) { + #( + (true, #wildcards_patterns) => #wildcards_expressions + )* + (_, #last_pat) => #last_expr } } } diff --git a/src/tree_builder/mod.rs b/src/tree_builder/mod.rs index 2df4ce90..469a61ca 100644 --- a/src/tree_builder/mod.rs +++ b/src/tree_builder/mod.rs @@ -40,11 +40,6 @@ mod data; mod types; mod actions; -/// This macro is used in macros/match_token.rs to work around a bug(?) in syn::parse_exr. -macro_rules! as_expr { - ($e: expr) => ($e) -} - mod rules { //! The tree builder rules, as a single, enormous nested match expression.