Browse Source

anagram pattern is normalized

boyska 4 years ago
parent
commit
3184fc4ccf
1 changed files with 1 additions and 3 deletions
  1. 1 3
      src/main.rs

+ 1 - 3
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<String, impl std::error::Error> {
     // funzione ausiliaria, utile per la is_anagram e cose simili
     // ritorna una COPIA
@@ -77,7 +75,7 @@ fn sort_word(word: &str) -> Result<String, impl std::error::Error> {
 
 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()
     }