From 845fd7304029829c9a792bbb193683b36b574241 Mon Sep 17 00:00:00 2001 From: "Christoph J. Scherr" Date: Wed, 31 Jul 2024 11:00:45 +0200 Subject: [PATCH] fix(naive): improve found character indexing #2 --- src/solve/naive/mod.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/solve/naive/mod.rs b/src/solve/naive/mod.rs index 669e751..5548615 100644 --- a/src/solve/naive/mod.rs +++ b/src/solve/naive/mod.rs @@ -72,13 +72,10 @@ impl<'wl, WL: WordList> Solver<'wl, WL> for NaiveSolver<'wl, WL> { already_tried.push((*spot, *other.0)); } - if p.0 - .char_indices() - .filter(|ci| ci.1 == *other.0 && !already_tried.contains(ci)) - .count() - < 1 - { - return false; + for c in p.0.char_indices() { + if c.1 == *other.0 && other.1.contains(&c.0) { + return false; + } } } else { return false;