Skip to content

Commit 3360d6f

Browse files
authored
fix: fix clippy in string/trie.rs (TheAlgorithms#432)
1 parent 72d1d42 commit 3360d6f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/string/autocomplete_using_trie.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,24 +40,24 @@ impl Trie {
4040
}
4141
}
4242

43-
self._elements(trie)
43+
Self::_elements(trie)
4444
.iter()
4545
.map(|s| prefix.clone() + s)
4646
.collect()
4747
}
4848

49-
fn _elements(&self, map: &Trie) -> Vec<String> {
49+
fn _elements(map: &Trie) -> Vec<String> {
5050
let mut results = vec![];
5151

5252
for (c, v) in map.0.iter() {
5353
let mut sub_result = vec![];
5454
if c == &END {
5555
sub_result.push("".to_owned())
5656
} else {
57-
for s in self._elements(v) {
58-
let res_string = c.to_string() + &s;
59-
sub_result.push(res_string);
60-
}
57+
Self::_elements(v)
58+
.iter()
59+
.map(|s| sub_result.push(c.to_string() + s))
60+
.collect()
6161
}
6262

6363
results.extend(sub_result)

0 commit comments

Comments
 (0)