[INFO] cloning repository https://github.com/default-username-852/schack [INFO] running `Command { std: "git" "-c" "credential.helper=" "-c" "credential.helper=/workspace/cargo-home/bin/git-credential-null" "clone" "--bare" "https://github.com/default-username-852/schack" "/workspace/cache/git-repos/https%3A%2F%2Fgithub.com%2Fdefault-username-852%2Fschack", kill_on_drop: false }` [INFO] [stderr] Cloning into bare repository '/workspace/cache/git-repos/https%3A%2F%2Fgithub.com%2Fdefault-username-852%2Fschack'... [INFO] running `Command { std: "git" "rev-parse" "HEAD", kill_on_drop: false }` [INFO] [stdout] 35689cb2fc3be1519ba1b57010483362ca8b9f4d [INFO] linting default-username-852/schack against nightly for clippy-nonminimal_bool-denied [INFO] running `Command { std: "git" "clone" "/workspace/cache/git-repos/https%3A%2F%2Fgithub.com%2Fdefault-username-852%2Fschack" "/workspace/builds/worker-7-tc1/source", kill_on_drop: false }` [INFO] [stderr] Cloning into '/workspace/builds/worker-7-tc1/source'... [INFO] [stderr] done. [INFO] started tweaking git repo https://github.com/default-username-852/schack [INFO] finished tweaking git repo https://github.com/default-username-852/schack [INFO] tweaked toml for git repo https://github.com/default-username-852/schack written to /workspace/builds/worker-7-tc1/source/Cargo.toml [INFO] validating manifest of git repo https://github.com/default-username-852/schack on toolchain nightly [INFO] running `Command { std: CARGO_HOME="/workspace/cargo-home" RUSTUP_HOME="/workspace/rustup-home" "/workspace/cargo-home/bin/cargo" "+nightly" "metadata" "--manifest-path" "Cargo.toml" "--no-deps", kill_on_drop: false }` [INFO] crate git repo https://github.com/default-username-852/schack already has a lockfile, it will not be regenerated [INFO] running `Command { std: CARGO_HOME="/workspace/cargo-home" RUSTUP_HOME="/workspace/rustup-home" "/workspace/cargo-home/bin/cargo" "+nightly" "fetch" "--manifest-path" "Cargo.toml", kill_on_drop: false }` [INFO] running `Command { std: "docker" "create" "-v" "/var/lib/crater-agent-workspace/builds/worker-7-tc1/target:/opt/rustwide/target:rw,Z" "-v" "/var/lib/crater-agent-workspace/builds/worker-7-tc1/source:/opt/rustwide/workdir:ro,Z" "-v" "/var/lib/crater-agent-workspace/cargo-home:/opt/rustwide/cargo-home:ro,Z" "-v" "/var/lib/crater-agent-workspace/rustup-home:/opt/rustwide/rustup-home:ro,Z" "-e" "SOURCE_DIR=/opt/rustwide/workdir" "-e" "CARGO_TARGET_DIR=/opt/rustwide/target" "-e" "CARGO_HOME=/opt/rustwide/cargo-home" "-e" "RUSTUP_HOME=/opt/rustwide/rustup-home" "-w" "/opt/rustwide/workdir" "-m" "1610612736" "--user" "0:0" "--network" "none" "ghcr.io/rust-lang/crates-build-env/linux@sha256:d429b63d4308055ea97f60fb1d3dfca48854a00942f1bd2ad806beaf015945ec" "/opt/rustwide/cargo-home/bin/cargo" "+nightly" "metadata" "--no-deps" "--format-version=1", kill_on_drop: false }` [INFO] [stdout] 4170b3928048783eb98d6a9589848d3710bd44f1ca0f4094055634ce426e468e [INFO] running `Command { std: "docker" "start" "-a" "4170b3928048783eb98d6a9589848d3710bd44f1ca0f4094055634ce426e468e", kill_on_drop: false }` [INFO] running `Command { std: "docker" "inspect" "4170b3928048783eb98d6a9589848d3710bd44f1ca0f4094055634ce426e468e", kill_on_drop: false }` [INFO] running `Command { std: "docker" "rm" "-f" "4170b3928048783eb98d6a9589848d3710bd44f1ca0f4094055634ce426e468e", kill_on_drop: false }` [INFO] [stdout] 4170b3928048783eb98d6a9589848d3710bd44f1ca0f4094055634ce426e468e [INFO] running `Command { std: "docker" "create" "-v" "/var/lib/crater-agent-workspace/builds/worker-7-tc1/target:/opt/rustwide/target:rw,Z" "-v" "/var/lib/crater-agent-workspace/builds/worker-7-tc1/source:/opt/rustwide/workdir:ro,Z" "-v" "/var/lib/crater-agent-workspace/cargo-home:/opt/rustwide/cargo-home:ro,Z" "-v" "/var/lib/crater-agent-workspace/rustup-home:/opt/rustwide/rustup-home:ro,Z" "-e" "SOURCE_DIR=/opt/rustwide/workdir" "-e" "CARGO_TARGET_DIR=/opt/rustwide/target" "-e" "CARGO_INCREMENTAL=0" "-e" "RUST_BACKTRACE=full" "-e" "RUSTFLAGS=--cap-lints=forbid" "-e" "RUSTDOCFLAGS=--cap-lints=forbid" "-e" "CARGO_HOME=/opt/rustwide/cargo-home" "-e" "RUSTUP_HOME=/opt/rustwide/rustup-home" "-w" "/opt/rustwide/workdir" "-m" "1610612736" "--user" "0:0" "--network" "none" "ghcr.io/rust-lang/crates-build-env/linux@sha256:d429b63d4308055ea97f60fb1d3dfca48854a00942f1bd2ad806beaf015945ec" "/opt/rustwide/cargo-home/bin/cargo" "+nightly" "clippy" "--frozen" "--all" "--all-targets" "--message-format=json", kill_on_drop: false }` [INFO] [stdout] 9afb728af1a8103fdf74a0fe6885fd699d1f2b23968cde179d505612489cf9f2 [INFO] running `Command { std: "docker" "start" "-a" "9afb728af1a8103fdf74a0fe6885fd699d1f2b23968cde179d505612489cf9f2", kill_on_drop: false }` [INFO] [stderr] Checking schackmotor v0.1.0 (/opt/rustwide/workdir) [INFO] [stdout] warning: unnecessary parentheses around block return value [INFO] [stdout] --> src/lib.rs:455:9 [INFO] [stdout] | [INFO] [stdout] 455 | (1 <= self.y && self.y <= 8 && 1 <= self.x && self.x <= 8) [INFO] [stdout] | ^ ^ [INFO] [stdout] | [INFO] [stdout] = note: `#[warn(unused_parens)]` (part of `#[warn(unused)]`) on by default [INFO] [stdout] help: remove these parentheses [INFO] [stdout] | [INFO] [stdout] 455 - (1 <= self.y && self.y <= 8 && 1 <= self.x && self.x <= 8) [INFO] [stdout] 455 + 1 <= self.y && self.y <= 8 && 1 <= self.x && self.x <= 8 [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unnecessary parentheses around block return value [INFO] [stdout] --> src/lib.rs:455:9 [INFO] [stdout] | [INFO] [stdout] 455 | (1 <= self.y && self.y <= 8 && 1 <= self.x && self.x <= 8) [INFO] [stdout] | ^ ^ [INFO] [stdout] | [INFO] [stdout] = note: `#[warn(unused_parens)]` (part of `#[warn(unused)]`) on by default [INFO] [stdout] help: remove these parentheses [INFO] [stdout] | [INFO] [stdout] 455 - (1 <= self.y && self.y <= 8 && 1 <= self.x && self.x <= 8) [INFO] [stdout] 455 + 1 <= self.y && self.y <= 8 && 1 <= self.x && self.x <= 8 [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unused variable: `piece` [INFO] [stdout] --> src/lib.rs:1097:18 [INFO] [stdout] | [INFO] [stdout] 1097 | Some(piece) => { piece_color = self.get_piece_at(piece_position).unwrap().color.clone(); } [INFO] [stdout] | ^^^^^ help: if this is intentional, prefix it with an underscore: `_piece` [INFO] [stdout] | [INFO] [stdout] = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: field `moved_piece_color` is never read [INFO] [stdout] --> src/lib.rs:481:5 [INFO] [stdout] | [INFO] [stdout] 479 | struct Move { [INFO] [stdout] | ---- field in this struct [INFO] [stdout] 480 | moved_piece_type: PieceType, [INFO] [stdout] 481 | moved_piece_color: Color, [INFO] [stdout] | ^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: `Move` has derived impls for the traits `Debug` and `Clone`, but these are intentionally ignored during dead code analysis [INFO] [stdout] = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: match expression looks like `matches!` macro [INFO] [stdout] --> src/lib.rs:384:9 [INFO] [stdout] | [INFO] [stdout] 384 | / match self { [INFO] [stdout] 385 | | PieceType::King => true, [INFO] [stdout] 386 | | _ => false [INFO] [stdout] 387 | | } [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_like_matches_macro [INFO] [stdout] = note: `#[warn(clippy::match_like_matches_macro)]` on by default [INFO] [stdout] help: use `matches!` directly [INFO] [stdout] | [INFO] [stdout] 384 - match self { [INFO] [stdout] 385 - PieceType::King => true, [INFO] [stdout] 386 - _ => false [INFO] [stdout] 387 - } [INFO] [stdout] 384 + matches!(self, PieceType::King) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: match expression looks like `matches!` macro [INFO] [stdout] --> src/lib.rs:391:9 [INFO] [stdout] | [INFO] [stdout] 391 | / match self { [INFO] [stdout] 392 | | PieceType::Pawn => true, [INFO] [stdout] 393 | | _ => false [INFO] [stdout] 394 | | } [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_like_matches_macro [INFO] [stdout] help: use `matches!` directly [INFO] [stdout] | [INFO] [stdout] 391 - match self { [INFO] [stdout] 392 - PieceType::Pawn => true, [INFO] [stdout] 393 - _ => false [INFO] [stdout] 394 - } [INFO] [stdout] 391 + matches!(self, PieceType::Pawn) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/lib.rs:451:9 [INFO] [stdout] | [INFO] [stdout] 451 | return false; [INFO] [stdout] | ^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] = note: `#[warn(clippy::needless_return)]` on by default [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 451 - return false; [INFO] [stdout] 451 + false [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/lib.rs:466:9 [INFO] [stdout] | [INFO] [stdout] 466 | return None; [INFO] [stdout] | ^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 466 - return None; [INFO] [stdout] 466 + None [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/lib.rs:821:9 [INFO] [stdout] | [INFO] [stdout] 821 | return possible_moves; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 821 - return possible_moves; [INFO] [stdout] 821 + possible_moves [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unused variable: `piece` [INFO] [stdout] --> src/lib.rs:1097:18 [INFO] [stdout] | [INFO] [stdout] 1097 | Some(piece) => { piece_color = self.get_piece_at(piece_position).unwrap().color.clone(); } [INFO] [stdout] | ^^^^^ help: if this is intentional, prefix it with an underscore: `_piece` [INFO] [stdout] | [INFO] [stdout] = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: accessing first element with `self [INFO] [stdout] .offset_and_check_availability( [INFO] [stdout] &[possible_direction.0], [INFO] [stdout] 1i8, [INFO] [stdout] board, [INFO] [stdout] moving, [INFO] [stdout] possible_direction.1 [INFO] [stdout] ).get(0)` [INFO] [stdout] --> src/lib.rs:593:40 [INFO] [stdout] | [INFO] [stdout] 593 | if let Some(val) = self [INFO] [stdout] | ________________________________________^ [INFO] [stdout] 594 | | .offset_and_check_availability( [INFO] [stdout] 595 | | &[possible_direction.0], [INFO] [stdout] 596 | | 1i8, [INFO] [stdout] ... | [INFO] [stdout] 601 | | .get(0) [INFO] [stdout] | |_______________________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#get_first [INFO] [stdout] = note: `#[warn(clippy::get_first)]` on by default [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 593 ~ if let Some(val) = self [INFO] [stdout] 594 + .offset_and_check_availability( [INFO] [stdout] 595 + &[possible_direction.0], [INFO] [stdout] 596 + 1i8, [INFO] [stdout] 597 + board, [INFO] [stdout] 598 + moving, [INFO] [stdout] 599 + possible_direction.1 [INFO] [stdout] 600 + ).first() [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` can be collapsed into the outer `match` [INFO] [stdout] --> src/lib.rs:674:25 [INFO] [stdout] | [INFO] [stdout] 674 | / if ((self.position.y == 2 && self.color == Color::White) [INFO] [stdout] 675 | | || (self.position.y == 7 && self.color == Color::Black)) [INFO] [stdout] 676 | | && board.get_piece_at(position).is_none() [INFO] [stdout] ... | [INFO] [stdout] 689 | | } [INFO] [stdout] | |_________________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_match [INFO] [stdout] = note: `#[warn(clippy::collapsible_match)]` on by default [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 673 ~ Some(position) [INFO] [stdout] 674 | if ((self.position.y == 2 && self.color == Color::White) [INFO] [stdout] 675 | || (self.position.y == 7 && self.color == Color::Black)) [INFO] [stdout] 676 | && board.get_piece_at(position).is_none() [INFO] [stdout] 677 ~ => { [INFO] [stdout] 678 | if board [INFO] [stdout] ... [INFO] [stdout] 688 | } [INFO] [stdout] 689 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` [INFO] [stdout] --> src/lib.rs:669:17 [INFO] [stdout] | [INFO] [stdout] 669 | / match self [INFO] [stdout] 670 | | .position [INFO] [stdout] 671 | | .position_at_offset(&(0, direction_from_color * 2)) [INFO] [stdout] ... | [INFO] [stdout] 691 | | None => {} [INFO] [stdout] 692 | | } [INFO] [stdout] | |_________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match [INFO] [stdout] = note: `#[warn(clippy::single_match)]` on by default [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 669 ~ if let Some(position) = self [INFO] [stdout] 670 + .position [INFO] [stdout] 671 + .position_at_offset(&(0, direction_from_color * 2)) { [INFO] [stdout] 672 + if ((self.position.y == 2 && self.color == Color::White) [INFO] [stdout] 673 + || (self.position.y == 7 && self.color == Color::Black)) [INFO] [stdout] 674 + && board.get_piece_at(position).is_none() [INFO] [stdout] 675 + { [INFO] [stdout] 676 + if board [INFO] [stdout] 677 + .get_piece_at( [INFO] [stdout] 678 + self.position [INFO] [stdout] 679 + .position_at_offset(&(0, direction_from_color)) [INFO] [stdout] 680 + .unwrap() [INFO] [stdout] 681 + ) [INFO] [stdout] 682 + .is_none() [INFO] [stdout] 683 + { [INFO] [stdout] 684 + possible_directions [INFO] [stdout] 685 + .push(((0, direction_from_color * 2), move_type)); [INFO] [stdout] 686 + } [INFO] [stdout] 687 + } [INFO] [stdout] 688 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/lib.rs:674:25 [INFO] [stdout] | [INFO] [stdout] 674 | / if ((self.position.y == 2 && self.color == Color::White) [INFO] [stdout] 675 | | || (self.position.y == 7 && self.color == Color::Black)) [INFO] [stdout] 676 | | && board.get_piece_at(position).is_none() [INFO] [stdout] ... | [INFO] [stdout] 689 | | } [INFO] [stdout] | |_________________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] = note: `#[warn(clippy::collapsible_if)]` on by default [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 676 ~ && board.get_piece_at(position).is_none() [INFO] [stdout] 677 ~ && board [INFO] [stdout] 678 | .get_piece_at( [INFO] [stdout] ... [INFO] [stdout] 686 | .push(((0, direction_from_color * 2), move_type)); [INFO] [stdout] 687 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` [INFO] [stdout] --> src/lib.rs:695:21 [INFO] [stdout] | [INFO] [stdout] 695 | / match self [INFO] [stdout] 696 | | .position [INFO] [stdout] 697 | | .position_at_offset(&(*side_direction, direction_from_color)) [INFO] [stdout] ... | [INFO] [stdout] 774 | | None => {} [INFO] [stdout] 775 | | } [INFO] [stdout] | |_____________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 695 ~ if let Some(new_position) = self [INFO] [stdout] 696 + .position [INFO] [stdout] 697 + .position_at_offset(&(*side_direction, direction_from_color)) { [INFO] [stdout] 698 + let mut new_position_occupied: bool = false; [INFO] [stdout] 699 + [INFO] [stdout] 700 + //Checks for a piece in the diagonal direction to capture [INFO] [stdout] 701 + for piece in &board.pieces { [INFO] [stdout] 702 + if piece.position == new_position { [INFO] [stdout] 703 + if piece.color == self.color { [INFO] [stdout] 704 + } else { [INFO] [stdout] 705 + possible_directions.push(( [INFO] [stdout] 706 + (*side_direction, direction_from_color), [INFO] [stdout] 707 + move_type, [INFO] [stdout] 708 + )); [INFO] [stdout] 709 + new_position_occupied = true; [INFO] [stdout] 710 + } [INFO] [stdout] 711 + } [INFO] [stdout] 712 + } [INFO] [stdout] 713 + [INFO] [stdout] 714 + //Checks if the piece can capture a pawn en passant [INFO] [stdout] 715 + if new_position_occupied { [INFO] [stdout] 716 + } else { [INFO] [stdout] 717 + match &self.position.position_at_offset(&(*side_direction, 0i8)) { [INFO] [stdout] 718 + Some(side_position) => { [INFO] [stdout] 719 + for piece in &board.pieces { [INFO] [stdout] 720 + if piece.position == side_position.clone() { [INFO] [stdout] 721 + if piece.color == self.color { [INFO] [stdout] 722 + } else { [INFO] [stdout] 723 + if board.play_history.len() == 0 [INFO] [stdout] 724 + || side_position [INFO] [stdout] 725 + .position_at_offset(&( [INFO] [stdout] 726 + 0i8, [INFO] [stdout] 727 + direction_from_color * 2 [INFO] [stdout] 728 + )) [INFO] [stdout] 729 + .is_none() [INFO] [stdout] 730 + { [INFO] [stdout] 731 + continue; [INFO] [stdout] 732 + } [INFO] [stdout] 733 + if board [INFO] [stdout] 734 + .play_history [INFO] [stdout] 735 + .last() [INFO] [stdout] 736 + .unwrap() [INFO] [stdout] 737 + .end_position [INFO] [stdout] 738 + == side_position.clone() [INFO] [stdout] 739 + && board [INFO] [stdout] 740 + .play_history [INFO] [stdout] 741 + .last() [INFO] [stdout] 742 + .unwrap() [INFO] [stdout] 743 + .start_position [INFO] [stdout] 744 + == side_position [INFO] [stdout] 745 + .position_at_offset(&( [INFO] [stdout] 746 + 0i8, [INFO] [stdout] 747 + direction_from_color * 2 [INFO] [stdout] 748 + )) [INFO] [stdout] 749 + .unwrap() [INFO] [stdout] 750 + && board [INFO] [stdout] 751 + .play_history [INFO] [stdout] 752 + .last() [INFO] [stdout] 753 + .unwrap() [INFO] [stdout] 754 + .moved_piece_type [INFO] [stdout] 755 + .is_pawn() [INFO] [stdout] 756 + { [INFO] [stdout] 757 + possible_directions.push(( [INFO] [stdout] 758 + (*side_direction, direction_from_color), [INFO] [stdout] 759 + MoveType::Passant( [INFO] [stdout] 760 + side_position.clone() [INFO] [stdout] 761 + ) [INFO] [stdout] 762 + )); [INFO] [stdout] 763 + } [INFO] [stdout] 764 + } [INFO] [stdout] 765 + } [INFO] [stdout] 766 + } [INFO] [stdout] 767 + } [INFO] [stdout] 768 + None => {} [INFO] [stdout] 769 + } [INFO] [stdout] 770 + } [INFO] [stdout] 771 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` [INFO] [stdout] --> src/lib.rs:719:33 [INFO] [stdout] | [INFO] [stdout] 719 | / ... match &self.position.position_at_offset(&(*side_direction, 0i8)) { [INFO] [stdout] 720 | | ... Some(side_position) => { [INFO] [stdout] 721 | | ... for piece in &board.pieces { [INFO] [stdout] 722 | | ... if piece.position == side_position.clone() { [INFO] [stdout] ... | [INFO] [stdout] 770 | | ... None => {} [INFO] [stdout] 771 | | ... } [INFO] [stdout] | |_______________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 719 ~ if let Some(side_position) = &self.position.position_at_offset(&(*side_direction, 0i8)) { [INFO] [stdout] 720 + for piece in &board.pieces { [INFO] [stdout] 721 + if piece.position == side_position.clone() { [INFO] [stdout] 722 + if piece.color == self.color { [INFO] [stdout] 723 + } else { [INFO] [stdout] 724 + if board.play_history.len() == 0 [INFO] [stdout] 725 + || side_position [INFO] [stdout] 726 + .position_at_offset(&( [INFO] [stdout] 727 + 0i8, [INFO] [stdout] 728 + direction_from_color * 2 [INFO] [stdout] 729 + )) [INFO] [stdout] 730 + .is_none() [INFO] [stdout] 731 + { [INFO] [stdout] 732 + continue; [INFO] [stdout] 733 + } [INFO] [stdout] 734 + if board [INFO] [stdout] 735 + .play_history [INFO] [stdout] 736 + .last() [INFO] [stdout] 737 + .unwrap() [INFO] [stdout] 738 + .end_position [INFO] [stdout] 739 + == side_position.clone() [INFO] [stdout] 740 + && board [INFO] [stdout] 741 + .play_history [INFO] [stdout] 742 + .last() [INFO] [stdout] 743 + .unwrap() [INFO] [stdout] 744 + .start_position [INFO] [stdout] 745 + == side_position [INFO] [stdout] 746 + .position_at_offset(&( [INFO] [stdout] 747 + 0i8, [INFO] [stdout] 748 + direction_from_color * 2 [INFO] [stdout] 749 + )) [INFO] [stdout] 750 + .unwrap() [INFO] [stdout] 751 + && board [INFO] [stdout] 752 + .play_history [INFO] [stdout] 753 + .last() [INFO] [stdout] 754 + .unwrap() [INFO] [stdout] 755 + .moved_piece_type [INFO] [stdout] 756 + .is_pawn() [INFO] [stdout] 757 + { [INFO] [stdout] 758 + possible_directions.push(( [INFO] [stdout] 759 + (*side_direction, direction_from_color), [INFO] [stdout] 760 + MoveType::Passant( [INFO] [stdout] 761 + side_position.clone() [INFO] [stdout] 762 + ) [INFO] [stdout] 763 + )); [INFO] [stdout] 764 + } [INFO] [stdout] 765 + } [INFO] [stdout] 766 + } [INFO] [stdout] 767 + } [INFO] [stdout] 768 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Position` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:722:66 [INFO] [stdout] | [INFO] [stdout] 722 | ... if piece.position == side_position.clone() { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^ help: try dereferencing it: `*side_position` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] = note: `#[warn(clippy::clone_on_copy)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: length comparison to zero [INFO] [stdout] --> src/lib.rs:725:56 [INFO] [stdout] | [INFO] [stdout] 725 | ... if board.play_history.len() == 0 [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `board.play_history.is_empty()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero [INFO] [stdout] = note: `#[warn(clippy::len_zero)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Position` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:740:60 [INFO] [stdout] | [INFO] [stdout] 740 | ... == side_position.clone() [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^ help: try dereferencing it: `*side_position` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Position` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:762:65 [INFO] [stdout] | [INFO] [stdout] 762 | ... side_position.clone() [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^ help: try dereferencing it: `*side_position` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: field `moved_piece_color` is never read [INFO] [stdout] --> src/lib.rs:481:5 [INFO] [stdout] | [INFO] [stdout] 479 | struct Move { [INFO] [stdout] | ---- field in this struct [INFO] [stdout] 480 | moved_piece_type: PieceType, [INFO] [stdout] 481 | moved_piece_color: Color, [INFO] [stdout] | ^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: `Move` has derived impls for the traits `Debug` and `Clone`, but these are intentionally ignored during dead code analysis [INFO] [stdout] = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: accessing first element with `self [INFO] [stdout] .offset_and_check_availability( [INFO] [stdout] &[possible_direction.0], [INFO] [stdout] 1i8, [INFO] [stdout] board, [INFO] [stdout] moving, [INFO] [stdout] possible_direction.1 [INFO] [stdout] ).get(0)` [INFO] [stdout] --> src/lib.rs:779:40 [INFO] [stdout] | [INFO] [stdout] 779 | if let Some(val) = self [INFO] [stdout] | ________________________________________^ [INFO] [stdout] 780 | | .offset_and_check_availability( [INFO] [stdout] 781 | | &[possible_direction.0], [INFO] [stdout] 782 | | 1i8, [INFO] [stdout] ... | [INFO] [stdout] 787 | | .get(0) [INFO] [stdout] | |_______________________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#get_first [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 779 ~ if let Some(val) = self [INFO] [stdout] 780 + .offset_and_check_availability( [INFO] [stdout] 781 + &[possible_direction.0], [INFO] [stdout] 782 + 1i8, [INFO] [stdout] 783 + board, [INFO] [stdout] 784 + moving, [INFO] [stdout] 785 + possible_direction.1 [INFO] [stdout] 786 + ).first() [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this boolean expression can be simplified [INFO] [stdout] --> src/lib.rs:922:29 [INFO] [stdout] | [INFO] [stdout] 922 | ... false || move_type == MoveType::Passant(Position::new(1, 1)), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `move_type == MoveType::Passant(Position::new(1, 1))` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#nonminimal_bool [INFO] [stdout] = note: `#[warn(clippy::nonminimal_bool)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/lib.rs:932:9 [INFO] [stdout] | [INFO] [stdout] 932 | return possible_moves; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 932 - return possible_moves; [INFO] [stdout] 932 + possible_moves [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Position` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:847:53 [INFO] [stdout] | [INFO] [stdout] 847 | ... king_position = piece.position.clone(); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `piece.position` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Piece` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:851:48 [INFO] [stdout] | [INFO] [stdout] 851 | ... let mut p: Piece = self.clone(); [INFO] [stdout] | ^^^^^^^^^^^^ help: try dereferencing it: `*self` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Position` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:852:44 [INFO] [stdout] | [INFO] [stdout] 852 | ... p.set_position(position_moving_to.clone()); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `position_moving_to` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Position` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:856:63 [INFO] [stdout] | [INFO] [stdout] 856 | ... if piece_on_board.position == self.position.clone() { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `self.position` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/lib.rs:860:58 [INFO] [stdout] | [INFO] [stdout] 860 | ... new_board_state.push(&piece_on_board); [INFO] [stdout] | ^^^^^^^^^^^^^^^ help: change this to: `piece_on_board` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow [INFO] [stdout] = note: `#[warn(clippy::needless_borrow)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Position` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:865:49 [INFO] [stdout] | [INFO] [stdout] 865 | ... king_position = position_moving_to.clone(); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `position_moving_to` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Color` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:876:55 [INFO] [stdout] | [INFO] [stdout] 876 | ... current_turn: board.current_turn.clone(), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `board.current_turn` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you are using an explicit closure for copying elements [INFO] [stdout] --> src/lib.rs:877:55 [INFO] [stdout] | [INFO] [stdout] 877 | ... play_history: board [INFO] [stdout] | _____________________________________^ [INFO] [stdout] 878 | | ... .play_history [INFO] [stdout] 879 | | ... .iter() [INFO] [stdout] 880 | | ... .map(|mov| mov.clone()) [INFO] [stdout] | |_________________________________________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_clone [INFO] [stdout] = note: `#[warn(clippy::map_clone)]` on by default [INFO] [stdout] help: consider calling the dedicated `copied` method [INFO] [stdout] | [INFO] [stdout] 877 ~ play_history: board [INFO] [stdout] 878 + .play_history [INFO] [stdout] 879 + .iter().copied() [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Move` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:880:56 [INFO] [stdout] | [INFO] [stdout] 880 | ... .map(|mov| mov.clone()) [INFO] [stdout] | ^^^^^^^^^^^ help: try dereferencing it: `*mov` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Position` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:883:56 [INFO] [stdout] | [INFO] [stdout] 883 | ... if piece.can_check(king_position.clone(), &board2) { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `king_position` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression borrows a value the compiler would automatically borrow [INFO] [stdout] --> src/lib.rs:891:36 [INFO] [stdout] | [INFO] [stdout] 891 | ... if (&position_moving_to) [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^ help: change this to: `position_moving_to` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression borrows a value the compiler would automatically borrow [INFO] [stdout] --> src/lib.rs:901:28 [INFO] [stdout] | [INFO] [stdout] 901 | if (&position_moving_to) [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^ help: change this to: `position_moving_to` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: calls to `push` immediately after creation [INFO] [stdout] --> src/lib.rs:31:5 [INFO] [stdout] | [INFO] [stdout] 31 | / let mut pieces: Vec = Vec::new(); [INFO] [stdout] 32 | | [INFO] [stdout] 33 | | pieces.push(Piece { [INFO] [stdout] 34 | | position: Position { x: 4, y: 1 }, [INFO] [stdout] ... | [INFO] [stdout] 46 | | piece_type: PieceType::Rook [INFO] [stdout] 47 | | }); [INFO] [stdout] | |_______^ help: consider using the `vec![]` macro: `let pieces: Vec = vec![..];` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#vec_init_then_push [INFO] [stdout] = note: `#[warn(clippy::vec_init_then_push)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unnecessary operation [INFO] [stdout] --> src/lib.rs:906:33 [INFO] [stdout] | [INFO] [stdout] 906 | / ... &possible_moves.push(Move::new( [INFO] [stdout] 907 | | ... self.piece_type.clone(), [INFO] [stdout] 908 | | ... self.color.clone(), [INFO] [stdout] 909 | | ... self.position.clone(), [INFO] [stdout] ... | [INFO] [stdout] 912 | | ... move_type [INFO] [stdout] 913 | | ... )); [INFO] [stdout] | |_________________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_operation [INFO] [stdout] = note: `#[warn(clippy::unnecessary_operation)]` on by default [INFO] [stdout] help: statement can be reduced to [INFO] [stdout] | [INFO] [stdout] 906 ~ possible_moves.push(Move::new( [INFO] [stdout] 907 + self.piece_type.clone(), [INFO] [stdout] 908 + self.color.clone(), [INFO] [stdout] 909 + self.position.clone(), [INFO] [stdout] 910 + position_moving_to.clone(), [INFO] [stdout] 911 + true, [INFO] [stdout] 912 + move_type [INFO] [stdout] 913 + )); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `PieceType` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:907:37 [INFO] [stdout] | [INFO] [stdout] 907 | ... self.piece_type.clone(), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `self.piece_type` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Color` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:908:37 [INFO] [stdout] | [INFO] [stdout] 908 | ... self.color.clone(), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `self.color` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Position` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:909:37 [INFO] [stdout] | [INFO] [stdout] 909 | ... self.position.clone(), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `self.position` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Position` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:910:37 [INFO] [stdout] | [INFO] [stdout] 910 | ... position_moving_to.clone(), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `position_moving_to` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unnecessary operation [INFO] [stdout] --> src/lib.rs:917:25 [INFO] [stdout] | [INFO] [stdout] 917 | / &possible_moves.push(Move::new( [INFO] [stdout] 918 | | self.piece_type.clone(), [INFO] [stdout] 919 | | self.color.clone(), [INFO] [stdout] 920 | | self.position.clone(), [INFO] [stdout] ... | [INFO] [stdout] 923 | | move_type [INFO] [stdout] 924 | | )); [INFO] [stdout] | |___________________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_operation [INFO] [stdout] help: statement can be reduced to [INFO] [stdout] | [INFO] [stdout] 917 ~ possible_moves.push(Move::new( [INFO] [stdout] 918 + self.piece_type.clone(), [INFO] [stdout] 919 + self.color.clone(), [INFO] [stdout] 920 + self.position.clone(), [INFO] [stdout] 921 + position_moving_to.clone(), [INFO] [stdout] 922 + false || move_type == MoveType::Passant(Position::new(1, 1)), [INFO] [stdout] 923 + move_type [INFO] [stdout] 924 + )); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `PieceType` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:918:29 [INFO] [stdout] | [INFO] [stdout] 918 | ... self.piece_type.clone(), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `self.piece_type` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: calls to `push` immediately after creation [INFO] [stdout] --> src/lib.rs:60:5 [INFO] [stdout] | [INFO] [stdout] 60 | / let mut pieces: Vec = Vec::new(); [INFO] [stdout] 61 | | [INFO] [stdout] 62 | | pieces.push(Piece { [INFO] [stdout] 63 | | position: Position { x: 1, y: 1 }, [INFO] [stdout] ... | [INFO] [stdout] 80 | | piece_type: PieceType::Pawn [INFO] [stdout] 81 | | }); [INFO] [stdout] | |_______^ help: consider using the `vec![]` macro: `let pieces: Vec = vec![..];` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#vec_init_then_push [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Color` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:919:29 [INFO] [stdout] | [INFO] [stdout] 919 | ... self.color.clone(), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `self.color` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Position` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:920:29 [INFO] [stdout] | [INFO] [stdout] 920 | ... self.position.clone(), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `self.position` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Position` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:921:29 [INFO] [stdout] | [INFO] [stdout] 921 | ... position_moving_to.clone(), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `position_moving_to` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/lib.rs:942:9 [INFO] [stdout] | [INFO] [stdout] 942 | return false; [INFO] [stdout] | ^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 942 - return false; [INFO] [stdout] 942 + false [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Position` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:950:9 [INFO] [stdout] | [INFO] [stdout] 950 | self.position.clone() [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `self.position` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `PieceType` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:954:9 [INFO] [stdout] | [INFO] [stdout] 954 | self.piece_type.clone() [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `self.piece_type` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Color` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:958:9 [INFO] [stdout] | [INFO] [stdout] 958 | self.color.clone() [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `self.color` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: calls to `push` immediately after creation [INFO] [stdout] --> src/lib.rs:105:5 [INFO] [stdout] | [INFO] [stdout] 105 | / let mut pieces: Vec = Vec::new(); [INFO] [stdout] 106 | | [INFO] [stdout] 107 | | pieces.push(Piece { [INFO] [stdout] 108 | | position: Position { x: 1, y: 1 }, [INFO] [stdout] ... | [INFO] [stdout] 135 | | piece_type: PieceType::Rook [INFO] [stdout] 136 | | }); [INFO] [stdout] | |_______^ help: consider using the `vec![]` macro: `let pieces: Vec = vec![..];` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#vec_init_then_push [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/lib.rs:986:9 [INFO] [stdout] | [INFO] [stdout] 986 | return out; [INFO] [stdout] | ^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 986 - return out; [INFO] [stdout] 986 + out [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/lib.rs:982:74 [INFO] [stdout] | [INFO] [stdout] 982 | let possible_moves: Vec = piece.get_possible_moves(&self, true); [INFO] [stdout] | ^^^^^ help: change this to: `self` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unnecessary operation [INFO] [stdout] --> src/lib.rs:983:17 [INFO] [stdout] | [INFO] [stdout] 983 | &out.push((&piece, possible_moves)); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: statement can be reduced to: `out.push((&piece, possible_moves));` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_operation [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/lib.rs:983:28 [INFO] [stdout] | [INFO] [stdout] 983 | &out.push((&piece, possible_moves)); [INFO] [stdout] | ^^^^^^ help: change this to: `piece` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/lib.rs:991:9 [INFO] [stdout] | [INFO] [stdout] 991 | / return self [INFO] [stdout] 992 | | .get_available_moves(self.current_turn) [INFO] [stdout] 993 | | .iter() [INFO] [stdout] 994 | | .map(|t| { [INFO] [stdout] ... | [INFO] [stdout] 1006 | | }) [INFO] [stdout] 1007 | | .collect(); [INFO] [stdout] | |______________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 991 ~ self [INFO] [stdout] 992 + .get_available_moves(self.current_turn) [INFO] [stdout] 993 + .iter() [INFO] [stdout] 994 + .map(|t| { [INFO] [stdout] 995 + ( [INFO] [stdout] 996 + t.0, [INFO] [stdout] 997 + t.1.iter() [INFO] [stdout] 998 + .map(|mov| { [INFO] [stdout] 999 + ( [INFO] [stdout] 1000 + mov.end_position.clone(), [INFO] [stdout] 1001 + mov.move_type == MoveType::Promotion [INFO] [stdout] 1002 + ) [INFO] [stdout] 1003 + }) [INFO] [stdout] 1004 + .collect() [INFO] [stdout] 1005 + ) [INFO] [stdout] 1006 + }) [INFO] [stdout] 1007 ~ .collect() [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Position` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:1000:33 [INFO] [stdout] | [INFO] [stdout] 1000 | ... mov.end_position.clone(), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `mov.end_position` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/lib.rs:1068:9 [INFO] [stdout] | [INFO] [stdout] 1068 | return standard_layout; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 1068 - return standard_layout; [INFO] [stdout] 1068 + standard_layout [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: calls to `push` immediately after creation [INFO] [stdout] --> src/lib.rs:151:5 [INFO] [stdout] | [INFO] [stdout] 151 | / let mut pieces: Vec = Vec::new(); [INFO] [stdout] 152 | | [INFO] [stdout] 153 | | pieces.push(Piece { [INFO] [stdout] 154 | | position: Position { x: 5, y: 1 }, [INFO] [stdout] ... | [INFO] [stdout] 171 | | piece_type: PieceType::Rook [INFO] [stdout] 172 | | }); [INFO] [stdout] | |_______^ help: consider using the `vec![]` macro: `let pieces: Vec = vec![..];` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#vec_init_then_push [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded late initialization [INFO] [stdout] --> src/lib.rs:1047:13 [INFO] [stdout] | [INFO] [stdout] 1047 | let piece_type: PieceType; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_late_init [INFO] [stdout] = note: `#[warn(clippy::needless_late_init)]` on by default [INFO] [stdout] help: move the declaration `piece_type` here and remove the assignments from the `match` arms [INFO] [stdout] | [INFO] [stdout] 1047 ~ [INFO] [stdout] 1048 | [INFO] [stdout] 1049 ~ let piece_type: PieceType = match piece_prototype.1 { [INFO] [stdout] 1050 ~ 'r' => PieceType::Rook, [INFO] [stdout] 1051 ~ 'n' => PieceType::Knight, [INFO] [stdout] 1052 ~ 'b' => PieceType::Bishop, [INFO] [stdout] 1053 ~ 'q' => PieceType::Queen, [INFO] [stdout] 1054 ~ 'k' => PieceType::King, [INFO] [stdout] 1055 ~ 'p' => PieceType::Pawn, [INFO] [stdout] 1056 | _ => unreachable!("Char {} does not match a piece type", piece_prototype.1) [INFO] [stdout] 1057 ~ }; [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: calls to `push` immediately after creation [INFO] [stdout] --> src/lib.rs:200:5 [INFO] [stdout] | [INFO] [stdout] 200 | / let mut pieces: Vec = Vec::new(); [INFO] [stdout] 201 | | [INFO] [stdout] 202 | | pieces.push(Piece { [INFO] [stdout] 203 | | position: Position { x: 5, y: 1 }, [INFO] [stdout] ... | [INFO] [stdout] 220 | | piece_type: PieceType::Rook [INFO] [stdout] 221 | | }); [INFO] [stdout] | |_______^ help: consider using the `vec![]` macro: `let pieces: Vec = vec![..];` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#vec_init_then_push [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unnecessary operation [INFO] [stdout] --> src/lib.rs:1059:13 [INFO] [stdout] | [INFO] [stdout] 1059 | / &standard_layout.push(Piece { [INFO] [stdout] 1060 | | position: Position { [INFO] [stdout] 1061 | | x: piece_prototype.2, [INFO] [stdout] 1062 | | y: piece_prototype.3, [INFO] [stdout] ... | [INFO] [stdout] 1065 | | piece_type: piece_type.clone() [INFO] [stdout] 1066 | | }); [INFO] [stdout] | |_______________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_operation [INFO] [stdout] help: statement can be reduced to [INFO] [stdout] | [INFO] [stdout] 1059 ~ standard_layout.push(Piece { [INFO] [stdout] 1060 + position: Position { [INFO] [stdout] 1061 + x: piece_prototype.2, [INFO] [stdout] 1062 + y: piece_prototype.3, [INFO] [stdout] 1063 + }, [INFO] [stdout] 1064 + color: piece_prototype.0, [INFO] [stdout] 1065 + piece_type: piece_type.clone() [INFO] [stdout] 1066 + }); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `PieceType` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:1065:29 [INFO] [stdout] | [INFO] [stdout] 1065 | piece_type: piece_type.clone() [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `piece_type` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/lib.rs:1077:9 [INFO] [stdout] | [INFO] [stdout] 1077 | return None; [INFO] [stdout] | ^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 1077 - return None; [INFO] [stdout] 1077 + None [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/lib.rs:1074:29 [INFO] [stdout] | [INFO] [stdout] 1074 | return Some(&piece); [INFO] [stdout] | ^^^^^^ help: change this to: `piece` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: calls to `push` immediately after creation [INFO] [stdout] --> src/lib.rs:232:5 [INFO] [stdout] | [INFO] [stdout] 232 | / let mut pieces: Vec = Vec::new(); [INFO] [stdout] 233 | | [INFO] [stdout] 234 | | pieces.push(Piece { [INFO] [stdout] 235 | | position: Position { x: 5, y: 1 }, [INFO] [stdout] ... | [INFO] [stdout] 247 | | piece_type: PieceType::Bishop [INFO] [stdout] 248 | | }); [INFO] [stdout] | |_______^ help: consider using the `vec![]` macro: `let pieces: Vec = vec![..];` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#vec_init_then_push [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/lib.rs:1086:9 [INFO] [stdout] | [INFO] [stdout] 1086 | return None; [INFO] [stdout] | ^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 1086 - return None; [INFO] [stdout] 1086 + None [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of `Iterator::find` [INFO] [stdout] --> src/lib.rs:1081:9 [INFO] [stdout] | [INFO] [stdout] 1081 | / for piece in &mut self.pieces { [INFO] [stdout] 1082 | | if piece.position == position { [INFO] [stdout] 1083 | | return Some(piece); [INFO] [stdout] ... | [INFO] [stdout] 1086 | | return None; [INFO] [stdout] | |____________________^ help: replace with an iterator: `self.pieces.iter_mut().find(|piece| piece.position == position).map(|v| v as _)` [INFO] [stdout] | [INFO] [stdout] = note: you may need to dereference some variables [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_find [INFO] [stdout] = note: `#[warn(clippy::manual_find)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: calls to `push` immediately after creation [INFO] [stdout] --> src/lib.rs:259:5 [INFO] [stdout] | [INFO] [stdout] 259 | / let mut pieces1: Vec = Vec::new(); [INFO] [stdout] 260 | | [INFO] [stdout] 261 | | pieces1.push(Piece { [INFO] [stdout] 262 | | position: Position::new(5, 1), [INFO] [stdout] ... | [INFO] [stdout] 279 | | piece_type: PieceType::Rook [INFO] [stdout] 280 | | }); [INFO] [stdout] | |_______^ help: consider using the `vec![]` macro: `let pieces1: Vec = vec![..];` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#vec_init_then_push [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: calls to `push` immediately after creation [INFO] [stdout] --> src/lib.rs:286:5 [INFO] [stdout] | [INFO] [stdout] 286 | / let mut pieces2: Vec = Vec::new(); [INFO] [stdout] 287 | | [INFO] [stdout] 288 | | pieces2.push(Piece { [INFO] [stdout] 289 | | position: Position::new(5, 1), [INFO] [stdout] ... | [INFO] [stdout] 306 | | piece_type: PieceType::Bishop [INFO] [stdout] 307 | | }); [INFO] [stdout] | |_______^ help: consider using the `vec![]` macro: `let pieces2: Vec = vec![..];` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#vec_init_then_push [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: calls to `push` immediately after creation [INFO] [stdout] --> src/lib.rs:313:5 [INFO] [stdout] | [INFO] [stdout] 313 | / let mut pieces3: Vec = Vec::new(); [INFO] [stdout] 314 | | [INFO] [stdout] 315 | | pieces3.push(Piece { [INFO] [stdout] 316 | | position: Position::new(5, 1), [INFO] [stdout] ... | [INFO] [stdout] 328 | | piece_type: PieceType::Queen [INFO] [stdout] 329 | | }); [INFO] [stdout] | |_______^ help: consider using the `vec![]` macro: `let pieces3: Vec = vec![..];` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#vec_init_then_push [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this boolean expression can be simplified [INFO] [stdout] --> src/lib.rs:343:13 [INFO] [stdout] | [INFO] [stdout] 343 | assert!(!board.get_piece_at(Position::new(5, 5)).is_some()); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `board.get_piece_at(Position::new(5, 5)).is_none()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#nonminimal_bool [INFO] [stdout] = note: `#[warn(clippy::nonminimal_bool)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this boolean expression can be simplified [INFO] [stdout] --> src/lib.rs:352:13 [INFO] [stdout] | [INFO] [stdout] 352 | assert!(!board.get_piece_at(Position::new(1, 4)).is_some()); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `board.get_piece_at(Position::new(1, 4)).is_none()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#nonminimal_bool [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Color` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:1097:44 [INFO] [stdout] | [INFO] [stdout] 1097 | Some(piece) => { piece_color = self.get_piece_at(piece_position).unwrap().color.clone(); } [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `self.get_piece_at(piece_position).unwrap().color` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Color` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:1109:56 [INFO] [stdout] | [INFO] [stdout] 1109 | for available_move in self.get_available_moves(piece_color.clone()) { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `piece_color` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Move` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:1112:37 [INFO] [stdout] | [INFO] [stdout] 1112 | move_vec_clone.push(mov.clone()); [INFO] [stdout] | ^^^^^^^^^^^ help: try removing the `clone` call: `mov` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Piece` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:1114:41 [INFO] [stdout] | [INFO] [stdout] 1114 | available_moves_clone.push((available_move.0.clone(), move_vec_clone)); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try dereferencing it: `*available_move.0` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Position` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:1130:55 [INFO] [stdout] | [INFO] [stdout] 1130 | ... self.get_piece_at_mut(piece_move.0.position.clone()) [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `piece_move.0.position` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Position` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:1132:51 [INFO] [stdout] | [INFO] [stdout] 1132 | ... .set_position(possible_move.end_position.clone()); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `possible_move.end_position` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Position` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:1136:55 [INFO] [stdout] | [INFO] [stdout] 1136 | ... self.get_piece_at_mut(piece_move.0.position.clone()) [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `piece_move.0.position` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Position` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:1138:51 [INFO] [stdout] | [INFO] [stdout] 1138 | ... .set_position(possible_move.end_position.clone()); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `possible_move.end_position` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Position` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:1141:55 [INFO] [stdout] | [INFO] [stdout] 1141 | ... self.get_piece_at_mut(piece_move.0.position.clone()) [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `piece_move.0.position` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: match expression looks like `matches!` macro [INFO] [stdout] --> src/lib.rs:384:9 [INFO] [stdout] | [INFO] [stdout] 384 | / match self { [INFO] [stdout] 385 | | PieceType::King => true, [INFO] [stdout] 386 | | _ => false [INFO] [stdout] 387 | | } [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_like_matches_macro [INFO] [stdout] = note: `#[warn(clippy::match_like_matches_macro)]` on by default [INFO] [stdout] help: use `matches!` directly [INFO] [stdout] | [INFO] [stdout] 384 - match self { [INFO] [stdout] 385 - PieceType::King => true, [INFO] [stdout] 386 - _ => false [INFO] [stdout] 387 - } [INFO] [stdout] 384 + matches!(self, PieceType::King) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: match expression looks like `matches!` macro [INFO] [stdout] --> src/lib.rs:391:9 [INFO] [stdout] | [INFO] [stdout] 391 | / match self { [INFO] [stdout] 392 | | PieceType::Pawn => true, [INFO] [stdout] 393 | | _ => false [INFO] [stdout] 394 | | } [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_like_matches_macro [INFO] [stdout] help: use `matches!` directly [INFO] [stdout] | [INFO] [stdout] 391 - match self { [INFO] [stdout] 392 - PieceType::Pawn => true, [INFO] [stdout] 393 - _ => false [INFO] [stdout] 394 - } [INFO] [stdout] 391 + matches!(self, PieceType::Pawn) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Position` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:1143:51 [INFO] [stdout] | [INFO] [stdout] 1143 | ... .set_position(possible_move.end_position.clone()); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `possible_move.end_position` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `PieceType` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:1166:51 [INFO] [stdout] | [INFO] [stdout] 1166 | ... .piece_type = promote_to.unwrap().clone(); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `promote_to.unwrap()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Position` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:1164:55 [INFO] [stdout] | [INFO] [stdout] 1164 | ... self.get_piece_at_mut(piece_move.0.position.clone()) [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `piece_move.0.position` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Position` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:1167:55 [INFO] [stdout] | [INFO] [stdout] 1167 | ... self.get_piece_at_mut(piece_move.0.position.clone()) [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `piece_move.0.position` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Position` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:1169:51 [INFO] [stdout] | [INFO] [stdout] 1169 | ... .set_position(possible_move.end_position.clone()); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `possible_move.end_position` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Move` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:1172:48 [INFO] [stdout] | [INFO] [stdout] 1172 | self.play_history.push(possible_move.clone()); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^ help: try dereferencing it: `*possible_move` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you are using an explicit closure for copying elements [INFO] [stdout] --> src/lib.rs:1191:23 [INFO] [stdout] | [INFO] [stdout] 1191 | self.pieces = self [INFO] [stdout] | _______________________^ [INFO] [stdout] 1192 | | .pieces [INFO] [stdout] 1193 | | .iter() [INFO] [stdout] 1194 | | .filter(|piece| !(piece.position == position)) [INFO] [stdout] 1195 | | .map(|piece| *piece) [INFO] [stdout] | |________________________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_clone [INFO] [stdout] help: consider calling the dedicated `copied` method [INFO] [stdout] | [INFO] [stdout] 1191 ~ self.pieces = self [INFO] [stdout] 1192 + .pieces [INFO] [stdout] 1193 + .iter() [INFO] [stdout] 1194 + .filter(|piece| !(piece.position == position)).copied() [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/lib.rs:451:9 [INFO] [stdout] | [INFO] [stdout] 451 | return false; [INFO] [stdout] | ^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] = note: `#[warn(clippy::needless_return)]` on by default [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 451 - return false; [INFO] [stdout] 451 + false [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Position` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:1202:22 [INFO] [stdout] | [INFO] [stdout] 1202 | out.push(piece.position.clone()); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `piece.position` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: accessing first element with `strings.get(0)` [INFO] [stdout] --> src/lib.rs:1216:19 [INFO] [stdout] | [INFO] [stdout] 1216 | (*strings.get(0).unwrap() as u32 - 96) as u8, [INFO] [stdout] | ^^^^^^^^^^^^^^ help: try: `strings.first()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#get_first [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/lib.rs:466:9 [INFO] [stdout] | [INFO] [stdout] 466 | return None; [INFO] [stdout] | ^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 466 - return None; [INFO] [stdout] 466 + None [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/lib.rs:1285:17 [INFO] [stdout] | [INFO] [stdout] 1285 | return GameState::Checkmate(self.current_turn.invert()); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 1285 - return GameState::Checkmate(self.current_turn.invert()); [INFO] [stdout] 1285 + GameState::Checkmate(self.current_turn.invert()) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/lib.rs:1287:17 [INFO] [stdout] | [INFO] [stdout] 1287 | return GameState::Check(self.current_turn.invert()); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 1287 - return GameState::Check(self.current_turn.invert()); [INFO] [stdout] 1287 + GameState::Check(self.current_turn.invert()) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/lib.rs:1296:17 [INFO] [stdout] | [INFO] [stdout] 1296 | return GameState::Draw; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 1296 - return GameState::Draw; [INFO] [stdout] 1296 + GameState::Draw [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/lib.rs:1298:17 [INFO] [stdout] | [INFO] [stdout] 1298 | return GameState::Normal; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 1298 - return GameState::Normal; [INFO] [stdout] 1298 + GameState::Normal [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Color` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:1249:65 [INFO] [stdout] | [INFO] [stdout] 1249 | let available_moves_opponent = self.get_available_moves(self.current_turn.invert().clone()); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `self.current_turn.invert()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Color` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:1250:56 [INFO] [stdout] | [INFO] [stdout] 1250 | let available_moves = self.get_available_moves(self.current_turn.clone()); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `self.current_turn` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Color` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:1255:20 [INFO] [stdout] | [INFO] [stdout] 1255 | color: self.current_turn.clone() [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `self.current_turn` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/lib.rs:821:9 [INFO] [stdout] | [INFO] [stdout] 821 | return possible_moves; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 821 - return possible_moves; [INFO] [stdout] 821 + possible_moves [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `.fold` can be written more succinctly using another method [INFO] [stdout] --> src/lib.rs:1282:18 [INFO] [stdout] | [INFO] [stdout] 1282 | .fold(0, |acc, val| acc + val) [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `sum::()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_fold [INFO] [stdout] = note: `#[warn(clippy::unnecessary_fold)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `.fold` can be written more succinctly using another method [INFO] [stdout] --> src/lib.rs:1293:18 [INFO] [stdout] | [INFO] [stdout] 1293 | .fold(0, |acc, val| acc + val) [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `sum::()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_fold [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unnecessary map of the identity function [INFO] [stdout] --> src/lib.rs:1304:27 [INFO] [stdout] | [INFO] [stdout] 1304 | self.pieces.iter().map(|piece| piece).collect() [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^ help: remove the call to `map` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_identity [INFO] [stdout] = note: `#[warn(clippy::map_identity)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: accessing first element with `self [INFO] [stdout] .offset_and_check_availability( [INFO] [stdout] &[possible_direction.0], [INFO] [stdout] 1i8, [INFO] [stdout] board, [INFO] [stdout] moving, [INFO] [stdout] possible_direction.1 [INFO] [stdout] ).get(0)` [INFO] [stdout] --> src/lib.rs:593:40 [INFO] [stdout] | [INFO] [stdout] 593 | if let Some(val) = self [INFO] [stdout] | ________________________________________^ [INFO] [stdout] 594 | | .offset_and_check_availability( [INFO] [stdout] 595 | | &[possible_direction.0], [INFO] [stdout] 596 | | 1i8, [INFO] [stdout] ... | [INFO] [stdout] 601 | | .get(0) [INFO] [stdout] | |_______________________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#get_first [INFO] [stdout] = note: `#[warn(clippy::get_first)]` on by default [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 593 ~ if let Some(val) = self [INFO] [stdout] 594 + .offset_and_check_availability( [INFO] [stdout] 595 + &[possible_direction.0], [INFO] [stdout] 596 + 1i8, [INFO] [stdout] 597 + board, [INFO] [stdout] 598 + moving, [INFO] [stdout] 599 + possible_direction.1 [INFO] [stdout] 600 + ).first() [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `.clone()` on a double reference, which returns `&Piece` instead of cloning the inner type [INFO] [stdout] --> src/lib.rs:874:64 [INFO] [stdout] | [INFO] [stdout] 874 | ... .map(|piece| *piece.clone()) [INFO] [stdout] | ^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: `#[warn(suspicious_double_ref_op)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unused borrow that must be used [INFO] [stdout] --> src/lib.rs:906:33 [INFO] [stdout] | [INFO] [stdout] 906 | / ... &possible_moves.push(Move::new( [INFO] [stdout] 907 | | ... self.piece_type.clone(), [INFO] [stdout] 908 | | ... self.color.clone(), [INFO] [stdout] 909 | | ... self.position.clone(), [INFO] [stdout] ... | [INFO] [stdout] 912 | | ... move_type [INFO] [stdout] 913 | | ... )); [INFO] [stdout] | |________________________^ the borrow produces a value [INFO] [stdout] | [INFO] [stdout] = note: `#[warn(unused_must_use)]` (part of `#[warn(unused)]`) on by default [INFO] [stdout] help: use `let _ = ...` to ignore the resulting value [INFO] [stdout] | [INFO] [stdout] 906 | let _ = &possible_moves.push(Move::new( [INFO] [stdout] | +++++++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unused borrow that must be used [INFO] [stdout] --> src/lib.rs:917:25 [INFO] [stdout] | [INFO] [stdout] 917 | / &possible_moves.push(Move::new( [INFO] [stdout] 918 | | self.piece_type.clone(), [INFO] [stdout] 919 | | self.color.clone(), [INFO] [stdout] 920 | | self.position.clone(), [INFO] [stdout] ... | [INFO] [stdout] 923 | | move_type [INFO] [stdout] 924 | | )); [INFO] [stdout] | |__________________________^ the borrow produces a value [INFO] [stdout] | [INFO] [stdout] help: use `let _ = ...` to ignore the resulting value [INFO] [stdout] | [INFO] [stdout] 917 | let _ = &possible_moves.push(Move::new( [INFO] [stdout] | +++++++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unused borrow that must be used [INFO] [stdout] --> src/lib.rs:983:17 [INFO] [stdout] | [INFO] [stdout] 983 | &out.push((&piece, possible_moves)); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the borrow produces a value [INFO] [stdout] | [INFO] [stdout] help: use `let _ = ...` to ignore the resulting value [INFO] [stdout] | [INFO] [stdout] 983 | let _ = &out.push((&piece, possible_moves)); [INFO] [stdout] | +++++++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unused borrow that must be used [INFO] [stdout] --> src/lib.rs:1059:13 [INFO] [stdout] | [INFO] [stdout] 1059 | / &standard_layout.push(Piece { [INFO] [stdout] 1060 | | position: Position { [INFO] [stdout] 1061 | | x: piece_prototype.2, [INFO] [stdout] 1062 | | y: piece_prototype.3, [INFO] [stdout] ... | [INFO] [stdout] 1065 | | piece_type: piece_type.clone() [INFO] [stdout] 1066 | | }); [INFO] [stdout] | |______________^ the borrow produces a value [INFO] [stdout] | [INFO] [stdout] help: use `let _ = ...` to ignore the resulting value [INFO] [stdout] | [INFO] [stdout] 1059 | let _ = &standard_layout.push(Piece { [INFO] [stdout] | +++++++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` can be collapsed into the outer `match` [INFO] [stdout] --> src/lib.rs:674:25 [INFO] [stdout] | [INFO] [stdout] 674 | / if ((self.position.y == 2 && self.color == Color::White) [INFO] [stdout] 675 | | || (self.position.y == 7 && self.color == Color::Black)) [INFO] [stdout] 676 | | && board.get_piece_at(position).is_none() [INFO] [stdout] ... | [INFO] [stdout] 689 | | } [INFO] [stdout] | |_________________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_match [INFO] [stdout] = note: `#[warn(clippy::collapsible_match)]` on by default [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 673 ~ Some(position) [INFO] [stdout] 674 | if ((self.position.y == 2 && self.color == Color::White) [INFO] [stdout] 675 | || (self.position.y == 7 && self.color == Color::Black)) [INFO] [stdout] 676 | && board.get_piece_at(position).is_none() [INFO] [stdout] 677 ~ => { [INFO] [stdout] 678 | if board [INFO] [stdout] ... [INFO] [stdout] 688 | } [INFO] [stdout] 689 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` [INFO] [stdout] --> src/lib.rs:669:17 [INFO] [stdout] | [INFO] [stdout] 669 | / match self [INFO] [stdout] 670 | | .position [INFO] [stdout] 671 | | .position_at_offset(&(0, direction_from_color * 2)) [INFO] [stdout] ... | [INFO] [stdout] 691 | | None => {} [INFO] [stdout] 692 | | } [INFO] [stdout] | |_________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match [INFO] [stdout] = note: `#[warn(clippy::single_match)]` on by default [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 669 ~ if let Some(position) = self [INFO] [stdout] 670 + .position [INFO] [stdout] 671 + .position_at_offset(&(0, direction_from_color * 2)) { [INFO] [stdout] 672 + if ((self.position.y == 2 && self.color == Color::White) [INFO] [stdout] 673 + || (self.position.y == 7 && self.color == Color::Black)) [INFO] [stdout] 674 + && board.get_piece_at(position).is_none() [INFO] [stdout] 675 + { [INFO] [stdout] 676 + if board [INFO] [stdout] 677 + .get_piece_at( [INFO] [stdout] 678 + self.position [INFO] [stdout] 679 + .position_at_offset(&(0, direction_from_color)) [INFO] [stdout] 680 + .unwrap() [INFO] [stdout] 681 + ) [INFO] [stdout] 682 + .is_none() [INFO] [stdout] 683 + { [INFO] [stdout] 684 + possible_directions [INFO] [stdout] 685 + .push(((0, direction_from_color * 2), move_type)); [INFO] [stdout] 686 + } [INFO] [stdout] 687 + } [INFO] [stdout] 688 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/lib.rs:674:25 [INFO] [stdout] | [INFO] [stdout] 674 | / if ((self.position.y == 2 && self.color == Color::White) [INFO] [stdout] 675 | | || (self.position.y == 7 && self.color == Color::Black)) [INFO] [stdout] 676 | | && board.get_piece_at(position).is_none() [INFO] [stdout] ... | [INFO] [stdout] 689 | | } [INFO] [stdout] | |_________________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] = note: `#[warn(clippy::collapsible_if)]` on by default [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 676 ~ && board.get_piece_at(position).is_none() [INFO] [stdout] 677 ~ && board [INFO] [stdout] 678 | .get_piece_at( [INFO] [stdout] ... [INFO] [stdout] 686 | .push(((0, direction_from_color * 2), move_type)); [INFO] [stdout] 687 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` [INFO] [stdout] --> src/lib.rs:695:21 [INFO] [stdout] | [INFO] [stdout] 695 | / match self [INFO] [stdout] 696 | | .position [INFO] [stdout] 697 | | .position_at_offset(&(*side_direction, direction_from_color)) [INFO] [stdout] ... | [INFO] [stdout] 774 | | None => {} [INFO] [stdout] 775 | | } [INFO] [stdout] | |_____________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 695 ~ if let Some(new_position) = self [INFO] [stdout] 696 + .position [INFO] [stdout] 697 + .position_at_offset(&(*side_direction, direction_from_color)) { [INFO] [stdout] 698 + let mut new_position_occupied: bool = false; [INFO] [stdout] 699 + [INFO] [stdout] 700 + //Checks for a piece in the diagonal direction to capture [INFO] [stdout] 701 + for piece in &board.pieces { [INFO] [stdout] 702 + if piece.position == new_position { [INFO] [stdout] 703 + if piece.color == self.color { [INFO] [stdout] 704 + } else { [INFO] [stdout] 705 + possible_directions.push(( [INFO] [stdout] 706 + (*side_direction, direction_from_color), [INFO] [stdout] 707 + move_type, [INFO] [stdout] 708 + )); [INFO] [stdout] 709 + new_position_occupied = true; [INFO] [stdout] 710 + } [INFO] [stdout] 711 + } [INFO] [stdout] 712 + } [INFO] [stdout] 713 + [INFO] [stdout] 714 + //Checks if the piece can capture a pawn en passant [INFO] [stdout] 715 + if new_position_occupied { [INFO] [stdout] 716 + } else { [INFO] [stdout] 717 + match &self.position.position_at_offset(&(*side_direction, 0i8)) { [INFO] [stdout] 718 + Some(side_position) => { [INFO] [stdout] 719 + for piece in &board.pieces { [INFO] [stdout] 720 + if piece.position == side_position.clone() { [INFO] [stdout] 721 + if piece.color == self.color { [INFO] [stdout] 722 + } else { [INFO] [stdout] 723 + if board.play_history.len() == 0 [INFO] [stdout] 724 + || side_position [INFO] [stdout] 725 + .position_at_offset(&( [INFO] [stdout] 726 + 0i8, [INFO] [stdout] 727 + direction_from_color * 2 [INFO] [stdout] 728 + )) [INFO] [stdout] 729 + .is_none() [INFO] [stdout] 730 + { [INFO] [stdout] 731 + continue; [INFO] [stdout] 732 + } [INFO] [stdout] 733 + if board [INFO] [stdout] 734 + .play_history [INFO] [stdout] 735 + .last() [INFO] [stdout] 736 + .unwrap() [INFO] [stdout] 737 + .end_position [INFO] [stdout] 738 + == side_position.clone() [INFO] [stdout] 739 + && board [INFO] [stdout] 740 + .play_history [INFO] [stdout] 741 + .last() [INFO] [stdout] 742 + .unwrap() [INFO] [stdout] 743 + .start_position [INFO] [stdout] 744 + == side_position [INFO] [stdout] 745 + .position_at_offset(&( [INFO] [stdout] 746 + 0i8, [INFO] [stdout] 747 + direction_from_color * 2 [INFO] [stdout] 748 + )) [INFO] [stdout] 749 + .unwrap() [INFO] [stdout] 750 + && board [INFO] [stdout] 751 + .play_history [INFO] [stdout] 752 + .last() [INFO] [stdout] 753 + .unwrap() [INFO] [stdout] 754 + .moved_piece_type [INFO] [stdout] 755 + .is_pawn() [INFO] [stdout] 756 + { [INFO] [stdout] 757 + possible_directions.push(( [INFO] [stdout] 758 + (*side_direction, direction_from_color), [INFO] [stdout] 759 + MoveType::Passant( [INFO] [stdout] 760 + side_position.clone() [INFO] [stdout] 761 + ) [INFO] [stdout] 762 + )); [INFO] [stdout] 763 + } [INFO] [stdout] 764 + } [INFO] [stdout] 765 + } [INFO] [stdout] 766 + } [INFO] [stdout] 767 + } [INFO] [stdout] 768 + None => {} [INFO] [stdout] 769 + } [INFO] [stdout] 770 + } [INFO] [stdout] 771 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` [INFO] [stdout] --> src/lib.rs:719:33 [INFO] [stdout] | [INFO] [stdout] 719 | / ... match &self.position.position_at_offset(&(*side_direction, 0i8)) { [INFO] [stdout] 720 | | ... Some(side_position) => { [INFO] [stdout] 721 | | ... for piece in &board.pieces { [INFO] [stdout] 722 | | ... if piece.position == side_position.clone() { [INFO] [stdout] ... | [INFO] [stdout] 770 | | ... None => {} [INFO] [stdout] 771 | | ... } [INFO] [stdout] | |_______________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 719 ~ if let Some(side_position) = &self.position.position_at_offset(&(*side_direction, 0i8)) { [INFO] [stdout] 720 + for piece in &board.pieces { [INFO] [stdout] 721 + if piece.position == side_position.clone() { [INFO] [stdout] 722 + if piece.color == self.color { [INFO] [stdout] 723 + } else { [INFO] [stdout] 724 + if board.play_history.len() == 0 [INFO] [stdout] 725 + || side_position [INFO] [stdout] 726 + .position_at_offset(&( [INFO] [stdout] 727 + 0i8, [INFO] [stdout] 728 + direction_from_color * 2 [INFO] [stdout] 729 + )) [INFO] [stdout] 730 + .is_none() [INFO] [stdout] 731 + { [INFO] [stdout] 732 + continue; [INFO] [stdout] 733 + } [INFO] [stdout] 734 + if board [INFO] [stdout] 735 + .play_history [INFO] [stdout] 736 + .last() [INFO] [stdout] 737 + .unwrap() [INFO] [stdout] 738 + .end_position [INFO] [stdout] 739 + == side_position.clone() [INFO] [stdout] 740 + && board [INFO] [stdout] 741 + .play_history [INFO] [stdout] 742 + .last() [INFO] [stdout] 743 + .unwrap() [INFO] [stdout] 744 + .start_position [INFO] [stdout] 745 + == side_position [INFO] [stdout] 746 + .position_at_offset(&( [INFO] [stdout] 747 + 0i8, [INFO] [stdout] 748 + direction_from_color * 2 [INFO] [stdout] 749 + )) [INFO] [stdout] 750 + .unwrap() [INFO] [stdout] 751 + && board [INFO] [stdout] 752 + .play_history [INFO] [stdout] 753 + .last() [INFO] [stdout] 754 + .unwrap() [INFO] [stdout] 755 + .moved_piece_type [INFO] [stdout] 756 + .is_pawn() [INFO] [stdout] 757 + { [INFO] [stdout] 758 + possible_directions.push(( [INFO] [stdout] 759 + (*side_direction, direction_from_color), [INFO] [stdout] 760 + MoveType::Passant( [INFO] [stdout] 761 + side_position.clone() [INFO] [stdout] 762 + ) [INFO] [stdout] 763 + )); [INFO] [stdout] 764 + } [INFO] [stdout] 765 + } [INFO] [stdout] 766 + } [INFO] [stdout] 767 + } [INFO] [stdout] 768 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Position` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:722:66 [INFO] [stdout] | [INFO] [stdout] 722 | ... if piece.position == side_position.clone() { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^ help: try dereferencing it: `*side_position` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] = note: `#[warn(clippy::clone_on_copy)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: length comparison to zero [INFO] [stdout] --> src/lib.rs:725:56 [INFO] [stdout] | [INFO] [stdout] 725 | ... if board.play_history.len() == 0 [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `board.play_history.is_empty()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero [INFO] [stdout] = note: `#[warn(clippy::len_zero)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Position` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:740:60 [INFO] [stdout] | [INFO] [stdout] 740 | ... == side_position.clone() [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^ help: try dereferencing it: `*side_position` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Position` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:762:65 [INFO] [stdout] | [INFO] [stdout] 762 | ... side_position.clone() [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^ help: try dereferencing it: `*side_position` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: accessing first element with `self [INFO] [stdout] .offset_and_check_availability( [INFO] [stdout] &[possible_direction.0], [INFO] [stdout] 1i8, [INFO] [stdout] board, [INFO] [stdout] moving, [INFO] [stdout] possible_direction.1 [INFO] [stdout] ).get(0)` [INFO] [stdout] --> src/lib.rs:779:40 [INFO] [stdout] | [INFO] [stdout] 779 | if let Some(val) = self [INFO] [stdout] | ________________________________________^ [INFO] [stdout] 780 | | .offset_and_check_availability( [INFO] [stdout] 781 | | &[possible_direction.0], [INFO] [stdout] 782 | | 1i8, [INFO] [stdout] ... | [INFO] [stdout] 787 | | .get(0) [INFO] [stdout] | |_______________________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#get_first [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 779 ~ if let Some(val) = self [INFO] [stdout] 780 + .offset_and_check_availability( [INFO] [stdout] 781 + &[possible_direction.0], [INFO] [stdout] 782 + 1i8, [INFO] [stdout] 783 + board, [INFO] [stdout] 784 + moving, [INFO] [stdout] 785 + possible_direction.1 [INFO] [stdout] 786 + ).first() [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this boolean expression can be simplified [INFO] [stdout] --> src/lib.rs:922:29 [INFO] [stdout] | [INFO] [stdout] 922 | ... false || move_type == MoveType::Passant(Position::new(1, 1)), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `move_type == MoveType::Passant(Position::new(1, 1))` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#nonminimal_bool [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/lib.rs:932:9 [INFO] [stdout] | [INFO] [stdout] 932 | return possible_moves; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 932 - return possible_moves; [INFO] [stdout] 932 + possible_moves [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Position` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:847:53 [INFO] [stdout] | [INFO] [stdout] 847 | ... king_position = piece.position.clone(); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `piece.position` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Piece` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:851:48 [INFO] [stdout] | [INFO] [stdout] 851 | ... let mut p: Piece = self.clone(); [INFO] [stdout] | ^^^^^^^^^^^^ help: try dereferencing it: `*self` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Position` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:852:44 [INFO] [stdout] | [INFO] [stdout] 852 | ... p.set_position(position_moving_to.clone()); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `position_moving_to` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Position` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:856:63 [INFO] [stdout] | [INFO] [stdout] 856 | ... if piece_on_board.position == self.position.clone() { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `self.position` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/lib.rs:860:58 [INFO] [stdout] | [INFO] [stdout] 860 | ... new_board_state.push(&piece_on_board); [INFO] [stdout] | ^^^^^^^^^^^^^^^ help: change this to: `piece_on_board` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow [INFO] [stdout] = note: `#[warn(clippy::needless_borrow)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Position` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:865:49 [INFO] [stdout] | [INFO] [stdout] 865 | ... king_position = position_moving_to.clone(); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `position_moving_to` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Color` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:876:55 [INFO] [stdout] | [INFO] [stdout] 876 | ... current_turn: board.current_turn.clone(), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `board.current_turn` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you are using an explicit closure for copying elements [INFO] [stdout] --> src/lib.rs:877:55 [INFO] [stdout] | [INFO] [stdout] 877 | ... play_history: board [INFO] [stdout] | _____________________________________^ [INFO] [stdout] 878 | | ... .play_history [INFO] [stdout] 879 | | ... .iter() [INFO] [stdout] 880 | | ... .map(|mov| mov.clone()) [INFO] [stdout] | |_________________________________________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_clone [INFO] [stdout] = note: `#[warn(clippy::map_clone)]` on by default [INFO] [stdout] help: consider calling the dedicated `copied` method [INFO] [stdout] | [INFO] [stdout] 877 ~ play_history: board [INFO] [stdout] 878 + .play_history [INFO] [stdout] 879 + .iter().copied() [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Move` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:880:56 [INFO] [stdout] | [INFO] [stdout] 880 | ... .map(|mov| mov.clone()) [INFO] [stdout] | ^^^^^^^^^^^ help: try dereferencing it: `*mov` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Position` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:883:56 [INFO] [stdout] | [INFO] [stdout] 883 | ... if piece.can_check(king_position.clone(), &board2) { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `king_position` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression borrows a value the compiler would automatically borrow [INFO] [stdout] --> src/lib.rs:891:36 [INFO] [stdout] | [INFO] [stdout] 891 | ... if (&position_moving_to) [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^ help: change this to: `position_moving_to` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression borrows a value the compiler would automatically borrow [INFO] [stdout] --> src/lib.rs:901:28 [INFO] [stdout] | [INFO] [stdout] 901 | if (&position_moving_to) [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^ help: change this to: `position_moving_to` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unnecessary operation [INFO] [stdout] --> src/lib.rs:906:33 [INFO] [stdout] | [INFO] [stdout] 906 | / ... &possible_moves.push(Move::new( [INFO] [stdout] 907 | | ... self.piece_type.clone(), [INFO] [stdout] 908 | | ... self.color.clone(), [INFO] [stdout] 909 | | ... self.position.clone(), [INFO] [stdout] ... | [INFO] [stdout] 912 | | ... move_type [INFO] [stdout] 913 | | ... )); [INFO] [stdout] | |_________________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_operation [INFO] [stdout] = note: `#[warn(clippy::unnecessary_operation)]` on by default [INFO] [stdout] help: statement can be reduced to [INFO] [stdout] | [INFO] [stdout] 906 ~ possible_moves.push(Move::new( [INFO] [stdout] 907 + self.piece_type.clone(), [INFO] [stdout] 908 + self.color.clone(), [INFO] [stdout] 909 + self.position.clone(), [INFO] [stdout] 910 + position_moving_to.clone(), [INFO] [stdout] 911 + true, [INFO] [stdout] 912 + move_type [INFO] [stdout] 913 + )); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `PieceType` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:907:37 [INFO] [stdout] | [INFO] [stdout] 907 | ... self.piece_type.clone(), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `self.piece_type` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Color` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:908:37 [INFO] [stdout] | [INFO] [stdout] 908 | ... self.color.clone(), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `self.color` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Position` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:909:37 [INFO] [stdout] | [INFO] [stdout] 909 | ... self.position.clone(), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `self.position` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Position` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:910:37 [INFO] [stdout] | [INFO] [stdout] 910 | ... position_moving_to.clone(), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `position_moving_to` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unnecessary operation [INFO] [stdout] --> src/lib.rs:917:25 [INFO] [stdout] | [INFO] [stdout] 917 | / &possible_moves.push(Move::new( [INFO] [stdout] 918 | | self.piece_type.clone(), [INFO] [stdout] 919 | | self.color.clone(), [INFO] [stdout] 920 | | self.position.clone(), [INFO] [stdout] ... | [INFO] [stdout] 923 | | move_type [INFO] [stdout] 924 | | )); [INFO] [stdout] | |___________________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_operation [INFO] [stdout] help: statement can be reduced to [INFO] [stdout] | [INFO] [stdout] 917 ~ possible_moves.push(Move::new( [INFO] [stdout] 918 + self.piece_type.clone(), [INFO] [stdout] 919 + self.color.clone(), [INFO] [stdout] 920 + self.position.clone(), [INFO] [stdout] 921 + position_moving_to.clone(), [INFO] [stdout] 922 + false || move_type == MoveType::Passant(Position::new(1, 1)), [INFO] [stdout] 923 + move_type [INFO] [stdout] 924 + )); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `PieceType` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:918:29 [INFO] [stdout] | [INFO] [stdout] 918 | ... self.piece_type.clone(), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `self.piece_type` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Color` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:919:29 [INFO] [stdout] | [INFO] [stdout] 919 | ... self.color.clone(), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `self.color` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Position` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:920:29 [INFO] [stdout] | [INFO] [stdout] 920 | ... self.position.clone(), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `self.position` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Position` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:921:29 [INFO] [stdout] | [INFO] [stdout] 921 | ... position_moving_to.clone(), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `position_moving_to` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/lib.rs:942:9 [INFO] [stdout] | [INFO] [stdout] 942 | return false; [INFO] [stdout] | ^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 942 - return false; [INFO] [stdout] 942 + false [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Position` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:950:9 [INFO] [stdout] | [INFO] [stdout] 950 | self.position.clone() [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `self.position` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `PieceType` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:954:9 [INFO] [stdout] | [INFO] [stdout] 954 | self.piece_type.clone() [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `self.piece_type` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Color` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:958:9 [INFO] [stdout] | [INFO] [stdout] 958 | self.color.clone() [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `self.color` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/lib.rs:986:9 [INFO] [stdout] | [INFO] [stdout] 986 | return out; [INFO] [stdout] | ^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 986 - return out; [INFO] [stdout] 986 + out [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/lib.rs:982:74 [INFO] [stdout] | [INFO] [stdout] 982 | let possible_moves: Vec = piece.get_possible_moves(&self, true); [INFO] [stdout] | ^^^^^ help: change this to: `self` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unnecessary operation [INFO] [stdout] --> src/lib.rs:983:17 [INFO] [stdout] | [INFO] [stdout] 983 | &out.push((&piece, possible_moves)); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: statement can be reduced to: `out.push((&piece, possible_moves));` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_operation [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/lib.rs:983:28 [INFO] [stdout] | [INFO] [stdout] 983 | &out.push((&piece, possible_moves)); [INFO] [stdout] | ^^^^^^ help: change this to: `piece` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/lib.rs:991:9 [INFO] [stdout] | [INFO] [stdout] 991 | / return self [INFO] [stdout] 992 | | .get_available_moves(self.current_turn) [INFO] [stdout] 993 | | .iter() [INFO] [stdout] 994 | | .map(|t| { [INFO] [stdout] ... | [INFO] [stdout] 1006 | | }) [INFO] [stdout] 1007 | | .collect(); [INFO] [stdout] | |______________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 991 ~ self [INFO] [stdout] 992 + .get_available_moves(self.current_turn) [INFO] [stdout] 993 + .iter() [INFO] [stdout] 994 + .map(|t| { [INFO] [stdout] 995 + ( [INFO] [stdout] 996 + t.0, [INFO] [stdout] 997 + t.1.iter() [INFO] [stdout] 998 + .map(|mov| { [INFO] [stdout] 999 + ( [INFO] [stdout] 1000 + mov.end_position.clone(), [INFO] [stdout] 1001 + mov.move_type == MoveType::Promotion [INFO] [stdout] 1002 + ) [INFO] [stdout] 1003 + }) [INFO] [stdout] 1004 + .collect() [INFO] [stdout] 1005 + ) [INFO] [stdout] 1006 + }) [INFO] [stdout] 1007 ~ .collect() [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Position` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:1000:33 [INFO] [stdout] | [INFO] [stdout] 1000 | ... mov.end_position.clone(), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `mov.end_position` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/lib.rs:1068:9 [INFO] [stdout] | [INFO] [stdout] 1068 | return standard_layout; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 1068 - return standard_layout; [INFO] [stdout] 1068 + standard_layout [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded late initialization [INFO] [stdout] --> src/lib.rs:1047:13 [INFO] [stdout] | [INFO] [stdout] 1047 | let piece_type: PieceType; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_late_init [INFO] [stdout] = note: `#[warn(clippy::needless_late_init)]` on by default [INFO] [stdout] help: move the declaration `piece_type` here and remove the assignments from the `match` arms [INFO] [stdout] | [INFO] [stdout] 1047 ~ [INFO] [stdout] 1048 | [INFO] [stdout] 1049 ~ let piece_type: PieceType = match piece_prototype.1 { [INFO] [stdout] 1050 ~ 'r' => PieceType::Rook, [INFO] [stdout] 1051 ~ 'n' => PieceType::Knight, [INFO] [stdout] 1052 ~ 'b' => PieceType::Bishop, [INFO] [stdout] 1053 ~ 'q' => PieceType::Queen, [INFO] [stdout] 1054 ~ 'k' => PieceType::King, [INFO] [stdout] 1055 ~ 'p' => PieceType::Pawn, [INFO] [stdout] 1056 | _ => unreachable!("Char {} does not match a piece type", piece_prototype.1) [INFO] [stdout] 1057 ~ }; [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unnecessary operation [INFO] [stdout] --> src/lib.rs:1059:13 [INFO] [stdout] | [INFO] [stdout] 1059 | / &standard_layout.push(Piece { [INFO] [stdout] 1060 | | position: Position { [INFO] [stdout] 1061 | | x: piece_prototype.2, [INFO] [stdout] 1062 | | y: piece_prototype.3, [INFO] [stdout] ... | [INFO] [stdout] 1065 | | piece_type: piece_type.clone() [INFO] [stdout] 1066 | | }); [INFO] [stdout] | |_______________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_operation [INFO] [stdout] help: statement can be reduced to [INFO] [stdout] | [INFO] [stdout] 1059 ~ standard_layout.push(Piece { [INFO] [stdout] 1060 + position: Position { [INFO] [stdout] 1061 + x: piece_prototype.2, [INFO] [stdout] 1062 + y: piece_prototype.3, [INFO] [stdout] 1063 + }, [INFO] [stdout] 1064 + color: piece_prototype.0, [INFO] [stdout] 1065 + piece_type: piece_type.clone() [INFO] [stdout] 1066 + }); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `PieceType` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:1065:29 [INFO] [stdout] | [INFO] [stdout] 1065 | piece_type: piece_type.clone() [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `piece_type` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/lib.rs:1077:9 [INFO] [stdout] | [INFO] [stdout] 1077 | return None; [INFO] [stdout] | ^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 1077 - return None; [INFO] [stdout] 1077 + None [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/lib.rs:1074:29 [INFO] [stdout] | [INFO] [stdout] 1074 | return Some(&piece); [INFO] [stdout] | ^^^^^^ help: change this to: `piece` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/lib.rs:1086:9 [INFO] [stdout] | [INFO] [stdout] 1086 | return None; [INFO] [stdout] | ^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 1086 - return None; [INFO] [stdout] 1086 + None [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of `Iterator::find` [INFO] [stdout] --> src/lib.rs:1081:9 [INFO] [stdout] | [INFO] [stdout] 1081 | / for piece in &mut self.pieces { [INFO] [stdout] 1082 | | if piece.position == position { [INFO] [stdout] 1083 | | return Some(piece); [INFO] [stdout] ... | [INFO] [stdout] 1086 | | return None; [INFO] [stdout] | |____________________^ help: replace with an iterator: `self.pieces.iter_mut().find(|piece| piece.position == position).map(|v| v as _)` [INFO] [stdout] | [INFO] [stdout] = note: you may need to dereference some variables [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_find [INFO] [stdout] = note: `#[warn(clippy::manual_find)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Color` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:1097:44 [INFO] [stdout] | [INFO] [stdout] 1097 | Some(piece) => { piece_color = self.get_piece_at(piece_position).unwrap().color.clone(); } [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `self.get_piece_at(piece_position).unwrap().color` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Color` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:1109:56 [INFO] [stdout] | [INFO] [stdout] 1109 | for available_move in self.get_available_moves(piece_color.clone()) { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `piece_color` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Move` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:1112:37 [INFO] [stdout] | [INFO] [stdout] 1112 | move_vec_clone.push(mov.clone()); [INFO] [stdout] | ^^^^^^^^^^^ help: try removing the `clone` call: `mov` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stderr] Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.57s [INFO] [stdout] warning: using `clone` on type `Piece` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:1114:41 [INFO] [stdout] | [INFO] [stdout] 1114 | available_moves_clone.push((available_move.0.clone(), move_vec_clone)); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try dereferencing it: `*available_move.0` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Position` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:1130:55 [INFO] [stdout] | [INFO] [stdout] 1130 | ... self.get_piece_at_mut(piece_move.0.position.clone()) [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `piece_move.0.position` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Position` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:1132:51 [INFO] [stdout] | [INFO] [stdout] 1132 | ... .set_position(possible_move.end_position.clone()); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `possible_move.end_position` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Position` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:1136:55 [INFO] [stdout] | [INFO] [stdout] 1136 | ... self.get_piece_at_mut(piece_move.0.position.clone()) [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `piece_move.0.position` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Position` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:1138:51 [INFO] [stdout] | [INFO] [stdout] 1138 | ... .set_position(possible_move.end_position.clone()); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `possible_move.end_position` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Position` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:1141:55 [INFO] [stdout] | [INFO] [stdout] 1141 | ... self.get_piece_at_mut(piece_move.0.position.clone()) [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `piece_move.0.position` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Position` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:1143:51 [INFO] [stdout] | [INFO] [stdout] 1143 | ... .set_position(possible_move.end_position.clone()); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `possible_move.end_position` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `PieceType` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:1166:51 [INFO] [stdout] | [INFO] [stdout] 1166 | ... .piece_type = promote_to.unwrap().clone(); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `promote_to.unwrap()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Position` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:1164:55 [INFO] [stdout] | [INFO] [stdout] 1164 | ... self.get_piece_at_mut(piece_move.0.position.clone()) [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `piece_move.0.position` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Position` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:1167:55 [INFO] [stdout] | [INFO] [stdout] 1167 | ... self.get_piece_at_mut(piece_move.0.position.clone()) [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `piece_move.0.position` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Position` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:1169:51 [INFO] [stdout] | [INFO] [stdout] 1169 | ... .set_position(possible_move.end_position.clone()); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `possible_move.end_position` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Move` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:1172:48 [INFO] [stdout] | [INFO] [stdout] 1172 | self.play_history.push(possible_move.clone()); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^ help: try dereferencing it: `*possible_move` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you are using an explicit closure for copying elements [INFO] [stdout] --> src/lib.rs:1191:23 [INFO] [stdout] | [INFO] [stdout] 1191 | self.pieces = self [INFO] [stdout] | _______________________^ [INFO] [stdout] 1192 | | .pieces [INFO] [stdout] 1193 | | .iter() [INFO] [stdout] 1194 | | .filter(|piece| !(piece.position == position)) [INFO] [stdout] 1195 | | .map(|piece| *piece) [INFO] [stdout] | |________________________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_clone [INFO] [stdout] help: consider calling the dedicated `copied` method [INFO] [stdout] | [INFO] [stdout] 1191 ~ self.pieces = self [INFO] [stdout] 1192 + .pieces [INFO] [stdout] 1193 + .iter() [INFO] [stdout] 1194 + .filter(|piece| !(piece.position == position)).copied() [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Position` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:1202:22 [INFO] [stdout] | [INFO] [stdout] 1202 | out.push(piece.position.clone()); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `piece.position` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: accessing first element with `strings.get(0)` [INFO] [stdout] --> src/lib.rs:1216:19 [INFO] [stdout] | [INFO] [stdout] 1216 | (*strings.get(0).unwrap() as u32 - 96) as u8, [INFO] [stdout] | ^^^^^^^^^^^^^^ help: try: `strings.first()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#get_first [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/lib.rs:1285:17 [INFO] [stdout] | [INFO] [stdout] 1285 | return GameState::Checkmate(self.current_turn.invert()); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 1285 - return GameState::Checkmate(self.current_turn.invert()); [INFO] [stdout] 1285 + GameState::Checkmate(self.current_turn.invert()) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/lib.rs:1287:17 [INFO] [stdout] | [INFO] [stdout] 1287 | return GameState::Check(self.current_turn.invert()); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 1287 - return GameState::Check(self.current_turn.invert()); [INFO] [stdout] 1287 + GameState::Check(self.current_turn.invert()) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/lib.rs:1296:17 [INFO] [stdout] | [INFO] [stdout] 1296 | return GameState::Draw; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 1296 - return GameState::Draw; [INFO] [stdout] 1296 + GameState::Draw [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/lib.rs:1298:17 [INFO] [stdout] | [INFO] [stdout] 1298 | return GameState::Normal; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 1298 - return GameState::Normal; [INFO] [stdout] 1298 + GameState::Normal [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Color` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:1249:65 [INFO] [stdout] | [INFO] [stdout] 1249 | let available_moves_opponent = self.get_available_moves(self.current_turn.invert().clone()); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `self.current_turn.invert()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Color` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:1250:56 [INFO] [stdout] | [INFO] [stdout] 1250 | let available_moves = self.get_available_moves(self.current_turn.clone()); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `self.current_turn` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Color` which implements the `Copy` trait [INFO] [stdout] --> src/lib.rs:1255:20 [INFO] [stdout] | [INFO] [stdout] 1255 | color: self.current_turn.clone() [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `self.current_turn` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `.fold` can be written more succinctly using another method [INFO] [stdout] --> src/lib.rs:1282:18 [INFO] [stdout] | [INFO] [stdout] 1282 | .fold(0, |acc, val| acc + val) [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `sum::()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_fold [INFO] [stdout] = note: `#[warn(clippy::unnecessary_fold)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `.fold` can be written more succinctly using another method [INFO] [stdout] --> src/lib.rs:1293:18 [INFO] [stdout] | [INFO] [stdout] 1293 | .fold(0, |acc, val| acc + val) [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `sum::()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_fold [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unnecessary map of the identity function [INFO] [stdout] --> src/lib.rs:1304:27 [INFO] [stdout] | [INFO] [stdout] 1304 | self.pieces.iter().map(|piece| piece).collect() [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^ help: remove the call to `map` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_identity [INFO] [stdout] = note: `#[warn(clippy::map_identity)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `.clone()` on a double reference, which returns `&Piece` instead of cloning the inner type [INFO] [stdout] --> src/lib.rs:874:64 [INFO] [stdout] | [INFO] [stdout] 874 | ... .map(|piece| *piece.clone()) [INFO] [stdout] | ^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: `#[warn(suspicious_double_ref_op)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unused borrow that must be used [INFO] [stdout] --> src/lib.rs:906:33 [INFO] [stdout] | [INFO] [stdout] 906 | / ... &possible_moves.push(Move::new( [INFO] [stdout] 907 | | ... self.piece_type.clone(), [INFO] [stdout] 908 | | ... self.color.clone(), [INFO] [stdout] 909 | | ... self.position.clone(), [INFO] [stdout] ... | [INFO] [stdout] 912 | | ... move_type [INFO] [stdout] 913 | | ... )); [INFO] [stdout] | |________________________^ the borrow produces a value [INFO] [stdout] | [INFO] [stdout] = note: `#[warn(unused_must_use)]` (part of `#[warn(unused)]`) on by default [INFO] [stdout] help: use `let _ = ...` to ignore the resulting value [INFO] [stdout] | [INFO] [stdout] 906 | let _ = &possible_moves.push(Move::new( [INFO] [stdout] | +++++++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unused borrow that must be used [INFO] [stdout] --> src/lib.rs:917:25 [INFO] [stdout] | [INFO] [stdout] 917 | / &possible_moves.push(Move::new( [INFO] [stdout] 918 | | self.piece_type.clone(), [INFO] [stdout] 919 | | self.color.clone(), [INFO] [stdout] 920 | | self.position.clone(), [INFO] [stdout] ... | [INFO] [stdout] 923 | | move_type [INFO] [stdout] 924 | | )); [INFO] [stdout] | |__________________________^ the borrow produces a value [INFO] [stdout] | [INFO] [stdout] help: use `let _ = ...` to ignore the resulting value [INFO] [stdout] | [INFO] [stdout] 917 | let _ = &possible_moves.push(Move::new( [INFO] [stdout] | +++++++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unused borrow that must be used [INFO] [stdout] --> src/lib.rs:983:17 [INFO] [stdout] | [INFO] [stdout] 983 | &out.push((&piece, possible_moves)); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the borrow produces a value [INFO] [stdout] | [INFO] [stdout] help: use `let _ = ...` to ignore the resulting value [INFO] [stdout] | [INFO] [stdout] 983 | let _ = &out.push((&piece, possible_moves)); [INFO] [stdout] | +++++++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unused borrow that must be used [INFO] [stdout] --> src/lib.rs:1059:13 [INFO] [stdout] | [INFO] [stdout] 1059 | / &standard_layout.push(Piece { [INFO] [stdout] 1060 | | position: Position { [INFO] [stdout] 1061 | | x: piece_prototype.2, [INFO] [stdout] 1062 | | y: piece_prototype.3, [INFO] [stdout] ... | [INFO] [stdout] 1065 | | piece_type: piece_type.clone() [INFO] [stdout] 1066 | | }); [INFO] [stdout] | |______________^ the borrow produces a value [INFO] [stdout] | [INFO] [stdout] help: use `let _ = ...` to ignore the resulting value [INFO] [stdout] | [INFO] [stdout] 1059 | let _ = &standard_layout.push(Piece { [INFO] [stdout] | +++++++ [INFO] [stdout] [INFO] [stdout] [INFO] running `Command { std: "docker" "inspect" "9afb728af1a8103fdf74a0fe6885fd699d1f2b23968cde179d505612489cf9f2", kill_on_drop: false }` [INFO] running `Command { std: "docker" "rm" "-f" "9afb728af1a8103fdf74a0fe6885fd699d1f2b23968cde179d505612489cf9f2", kill_on_drop: false }` [INFO] [stdout] 9afb728af1a8103fdf74a0fe6885fd699d1f2b23968cde179d505612489cf9f2