@@ -836,11 +836,6 @@ fn owned_array_discontiguous_drop() {
836
836
use :: std:: collections:: BTreeSet ;
837
837
838
838
struct InsertOnDrop < T : Ord > ( Rc < RefCell < BTreeSet < T > > > , Option < T > ) ;
839
- impl < T : Ord > InsertOnDrop < T > {
840
- fn new ( set : Rc < RefCell < BTreeSet < T > > > , value : T ) -> Self {
841
- InsertOnDrop ( set, Some ( value) )
842
- }
843
- }
844
839
impl < T : Ord > Drop for InsertOnDrop < T > {
845
840
fn drop ( & mut self ) {
846
841
let InsertOnDrop ( ref set, ref mut value) = * self ;
@@ -850,12 +845,12 @@ fn owned_array_discontiguous_drop() {
850
845
851
846
let set = Rc :: new ( RefCell :: new ( BTreeSet :: new ( ) ) ) ;
852
847
{
853
- let v: Vec < _ > = ( 0 ..12 ) . map ( |x| InsertOnDrop :: new ( set. clone ( ) , x ) ) . collect ( ) ;
848
+ let v: Vec < _ > = ( 0 ..12 ) . map ( |x| InsertOnDrop ( set. clone ( ) , Some ( x ) ) ) . collect ( ) ;
854
849
let mut a = Array :: from_shape_vec ( ( 2 , 6 ) , v) . unwrap ( ) ;
855
850
// discontiguous and non-zero offset
856
851
a. slice_inplace ( s ! [ .., 1 ..] ) ;
857
852
}
858
- // each item was dropped
853
+ // each item was dropped exactly once
859
854
itertools:: assert_equal ( set. borrow ( ) . iter ( ) . cloned ( ) , 0 ..12 ) ;
860
855
}
861
856
@@ -1433,8 +1428,7 @@ fn discontiguous_owned_to_owned() {
1433
1428
let co = c. to_owned ( ) ;
1434
1429
assert_eq ! ( c. strides( ) , & [ 3 , 2 ] ) ;
1435
1430
assert_eq ! ( co. strides( ) , & [ 2 , 1 ] ) ;
1436
- assert_eq ! ( c. shape( ) , co. shape( ) ) ;
1437
- itertools:: assert_equal ( c. iter ( ) , co. iter ( ) ) ;
1431
+ assert_eq ! ( c, co) ;
1438
1432
}
1439
1433
1440
1434
#[ test]
0 commit comments