iCodeSometime / candidate

Found single-character string literal pattern RS-P1100
Performance
Major
a year agoa year old
Using single-character literal as pattern in ends_with, use a char instead
 5// note: checking the side didn't seem to make a difference in the benchmarks
 6fn game_playthrough_test(pgn: &str) -> Game {
 7    let mut game = Game::new();
 8    let moves = pgn.split_whitespace().filter(|s| !s.ends_with(".")); 9
10    for m in moves {
11        let mv = ChessMove::from_san(&game.current_position(), m).unwrap();
Using single-character literal as pattern in ends_with, use a char instead
33    boards.push(Board::default());
34
35    pgn.split_whitespace()
36        .filter(|s| !s.ends_with("."))37        .fold(Game::new(), |mut g, m| {
38            g.make_move(ChessMove::from_san(&g.current_position(), m).expect("Valid SAN Move"));
39            boards.push(g.current_position());