Skip to content

Commit 5fe36fb

Browse files
committed
Refactor anagram solution
1 parent 9632b4a commit 5fe36fb

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

anagram/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
use std::collections::HashSet;
22

33
pub fn anagrams_for<'a>(word: &str, possible_anagrams: &'a [&str]) -> HashSet<&'a str> {
4-
let anagrams = possible_anagrams.to_vec();
5-
anagrams
4+
possible_anagrams
65
.iter()
76
.cloned()
87
.filter(|&anagram| anagram.to_lowercase() != word.to_lowercase() && compare(anagram, word))

0 commit comments

Comments
 (0)