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.
This commit is contained in:
Filipe Rodrigues 2025-01-30 01:50:14 +00:00
parent 910dbedb59
commit 9085213e94
Signed by: zenithsiz
SSH Key Fingerprint: SHA256:Mb5ppb3Sh7IarBO/sBTXLHbYEOz37hJAlslLQPPAPaU

View File

@ -103,16 +103,6 @@ impl<K> ExprTree<K> {
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<K> ExprTree<K> {
},
// Otherwise, we match if the value is empty
_ => match value.is_empty() {
None => match value.is_empty() {
true => BTreeMap::new(),
false => return None,
},