File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -355,7 +355,7 @@ impl<T: TransparentPtrType> List<T> {
355
355
unsafe {
356
356
let mut ptr = head. as_ptr ( ) ;
357
357
while !ptr. is_null ( ) {
358
- let item = & * ( ( * ptr) . data as * const ffi:: gpointer as * const T ) ;
358
+ let item = & * ( & ( * ptr) . data as * const ffi:: gpointer as * const T ) ;
359
359
let next = ( * ptr) . next ;
360
360
if !f ( item) {
361
361
ptr:: drop_in_place ( & mut ( * ptr) . data as * mut ffi:: gpointer as * mut T ) ;
@@ -909,6 +909,12 @@ mod test {
909
909
let mut list_items = list2. iter ( ) . cloned ( ) . collect :: < Vec < _ > > ( ) ;
910
910
list_items. reverse ( ) ;
911
911
assert_eq ! ( & items[ 1 ..] , & list_items) ;
912
+
913
+ list. reverse ( ) ;
914
+ let mut list3 = list. clone ( ) ;
915
+ list3. retain ( |item| item. seconds ( ) >= 14.0 ) ;
916
+ let list_items = list3. iter ( ) . cloned ( ) . collect :: < Vec < _ > > ( ) ;
917
+ assert_eq ! ( & items[ 2 ..] , & list_items) ;
912
918
}
913
919
914
920
#[ test]
Original file line number Diff line number Diff line change @@ -350,7 +350,7 @@ impl<T: TransparentPtrType> SList<T> {
350
350
unsafe {
351
351
let mut ptr = head. as_ptr ( ) ;
352
352
while !ptr. is_null ( ) {
353
- let item = & * ( ( * ptr) . data as * const ffi:: gpointer as * const T ) ;
353
+ let item = & * ( & ( * ptr) . data as * const ffi:: gpointer as * const T ) ;
354
354
let next = ( * ptr) . next ;
355
355
if !f ( item) {
356
356
ptr:: drop_in_place ( & mut ( * ptr) . data as * mut ffi:: gpointer as * mut T ) ;
@@ -902,6 +902,12 @@ mod test {
902
902
let mut list_items = list2. iter ( ) . cloned ( ) . collect :: < Vec < _ > > ( ) ;
903
903
list_items. reverse ( ) ;
904
904
assert_eq ! ( & items[ 1 ..] , & list_items) ;
905
+
906
+ list. reverse ( ) ;
907
+ let mut list3 = list. clone ( ) ;
908
+ list3. retain ( |item| item. seconds ( ) >= 14.0 ) ;
909
+ let list_items = list3. iter ( ) . cloned ( ) . collect :: < Vec < _ > > ( ) ;
910
+ assert_eq ! ( & items[ 2 ..] , & list_items) ;
905
911
}
906
912
907
913
#[ test]
You can’t perform that action at this time.
0 commit comments