File tree Expand file tree Collapse file tree 2 files changed +3
-4
lines changed
pythagorean-triplet/tests Expand file tree Collapse file tree 2 files changed +3
-4
lines changed Original file line number Diff line number Diff line change 1
1
use std:: collections:: HashSet ;
2
- use std:: iter:: FromIterator ;
3
2
4
3
fn process_anagram_case ( word : & str , inputs : & [ & str ] , expected : & [ & str ] ) {
5
4
let result = anagram:: anagrams_for ( word, inputs) ;
6
5
7
- let expected: HashSet < & str > = HashSet :: from_iter ( expected. iter ( ) . cloned ( ) ) ;
6
+ let expected: HashSet < & str > = expected. iter ( ) . cloned ( ) . collect ( ) ;
8
7
9
8
assert_eq ! ( result, expected) ;
10
9
}
Original file line number Diff line number Diff line change 1
1
use pythagorean_triplet:: find;
2
- use std:: { collections:: HashSet , iter :: FromIterator } ;
2
+ use std:: collections:: HashSet ;
3
3
4
4
fn process_tripletswithsum_case ( sum : u32 , expected : & [ [ u32 ; 3 ] ] ) {
5
5
let triplets = find ( sum) ;
6
6
7
7
if !expected. is_empty ( ) {
8
- let expected = HashSet :: from_iter ( expected. iter ( ) . cloned ( ) ) ;
8
+ let expected: HashSet < _ > = expected. iter ( ) . cloned ( ) . collect ( ) ;
9
9
10
10
assert_eq ! ( expected, triplets) ;
11
11
} else {
You can’t perform that action at this time.
0 commit comments