@@ -866,45 +866,46 @@ fn addition_no_spaces_e_number() {
866866fn take_while_ascii_pred_simple ( ) {
867867let mut cur =Cursor :: from ( & b"abcdefghijk" [ ..] ) ;
868868
869- let mut buf: Vec < u8 > = Vec :: new ( ) ;
869+ let mut buf: [ u8 ; 8 ] = [ 0 ; 8 ] ;
870870
871- cur. take_while_ascii_pred ( & mut buf, & |c| c =='a' || c =='b' || c =='c' )
871+ let slice = cur
872+ . take_while_ascii_pred ( & mut buf, & |c| c =='a' || c =='b' || c =='c' )
872873. unwrap ( ) ;
873874
874- assert_eq ! ( str :: from_utf8( buf . as_slice ( ) ) . unwrap( ) , "abc" ) ;
875+ assert_eq ! ( str :: from_utf8( slice ) . unwrap( ) , "abc" ) ;
875876}
876877
877878#[ test]
878879fn take_while_ascii_pred_immediate_stop ( ) {
879880let mut cur =Cursor :: from ( & b"abcdefghijk" [ ..] ) ;
880881
881- let mut buf: Vec < u8 > = Vec :: new ( ) ;
882+ let mut buf: [ u8 ; 8 ] = [ 0 ; 8 ] ;
882883
883- cur. take_while_ascii_pred ( & mut buf, & |_|false ) . unwrap ( ) ;
884+ let slice = cur. take_while_ascii_pred ( & mut buf, & |_|false ) . unwrap ( ) ;
884885
885- assert_eq ! ( str :: from_utf8( buf . as_slice ( ) ) . unwrap( ) , "" ) ;
886+ assert_eq ! ( str :: from_utf8( slice ) . unwrap( ) , "" ) ;
886887}
887888
888889#[ test]
889890fn take_while_ascii_pred_entire_str ( ) {
890891let mut cur =Cursor :: from ( & b"abcdefghijk" [ ..] ) ;
891892
892- let mut buf: Vec < u8 > = Vec :: new ( ) ;
893+ let mut buf: [ u8 ; 11 ] = [ 0 ; 11 ] ;
893894
894- cur. take_while_ascii_pred ( & mut buf, & |_|true ) . unwrap ( ) ;
895+ let slice = cur. take_while_ascii_pred ( & mut buf, & |_|true ) . unwrap ( ) ;
895896
896- assert_eq ! ( str :: from_utf8( buf . as_slice ( ) ) . unwrap( ) , "abcdefghijk" ) ;
897+ assert_eq ! ( str :: from_utf8( slice ) . unwrap( ) , "abcdefghijk" ) ;
897898}
898899
899900#[ test]
900901fn take_while_ascii_pred_non_ascii_stop ( ) {
901902let mut cur =Cursor :: from ( "abcde😀fghijk" . as_bytes ( ) ) ;
902903
903- let mut buf: Vec < u8 > = Vec :: new ( ) ;
904+ let mut buf: [ u8 ; 12 ] = [ 0 ; 12 ] ;
904905
905- cur. take_while_ascii_pred ( & mut buf, & |_|true ) . unwrap ( ) ;
906+ let slice = cur. take_while_ascii_pred ( & mut buf, & |_|true ) . unwrap ( ) ;
906907
907- assert_eq ! ( str :: from_utf8( buf . as_slice ( ) ) . unwrap( ) , "abcde" ) ;
908+ assert_eq ! ( str :: from_utf8( slice ) . unwrap( ) , "abcde" ) ;
908909}
909910
910911#[ test]