File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -1713,6 +1713,15 @@ pub struct IntoIter<T> {
17131713 end : * const T ,
17141714}
17151715
1716+ #[ stable( feature = "vec_intoiter_debug" , since = "" ) ]
1717+ impl < T : fmt:: Debug > fmt:: Debug for IntoIter < T > {
1718+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
1719+ f. debug_tuple ( "IntoIter" )
1720+ . field ( & self . as_slice ( ) )
1721+ . finish ( )
1722+ }
1723+ }
1724+
17161725impl < T > IntoIter < T > {
17171726 /// Returns the remaining items of this iterator as a slice.
17181727 ///
Original file line number Diff line number Diff line change @@ -501,6 +501,14 @@ fn test_into_iter_as_mut_slice() {
501501 assert_eq ! ( into_iter. as_slice( ) , & [ 'y' , 'c' ] ) ;
502502}
503503
504+ #[ test]
505+ fn test_into_iter_debug ( ) {
506+ let vec = vec ! [ 'a' , 'b' , 'c' ] ;
507+ let into_iter = vec. into_iter ( ) ;
508+ let debug = format ! ( "{:?}" , into_iter) ;
509+ assert_eq ! ( debug, "IntoIter(['a', 'b', 'c'])" ) ;
510+ }
511+
504512#[ test]
505513fn test_into_iter_count ( ) {
506514 assert_eq ! ( vec![ 1 , 2 , 3 ] . into_iter( ) . count( ) , 3 ) ;
You can’t perform that action at this time.
0 commit comments