@@ -968,11 +968,11 @@ fn each_split_within<'a, F>(ss: &'a str, lim: usize, mut it: F)
968968 lim = fake_i;
969969 }
970970
971- let mut machine = |cont : & mut bool , ( i, c) : ( usize , char ) | {
971+ let mut machine = |cont : & mut bool , state : & mut SplitWithinState , ( i, c) : ( usize , char ) | {
972972 let whitespace = if c. is_whitespace ( ) { Ws } else { Cr } ;
973973 let limit = if ( i - slice_start + 1 ) <= lim { UnderLim } else { OverLim } ;
974974
975- state = match ( state, whitespace, limit) {
975+ * state = match ( * state, whitespace, limit) {
976976 ( A , Ws , _) => { A }
977977 ( A , Cr , _) => { slice_start = i; last_start = i; B }
978978
@@ -1020,11 +1020,11 @@ fn each_split_within<'a, F>(ss: &'a str, lim: usize, mut it: F)
10201020 * cont
10211021 } ;
10221022
1023- ss. char_indices ( ) . all ( |x| machine ( & mut cont, x) ) ;
1023+ ss. char_indices ( ) . all ( |x| machine ( & mut cont, & mut state , x) ) ;
10241024
10251025 // Let the automaton 'run out' by supplying trailing whitespace
10261026 while cont && match state { B | C => true , A => false } {
1027- machine ( & mut cont, ( fake_i, ' ' ) ) ;
1027+ machine ( & mut cont, & mut state , ( fake_i, ' ' ) ) ;
10281028 fake_i += 1 ;
10291029 }
10301030 return cont;
0 commit comments