@@ -129,10 +129,7 @@ impl ChessMove {
129129
130130 let error = Error :: InvalidSanMove ;
131131 let mut cur_index: usize = 0 ;
132- let moving_piece = match move_text
133- . get ( cur_index..( cur_index + 1 ) )
134- . ok_or ( error. clone ( ) ) ?
135- {
132+ let moving_piece = match move_text. get ( cur_index..=cur_index) . ok_or ( error. clone ( ) ) ? {
136133 "N" => {
137134 cur_index += 1 ;
138135 Piece :: Knight
@@ -156,10 +153,7 @@ impl ChessMove {
156153 _ => Piece :: Pawn ,
157154 } ;
158155
159- let mut source_file = match move_text
160- . get ( cur_index..( cur_index + 1 ) )
161- . ok_or ( error. clone ( ) ) ?
162- {
156+ let mut source_file = match move_text. get ( cur_index..=cur_index) . ok_or ( error. clone ( ) ) ? {
163157 "a" => {
164158 cur_index += 1 ;
165159 Some ( File :: A )
@@ -195,10 +189,7 @@ impl ChessMove {
195189 _ => None ,
196190 } ;
197191
198- let mut source_rank = match move_text
199- . get ( cur_index..( cur_index + 1 ) )
200- . ok_or ( error. clone ( ) ) ?
201- {
192+ let mut source_rank = match move_text. get ( cur_index..=cur_index) . ok_or ( error. clone ( ) ) ? {
202193 "1" => {
203194 cur_index += 1 ;
204195 Some ( Rank :: First )
@@ -234,7 +225,7 @@ impl ChessMove {
234225 _ => None ,
235226 } ;
236227
237- let takes = if let Some ( s) = move_text. get ( cur_index..( cur_index + 1 ) ) {
228+ let takes = if let Some ( s) = move_text. get ( cur_index..= cur_index) {
238229 match s {
239230 "x" => {
240231 cur_index += 1 ;
@@ -269,7 +260,7 @@ impl ChessMove {
269260 sq
270261 } ;
271262
272- let promotion = if let Some ( s) = move_text. get ( cur_index..( cur_index + 1 ) ) {
263+ let promotion = if let Some ( s) = move_text. get ( cur_index..= cur_index) {
273264 match s {
274265 "N" => {
275266 cur_index += 1 ;
@@ -293,7 +284,7 @@ impl ChessMove {
293284 None
294285 } ;
295286
296- if let Some ( s) = move_text. get ( cur_index..( cur_index + 1 ) ) {
287+ if let Some ( s) = move_text. get ( cur_index..= cur_index) {
297288 let _maybe_check_or_mate = match s {
298289 "+" => {
299290 cur_index += 1 ;
0 commit comments