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> {
355355 unsafe {
356356 let mut ptr = head. as_ptr ( ) ;
357357 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 ) ;
359359 let next = ( * ptr) . next ;
360360 if !f ( item) {
361361 ptr:: drop_in_place ( & mut ( * ptr) . data as * mut ffi:: gpointer as * mut T ) ;
@@ -909,6 +909,12 @@ mod test {
909909 let mut list_items = list2. iter ( ) . cloned ( ) . collect :: < Vec < _ > > ( ) ;
910910 list_items. reverse ( ) ;
911911 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) ;
912918 }
913919
914920 #[ test]
Original file line number Diff line number Diff line change @@ -350,7 +350,7 @@ impl<T: TransparentPtrType> SList<T> {
350350 unsafe {
351351 let mut ptr = head. as_ptr ( ) ;
352352 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 ) ;
354354 let next = ( * ptr) . next ;
355355 if !f ( item) {
356356 ptr:: drop_in_place ( & mut ( * ptr) . data as * mut ffi:: gpointer as * mut T ) ;
@@ -902,6 +902,12 @@ mod test {
902902 let mut list_items = list2. iter ( ) . cloned ( ) . collect :: < Vec < _ > > ( ) ;
903903 list_items. reverse ( ) ;
904904 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) ;
905911 }
906912
907913 #[ test]
You can’t perform that action at this time.
0 commit comments