@@ -15,45 +15,51 @@ use super::DeterministicRng;
1515
1616#[ test]
1717fn test_clone_eq ( ) {
18- let mut m = BTreeSet :: new ( ) ;
18+ let mut m = BTreeSet :: new ( ) ;
1919
20- m. insert ( 1 ) ;
21- m. insert ( 2 ) ;
20+ m. insert ( 1 ) ;
21+ m. insert ( 2 ) ;
2222
23- assert ! ( m. clone( ) == m) ;
23+ assert ! ( m. clone( ) == m) ;
2424}
2525
2626#[ test]
2727fn test_hash ( ) {
28- let mut x = BTreeSet :: new ( ) ;
29- let mut y = BTreeSet :: new ( ) ;
28+ let mut x = BTreeSet :: new ( ) ;
29+ let mut y = BTreeSet :: new ( ) ;
3030
31- x. insert ( 1 ) ;
32- x. insert ( 2 ) ;
33- x. insert ( 3 ) ;
31+ x. insert ( 1 ) ;
32+ x. insert ( 2 ) ;
33+ x. insert ( 3 ) ;
3434
35- y. insert ( 3 ) ;
36- y. insert ( 2 ) ;
37- y. insert ( 1 ) ;
35+ y. insert ( 3 ) ;
36+ y. insert ( 2 ) ;
37+ y. insert ( 1 ) ;
3838
39- assert ! ( :: hash( & x) == :: hash( & y) ) ;
39+ assert ! ( :: hash( & x) == :: hash( & y) ) ;
4040}
4141
42- fn check < F > ( a : & [ i32 ] , b : & [ i32 ] , expected : & [ i32 ] , f : F ) where
43- F : FnOnce ( & BTreeSet < i32 > , & BTreeSet < i32 > , & mut FnMut ( & i32 ) -> bool ) -> bool ,
42+ fn check < F > ( a : & [ i32 ] , b : & [ i32 ] , expected : & [ i32 ] , f : F )
43+ where F : FnOnce ( & BTreeSet < i32 > , & BTreeSet < i32 > , & mut FnMut ( & i32 ) -> bool ) -> bool
4444{
4545 let mut set_a = BTreeSet :: new ( ) ;
4646 let mut set_b = BTreeSet :: new ( ) ;
4747
48- for x in a { assert ! ( set_a. insert( * x) ) }
49- for y in b { assert ! ( set_b. insert( * y) ) }
48+ for x in a {
49+ assert ! ( set_a. insert( * x) )
50+ }
51+ for y in b {
52+ assert ! ( set_b. insert( * y) )
53+ }
5054
5155 let mut i = 0 ;
52- f ( & set_a, & set_b, & mut |& x| {
53- assert_eq ! ( x, expected[ i] ) ;
54- i += 1 ;
55- true
56- } ) ;
56+ f ( & set_a,
57+ & set_b,
58+ & mut |& x| {
59+ assert_eq ! ( x, expected[ i] ) ;
60+ i += 1 ;
61+ true
62+ } ) ;
5763 assert_eq ! ( i, expected. len( ) ) ;
5864}
5965
@@ -82,9 +88,7 @@ fn test_difference() {
8288 check_difference ( & [ ] , & [ ] , & [ ] ) ;
8389 check_difference ( & [ 1 , 12 ] , & [ ] , & [ 1 , 12 ] ) ;
8490 check_difference ( & [ ] , & [ 1 , 2 , 3 , 9 ] , & [ ] ) ;
85- check_difference ( & [ 1 , 3 , 5 , 9 , 11 ] ,
86- & [ 3 , 9 ] ,
87- & [ 1 , 5 , 11 ] ) ;
91+ check_difference ( & [ 1 , 3 , 5 , 9 , 11 ] , & [ 3 , 9 ] , & [ 1 , 5 , 11 ] ) ;
8892 check_difference ( & [ -5 , 11 , 22 , 33 , 40 , 42 ] ,
8993 & [ -12 , -5 , 14 , 23 , 34 , 38 , 39 , 50 ] ,
9094 & [ 11 , 22 , 33 , 40 , 42 ] ) ;
@@ -245,10 +249,18 @@ fn test_recovery() {
245249fn test_variance ( ) {
246250 use std:: collections:: btree_set:: { IntoIter , Iter , Range } ;
247251
248- fn set < ' new > ( v : BTreeSet < & ' static str > ) -> BTreeSet < & ' new str > { v }
249- fn iter < ' a , ' new > ( v : Iter < ' a , & ' static str > ) -> Iter < ' a , & ' new str > { v }
250- fn into_iter < ' new > ( v : IntoIter < & ' static str > ) -> IntoIter < & ' new str > { v }
251- fn range < ' a , ' new > ( v : Range < ' a , & ' static str > ) -> Range < ' a , & ' new str > { v }
252+ fn set < ' new > ( v : BTreeSet < & ' static str > ) -> BTreeSet < & ' new str > {
253+ v
254+ }
255+ fn iter < ' a , ' new > ( v : Iter < ' a , & ' static str > ) -> Iter < ' a , & ' new str > {
256+ v
257+ }
258+ fn into_iter < ' new > ( v : IntoIter < & ' static str > ) -> IntoIter < & ' new str > {
259+ v
260+ }
261+ fn range < ' a , ' new > ( v : Range < ' a , & ' static str > ) -> Range < ' a , & ' new str > {
262+ v
263+ }
252264}
253265
254266#[ test]
@@ -277,9 +289,7 @@ fn test_append() {
277289
278290fn rand_data ( len : usize ) -> Vec < u32 > {
279291 let mut rng = DeterministicRng :: new ( ) ;
280- Vec :: from_iter (
281- ( 0 ..len) . map ( |_| rng. next ( ) )
282- )
292+ Vec :: from_iter ( ( 0 ..len) . map ( |_| rng. next ( ) ) )
283293}
284294
285295#[ test]
0 commit comments