From 3184fc4ccfe6308074e00de4fc942b47409ad941 Mon Sep 17 00:00:00 2001 From: boyska Date: Tue, 19 May 2020 00:08:51 +0200 Subject: [PATCH] anagram pattern is normalized --- src/main.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index 25e3bd1..01137d8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -64,8 +64,6 @@ fn matches_regexp(regexp: &str) -> (impl std::ops::FnMut(&&String) -> bool) { move |w| re.is_match(w.as_str()) } - - fn sort_word(word: &str) -> Result { // funzione ausiliaria, utile per la is_anagram e cose simili // ritorna una COPIA @@ -77,7 +75,7 @@ fn sort_word(word: &str) -> Result { fn is_anagram(word: &str) -> (impl std::ops::FnMut(&&String) -> bool) { // filtro - let sorted_word = sort_word(word).unwrap(); + let sorted_word = sort_word(line_to_word(word.to_string()).as_str()).unwrap(); move |w| { sorted_word == sort_word(w.as_str()).unwrap() }