From 9085213e941819af9c9e4a6cecdc44b24d379bb7 Mon Sep 17 00:00:00 2001 From: Filipe Rodrigues Date: Thu, 30 Jan 2025 01:50:14 +0000 Subject: [PATCH] Removed special casing of fully-matching patterns from `ExprTree::find_match_suffix`. This special casing was absolutely wrong in some scenarios and caused rules to be used that cannot build certain files. --- src/rules/expr/expr_tree.rs | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/rules/expr/expr_tree.rs b/src/rules/expr/expr_tree.rs index e2d8d1d..519f137 100644 --- a/src/rules/expr/expr_tree.rs +++ b/src/rules/expr/expr_tree.rs @@ -103,16 +103,6 @@ impl ExprTree { where K: Clone, { - // Try to match against an empty suffix - // Note: We always do this, since some expressions could be - // of the form `(String, Pat, Empty)`, with `Pat` matching - // the rest. - if let Some((pat, key)) = suffixes.get("") && - let Some(pats) = Self::find_match_pat("", pat.as_ref()) - { - return Some((key.clone(), pats)); - } - // Otherwise, match against all other suffixes for (suffix, (pat, key)) in suffixes { // If the prefix no longer matches, try the next @@ -142,7 +132,7 @@ impl ExprTree { }, // Otherwise, we match if the value is empty - _ => match value.is_empty() { + None => match value.is_empty() { true => BTreeMap::new(), false => return None, },