[INFO] cloning repository https://github.com/local-minimum/chess-br [INFO] running `Command { std: "git" "-c" "credential.helper=" "-c" "credential.helper=/workspace/cargo-home/bin/git-credential-null" "clone" "--bare" "https://github.com/local-minimum/chess-br" "/workspace/cache/git-repos/https%3A%2F%2Fgithub.com%2Flocal-minimum%2Fchess-br", kill_on_drop: false }` [INFO] [stderr] Cloning into bare repository '/workspace/cache/git-repos/https%3A%2F%2Fgithub.com%2Flocal-minimum%2Fchess-br'... [INFO] running `Command { std: "git" "rev-parse" "HEAD", kill_on_drop: false }` [INFO] [stdout] 64bf0517bf1e41a96549320365673de14451625f [INFO] linting local-minimum/chess-br against nightly for clippy-nonminimal_bool-denied [INFO] running `Command { std: "git" "clone" "/workspace/cache/git-repos/https%3A%2F%2Fgithub.com%2Flocal-minimum%2Fchess-br" "/workspace/builds/worker-4-tc1/source", kill_on_drop: false }` [INFO] [stderr] Cloning into '/workspace/builds/worker-4-tc1/source'... [INFO] [stderr] done. [INFO] started tweaking git repo https://github.com/local-minimum/chess-br [INFO] finished tweaking git repo https://github.com/local-minimum/chess-br [INFO] tweaked toml for git repo https://github.com/local-minimum/chess-br written to /workspace/builds/worker-4-tc1/source/Cargo.toml [INFO] validating manifest of git repo https://github.com/local-minimum/chess-br 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/local-minimum/chess-br 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-4-tc1/target:/opt/rustwide/target:rw,Z" "-v" "/var/lib/crater-agent-workspace/builds/worker-4-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] 3e3a3ef00e86a15bef971347ef0d687671dbe6c10c2f21f9c9e8853dbbdfb3a5 [INFO] running `Command { std: "docker" "start" "-a" "3e3a3ef00e86a15bef971347ef0d687671dbe6c10c2f21f9c9e8853dbbdfb3a5", kill_on_drop: false }` [INFO] running `Command { std: "docker" "inspect" "3e3a3ef00e86a15bef971347ef0d687671dbe6c10c2f21f9c9e8853dbbdfb3a5", kill_on_drop: false }` [INFO] running `Command { std: "docker" "rm" "-f" "3e3a3ef00e86a15bef971347ef0d687671dbe6c10c2f21f9c9e8853dbbdfb3a5", kill_on_drop: false }` [INFO] [stdout] 3e3a3ef00e86a15bef971347ef0d687671dbe6c10c2f21f9c9e8853dbbdfb3a5 [INFO] running `Command { std: "docker" "create" "-v" "/var/lib/crater-agent-workspace/builds/worker-4-tc1/target:/opt/rustwide/target:rw,Z" "-v" "/var/lib/crater-agent-workspace/builds/worker-4-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] c467cd616d8c8d90bfc32bb102d466e3745f32af64b71d950286c8bbd9596ac6 [INFO] running `Command { std: "docker" "start" "-a" "c467cd616d8c8d90bfc32bb102d466e3745f32af64b71d950286c8bbd9596ac6", kill_on_drop: false }` [INFO] [stderr] Compiling libc v0.2.73 [INFO] [stderr] Checking ppv-lite86 v0.2.8 [INFO] [stderr] Checking getrandom v0.1.14 [INFO] [stderr] Checking rand_core v0.5.1 [INFO] [stderr] Checking rand_chacha v0.2.2 [INFO] [stderr] Checking rand v0.7.3 [INFO] [stderr] Checking chess_br v0.1.0 (/opt/rustwide/workdir) [INFO] [stdout] warning: constants have by default a `'static` lifetime [INFO] [stdout] --> src/world/player.rs:92:23 [INFO] [stdout] | [INFO] [stdout] 92 | const GAME_NAME_ADJ: &'static [&'static str] = &[ [INFO] [stdout] | -^^^^^^^--------------- help: consider removing `'static`: `&[&'static str]` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_static_lifetimes [INFO] [stdout] = note: `#[warn(clippy::redundant_static_lifetimes)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: constants have by default a `'static` lifetime [INFO] [stdout] --> src/world/player.rs:92:33 [INFO] [stdout] | [INFO] [stdout] 92 | const GAME_NAME_ADJ: &'static [&'static str] = &[ [INFO] [stdout] | -^^^^^^^---- help: consider removing `'static`: `&str` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_static_lifetimes [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: constants have by default a `'static` lifetime [INFO] [stdout] --> src/world/player.rs:100:24 [INFO] [stdout] | [INFO] [stdout] 100 | const GAME_NAME_NOUN: &'static [&'static str] = &[ [INFO] [stdout] | -^^^^^^^--------------- help: consider removing `'static`: `&[&'static str]` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_static_lifetimes [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: constants have by default a `'static` lifetime [INFO] [stdout] --> src/world/player.rs:100:34 [INFO] [stdout] | [INFO] [stdout] 100 | const GAME_NAME_NOUN: &'static [&'static str] = &[ [INFO] [stdout] | -^^^^^^^---- help: consider removing `'static`: `&str` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_static_lifetimes [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: constants have by default a `'static` lifetime [INFO] [stdout] --> src/world/player.rs:92:23 [INFO] [stdout] | [INFO] [stdout] 92 | const GAME_NAME_ADJ: &'static [&'static str] = &[ [INFO] [stdout] | -^^^^^^^--------------- help: consider removing `'static`: `&[&'static str]` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_static_lifetimes [INFO] [stdout] = note: `#[warn(clippy::redundant_static_lifetimes)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: constants have by default a `'static` lifetime [INFO] [stdout] --> src/world/player.rs:92:33 [INFO] [stdout] | [INFO] [stdout] 92 | const GAME_NAME_ADJ: &'static [&'static str] = &[ [INFO] [stdout] | -^^^^^^^---- help: consider removing `'static`: `&str` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_static_lifetimes [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: constants have by default a `'static` lifetime [INFO] [stdout] --> src/world/player.rs:100:24 [INFO] [stdout] | [INFO] [stdout] 100 | const GAME_NAME_NOUN: &'static [&'static str] = &[ [INFO] [stdout] | -^^^^^^^--------------- help: consider removing `'static`: `&[&'static str]` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_static_lifetimes [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: constants have by default a `'static` lifetime [INFO] [stdout] --> src/world/player.rs:100:34 [INFO] [stdout] | [INFO] [stdout] 100 | const GAME_NAME_NOUN: &'static [&'static str] = &[ [INFO] [stdout] | -^^^^^^^---- help: consider removing `'static`: `&str` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_static_lifetimes [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do [INFO] [stdout] --> src/world/board.rs:19:33 [INFO] [stdout] | [INFO] [stdout] 19 | fn apply(&mut self, coords: &Vec, value: u16); [INFO] [stdout] | ^^^^^^^^^^^ help: change this to: `&[Coord]` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg [INFO] [stdout] = note: `#[warn(clippy::ptr_arg)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `x` is only used to index `self` [INFO] [stdout] --> src/world/board.rs:60:18 [INFO] [stdout] | [INFO] [stdout] 60 | for x in c1.x..c2.x { [INFO] [stdout] | ^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] = note: `#[warn(clippy::needless_range_loop)]` on by default [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 60 - for x in c1.x..c2.x { [INFO] [stdout] 60 + for in self.iter_mut().take(c2.x).skip(c1.x) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `y` is only used to index `self` [INFO] [stdout] --> src/world/board.rs:61:22 [INFO] [stdout] | [INFO] [stdout] 61 | for y in c1.y..c2.y { [INFO] [stdout] | ^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 61 - for y in c1.y..c2.y { [INFO] [stdout] 61 + for in self.iter_mut().take(c2.y).skip(c1.y) { [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/world/board.rs:82:13 [INFO] [stdout] | [INFO] [stdout] 82 | / match row_max { [INFO] [stdout] 83 | | Some(i) => m = m.max(*i), [INFO] [stdout] 84 | | _ => (), [INFO] [stdout] 85 | | } [INFO] [stdout] | |_____________^ help: try: `if let Some(i) = row_max { m = m.max(*i) }` [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] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `x` is used to index `self` [INFO] [stdout] --> src/world/board.rs:106:18 [INFO] [stdout] | [INFO] [stdout] 106 | for x in 0..shape.x { [INFO] [stdout] | ^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator and enumerate() [INFO] [stdout] | [INFO] [stdout] 106 - for x in 0..shape.x { [INFO] [stdout] 106 + for (x, ) in self.iter().enumerate().take(shape.x) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `y` is used to index `self` [INFO] [stdout] --> src/world/board.rs:107:22 [INFO] [stdout] | [INFO] [stdout] 107 | for y in 0..shape.y { [INFO] [stdout] | ^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator and enumerate() [INFO] [stdout] | [INFO] [stdout] 107 - for y in 0..shape.y { [INFO] [stdout] 107 + for (y, ) in self.iter().enumerate().take(shape.y) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `y` is only used to index `self` [INFO] [stdout] --> src/world/board.rs:232:18 [INFO] [stdout] | [INFO] [stdout] 232 | for y in cmp::max(0, lower_left.y)..cmp::min(upper_right.y + 1, shape.y) { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 232 - for y in cmp::max(0, lower_left.y)..cmp::min(upper_right.y + 1, shape.y) { [INFO] [stdout] 232 + for in self.iter().take(cmp::min(upper_right.y + 1, shape.y)).skip(cmp::max(0, lower_left.y)) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `x` is only used to index `self` [INFO] [stdout] --> src/world/board.rs:233:22 [INFO] [stdout] | [INFO] [stdout] 233 | for x in cmp::max(0, lower_left.x)..cmp::min(upper_right.x + 1, shape.x) { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 233 - for x in cmp::max(0, lower_left.x)..cmp::min(upper_right.x + 1, shape.x) { [INFO] [stdout] 233 + for in self.iter().take(cmp::min(upper_right.x + 1, shape.x)).skip(cmp::max(0, lower_left.x)) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/world/builders.rs:16:5 [INFO] [stdout] | [INFO] [stdout] 16 | return areas [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] 16 - return areas [INFO] [stdout] 16 + areas [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: casting integer literal to `u16` is unnecessary [INFO] [stdout] --> src/world/builders.rs:10:26 [INFO] [stdout] | [INFO] [stdout] 10 | let mut areas = vec![1 as u16; zones.into()]; [INFO] [stdout] | ^^^^^^^^ help: try: `1_u16` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast [INFO] [stdout] = note: `#[warn(clippy::unnecessary_cast)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` can be collapsed into the outer `match` [INFO] [stdout] --> src/world/builders.rs:35:22 [INFO] [stdout] | [INFO] [stdout] 35 | 0 => if c1.x > 1 {c1 = c1.translate_direction(Direction::West)}, [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] 35 - 0 => if c1.x > 1 {c1 = c1.translate_direction(Direction::West)}, [INFO] [stdout] 35 + 0f c1.x > 1 => {c1 = c1.translate_direction(Direction::West), [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` can be collapsed into the outer `match` [INFO] [stdout] --> src/world/builders.rs:36:22 [INFO] [stdout] | [INFO] [stdout] 36 | 1 => if c2.x + 1 < shape.x {c2 = c2.translate_direction(Direction::East)}, [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] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 36 - 1 => if c2.x + 1 < shape.x {c2 = c2.translate_direction(Direction::East)}, [INFO] [stdout] 36 + 1f c2.x + 1 < shape.x => {c2 = c2.translate_direction(Direction::East), [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` can be collapsed into the outer `match` [INFO] [stdout] --> src/world/builders.rs:37:22 [INFO] [stdout] | [INFO] [stdout] 37 | 2 => if c1.y > 1 {c1 = c1.translate_direction(Direction::North)}, [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] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 37 - 2 => if c1.y > 1 {c1 = c1.translate_direction(Direction::North)}, [INFO] [stdout] 37 + 2f c1.y > 1 => {c1 = c1.translate_direction(Direction::North), [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` can be collapsed into the outer `match` [INFO] [stdout] --> src/world/builders.rs:38:22 [INFO] [stdout] | [INFO] [stdout] 38 | 3 => if c2.y + 1 < shape.y {c2 = c2.translate_direction(Direction::South)}, [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] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 38 - 3 => if c2.y + 1 < shape.y {c2 = c2.translate_direction(Direction::South)}, [INFO] [stdout] 38 + 3f c2.y + 1 < shape.y => {c2 = c2.translate_direction(Direction::South), [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/world/builders.rs:67:53 [INFO] [stdout] | [INFO] [stdout] 67 | let this_zone = zones.coords_when(zone, &fog, 0); [INFO] [stdout] | ^^^^ help: change this to: `fog` [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: length comparison to zero [INFO] [stdout] --> src/world/builders.rs:68:16 [INFO] [stdout] | [INFO] [stdout] 68 | if this_zone.len() == 0 { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `this_zone.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 `Direction` which implements the `Copy` trait [INFO] [stdout] --> src/world/builders.rs:102:23 [INFO] [stdout] | [INFO] [stdout] 102 | let mut dir = orig_dir.clone(); [INFO] [stdout] | ^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `orig_dir` [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: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` [INFO] [stdout] --> src/world/builders.rs:106:9 [INFO] [stdout] | [INFO] [stdout] 106 | / match path.last() { [INFO] [stdout] 107 | | Some(pos) => { [INFO] [stdout] 108 | | let next_pos = pos.translate_direction(dir); [INFO] [stdout] 109 | | if !next_pos.is_inside(&shape) { break; } [INFO] [stdout] ... | [INFO] [stdout] 113 | | None => (), [INFO] [stdout] 114 | | } [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] 106 ~ if let Some(pos) = path.last() { [INFO] [stdout] 107 + let next_pos = pos.translate_direction(dir); [INFO] [stdout] 108 + if !next_pos.is_inside(&shape) { break; } [INFO] [stdout] 109 + path.push(next_pos); [INFO] [stdout] 110 + if next_pos.x == 0 || next_pos.y == 0 { break; } [INFO] [stdout] 111 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do [INFO] [stdout] --> src/world/display.rs:18:27 [INFO] [stdout] | [INFO] [stdout] 18 | pub fn print_board(board: &Vec>) { [INFO] [stdout] | ^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg [INFO] [stdout] help: change this to [INFO] [stdout] | [INFO] [stdout] 18 - pub fn print_board(board: &Vec>) { [INFO] [stdout] 18 + pub fn print_board(board: &[Vec]) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: empty string literal in `println!` [INFO] [stdout] --> src/world/display.rs:19:5 [INFO] [stdout] | [INFO] [stdout] 19 | println!(""); [INFO] [stdout] | ^^^^^^^^^--^ [INFO] [stdout] | | [INFO] [stdout] | help: remove the empty string [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#println_empty_string [INFO] [stdout] = note: `#[warn(clippy::println_empty_string)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `.into_iter()` call is equivalent to `.iter()` and will not consume the `Vec` [INFO] [stdout] --> src/world/display.rs:22:14 [INFO] [stdout] | [INFO] [stdout] 22 | .into_iter() [INFO] [stdout] | ^^^^^^^^^ help: call directly: `iter` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#into_iter_on_ref [INFO] [stdout] = note: `#[warn(clippy::into_iter_on_ref)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do [INFO] [stdout] --> src/world/display.rs:30:32 [INFO] [stdout] | [INFO] [stdout] 30 | pub fn print_board_pair(first: &Vec>, second: &Vec>) { [INFO] [stdout] | ^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg [INFO] [stdout] help: change this to [INFO] [stdout] | [INFO] [stdout] 30 - pub fn print_board_pair(first: &Vec>, second: &Vec>) { [INFO] [stdout] 30 + pub fn print_board_pair(first: &[Vec], second: &Vec>) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do [INFO] [stdout] --> src/world/display.rs:30:56 [INFO] [stdout] | [INFO] [stdout] 30 | pub fn print_board_pair(first: &Vec>, second: &Vec>) { [INFO] [stdout] | ^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg [INFO] [stdout] help: change this to [INFO] [stdout] | [INFO] [stdout] 30 - pub fn print_board_pair(first: &Vec>, second: &Vec>) { [INFO] [stdout] 30 + pub fn print_board_pair(first: &Vec>, second: &[Vec]) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `.into_iter()` call is equivalent to `.iter()` and will not consume the `Vec` [INFO] [stdout] --> src/world/display.rs:33:14 [INFO] [stdout] | [INFO] [stdout] 33 | .into_iter() [INFO] [stdout] | ^^^^^^^^^ help: call directly: `iter` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#into_iter_on_ref [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `.into_iter()` call is equivalent to `.iter()` and will not consume the `Vec` [INFO] [stdout] --> src/world/display.rs:37:14 [INFO] [stdout] | [INFO] [stdout] 37 | .into_iter() [INFO] [stdout] | ^^^^^^^^^ help: call directly: `iter` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#into_iter_on_ref [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: casting integer literal to `u16` is unnecessary [INFO] [stdout] --> src/world/display.rs:49:29 [INFO] [stdout] | [INFO] [stdout] 49 | let mut lvl = vec![vec![0 as u16; shape.x]; shape.y]; [INFO] [stdout] | ^^^^^^^^ help: try: `0_u16` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast [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/world/display.rs:51:9 [INFO] [stdout] | [INFO] [stdout] 51 | / match player.state { [INFO] [stdout] 52 | | PlayerState::Falling(h, coord) => { [INFO] [stdout] 53 | | if h != height { continue; } [INFO] [stdout] 54 | | lvl[coord.y][coord.x] = player.player_id; [INFO] [stdout] 55 | | }, [INFO] [stdout] 56 | | _ => (), [INFO] [stdout] 57 | | } [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] 51 ~ if let PlayerState::Falling(h, coord) = player.state { [INFO] [stdout] 52 + if h != height { continue; } [INFO] [stdout] 53 + lvl[coord.y][coord.x] = player.player_id; [INFO] [stdout] 54 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Coord` which implements the `Copy` trait [INFO] [stdout] --> src/world/position.rs:74:25 [INFO] [stdout] | [INFO] [stdout] 74 | let mut coord = 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 `Coord` which implements the `Copy` trait [INFO] [stdout] --> src/world/position.rs:112:27 [INFO] [stdout] | [INFO] [stdout] 112 | let mut cur = 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 `Coord` which implements the `Copy` trait [INFO] [stdout] --> src/world/position.rs:116:24 [INFO] [stdout] | [INFO] [stdout] 116 | v.push(cur.clone()); [INFO] [stdout] | ^^^^^^^^^^^ help: try removing the `clone` call: `cur` [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/world/position.rs:142:9 [INFO] [stdout] | [INFO] [stdout] 142 | return (a.x - a.y).abs() [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] 142 - return (a.x - a.y).abs() [INFO] [stdout] 142 + (a.x - a.y).abs() [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: match expression looks like `matches!` macro [INFO] [stdout] --> src/world/pieces.rs:54:9 [INFO] [stdout] | [INFO] [stdout] 54 | / match self { [INFO] [stdout] 55 | | PieceType::Rook => true, [INFO] [stdout] 56 | | _ => false [INFO] [stdout] 57 | | } [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] 54 - match self { [INFO] [stdout] 55 - PieceType::Rook => true, [INFO] [stdout] 56 - _ => false [INFO] [stdout] 57 - } [INFO] [stdout] 54 + matches!(self, PieceType::Rook) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: length comparison to zero [INFO] [stdout] --> src/world/pieces.rs:95:16 [INFO] [stdout] | [INFO] [stdout] 95 | if cross.len() == 0 { [INFO] [stdout] | ^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `cross.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] [INFO] [stdout] [INFO] [stdout] warning: length comparison to zero [INFO] [stdout] --> src/world/pieces.rs:108:9 [INFO] [stdout] | [INFO] [stdout] 108 | / king [INFO] [stdout] 109 | | .others_threatening_me_at(world, king.position().unwrap()) [INFO] [stdout] 110 | | .len() > 0 [INFO] [stdout] | |______________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero [INFO] [stdout] help: using `!is_empty` is clearer and more explicit [INFO] [stdout] | [INFO] [stdout] 108 ~ !king [INFO] [stdout] 109 + .others_threatening_me_at(world, king.position().unwrap()).is_empty() [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this boolean expression can be simplified [INFO] [stdout] --> src/world/pieces.rs:140:20 [INFO] [stdout] | [INFO] [stdout] 140 | if !(off.chebyshev() == 2) { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(off.chebyshev() != 2)` [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/world/pieces.rs:192:17 [INFO] [stdout] | [INFO] [stdout] 192 | / return self.threatening(world) [INFO] [stdout] 193 | | .iter() [INFO] [stdout] 194 | | .any(|c: &Coord | c.x == coord.x && c.y == coord.y); [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] 192 ~ self.threatening(world) [INFO] [stdout] 193 + .iter() [INFO] [stdout] 194 ~ .any(|c: &Coord | c.x == coord.x && c.y == coord.y) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` can be collapsed into the outer `match` [INFO] [stdout] --> src/world/pieces.rs:121:17 [INFO] [stdout] | [INFO] [stdout] 121 | / if target_piece.player == self.player { [INFO] [stdout] 122 | | return false [INFO] [stdout] 123 | | } [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] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 120 ~ Some(target_piece) [INFO] [stdout] 121 ~ if target_piece.player == self.player => { [INFO] [stdout] 122 | return false [INFO] [stdout] 123 ~ }, [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/world/pieces.rs:119:9 [INFO] [stdout] | [INFO] [stdout] 119 | / match world.pieces.get(&world.pieces_map[coord.y][coord.x]) { [INFO] [stdout] 120 | | Some(target_piece) => { [INFO] [stdout] 121 | | if target_piece.player == self.player { [INFO] [stdout] 122 | | return false [INFO] [stdout] ... | [INFO] [stdout] 125 | | _ => (), [INFO] [stdout] 126 | | } [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] 119 ~ if let Some(target_piece) = world.pieces.get(&world.pieces_map[coord.y][coord.x]) { [INFO] [stdout] 120 + if target_piece.player == self.player { [INFO] [stdout] 121 + return false [INFO] [stdout] 122 + } [INFO] [stdout] 123 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: length comparison to zero [INFO] [stdout] --> src/world/pieces.rs:132:24 [INFO] [stdout] | [INFO] [stdout] 132 | && self.others_threatening_me_at(world, coord).len() == 0 [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `self.others_threatening_me_at(world, coord).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] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Coord` which implements the `Copy` trait [INFO] [stdout] --> src/world/pieces.rs:145:35 [INFO] [stdout] | [INFO] [stdout] 145 | let mut current = pos.clone(); [INFO] [stdout] | ^^^^^^^^^^^ help: try dereferencing it: `*pos` [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: length comparison to zero [INFO] [stdout] --> src/world/pieces.rs:148:24 [INFO] [stdout] | [INFO] [stdout] 148 | if self.others_threatening_me_at(world, ¤t).len() > 0 { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!self.others_threatening_me_at(world, ¤t).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] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/world/pieces.rs:154:51 [INFO] [stdout] | [INFO] [stdout] 154 | match world.pieces_map.find_first(&coord, dir) { [INFO] [stdout] | ^^^^^^ help: change this to: `coord` [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/world/pieces.rs:302:9 [INFO] [stdout] | [INFO] [stdout] 302 | return coords [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] 302 - return coords [INFO] [stdout] 302 + coords [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Coord` which implements the `Copy` trait [INFO] [stdout] --> src/world/pieces.rs:258:38 [INFO] [stdout] | [INFO] [stdout] 258 | let mut current: Coord = pos.clone(); [INFO] [stdout] | ^^^^^^^^^^^ help: try dereferencing it: `*pos` [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 `Direction` which implements the `Copy` trait [INFO] [stdout] --> src/world/direction.rs:67:18 [INFO] [stdout] | [INFO] [stdout] 67 | _ => 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: match expression looks like `matches!` macro [INFO] [stdout] --> src/world/direction.rs:95:17 [INFO] [stdout] | [INFO] [stdout] 95 | / match other { [INFO] [stdout] 96 | | Direction::North => true, [INFO] [stdout] 97 | | _ => false, [INFO] [stdout] 98 | | } [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] 95 - match other { [INFO] [stdout] 96 - Direction::North => true, [INFO] [stdout] 97 - _ => false, [INFO] [stdout] 98 - } [INFO] [stdout] 95 + matches!(other, Direction::North) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: match expression looks like `matches!` macro [INFO] [stdout] --> src/world/direction.rs:101:17 [INFO] [stdout] | [INFO] [stdout] 101 | / match other { [INFO] [stdout] 102 | | Direction::NorthEast => true, [INFO] [stdout] 103 | | _ => false, [INFO] [stdout] 104 | | } [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] 101 - match other { [INFO] [stdout] 102 - Direction::NorthEast => true, [INFO] [stdout] 103 - _ => false, [INFO] [stdout] 104 - } [INFO] [stdout] 101 + matches!(other, Direction::NorthEast) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: match expression looks like `matches!` macro [INFO] [stdout] --> src/world/direction.rs:107:17 [INFO] [stdout] | [INFO] [stdout] 107 | / match other { [INFO] [stdout] 108 | | Direction::NorthWest => true, [INFO] [stdout] 109 | | _ => false, [INFO] [stdout] 110 | | } [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] 107 - match other { [INFO] [stdout] 108 - Direction::NorthWest => true, [INFO] [stdout] 109 - _ => false, [INFO] [stdout] 110 - } [INFO] [stdout] 107 + matches!(other, Direction::NorthWest) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: match expression looks like `matches!` macro [INFO] [stdout] --> src/world/direction.rs:113:17 [INFO] [stdout] | [INFO] [stdout] 113 | / match other { [INFO] [stdout] 114 | | Direction::South => true, [INFO] [stdout] 115 | | _ => false, [INFO] [stdout] 116 | | } [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] 113 - match other { [INFO] [stdout] 114 - Direction::South => true, [INFO] [stdout] 115 - _ => false, [INFO] [stdout] 116 - } [INFO] [stdout] 113 + matches!(other, Direction::South) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: match expression looks like `matches!` macro [INFO] [stdout] --> src/world/direction.rs:119:17 [INFO] [stdout] | [INFO] [stdout] 119 | / match other { [INFO] [stdout] 120 | | Direction::SouthWest => true, [INFO] [stdout] 121 | | _ => false, [INFO] [stdout] 122 | | } [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] 119 - match other { [INFO] [stdout] 120 - Direction::SouthWest => true, [INFO] [stdout] 121 - _ => false, [INFO] [stdout] 122 - } [INFO] [stdout] 119 + matches!(other, Direction::SouthWest) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: match expression looks like `matches!` macro [INFO] [stdout] --> src/world/direction.rs:125:17 [INFO] [stdout] | [INFO] [stdout] 125 | / match other { [INFO] [stdout] 126 | | Direction::SouthEast => true, [INFO] [stdout] 127 | | _ => false, [INFO] [stdout] 128 | | } [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] 125 - match other { [INFO] [stdout] 126 - Direction::SouthEast => true, [INFO] [stdout] 127 - _ => false, [INFO] [stdout] 128 - } [INFO] [stdout] 125 + matches!(other, Direction::SouthEast) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: match expression looks like `matches!` macro [INFO] [stdout] --> src/world/direction.rs:131:17 [INFO] [stdout] | [INFO] [stdout] 131 | / match other { [INFO] [stdout] 132 | | Direction::West => true, [INFO] [stdout] 133 | | _ => false, [INFO] [stdout] 134 | | } [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] 131 - match other { [INFO] [stdout] 132 - Direction::West => true, [INFO] [stdout] 133 - _ => false, [INFO] [stdout] 134 - } [INFO] [stdout] 131 + matches!(other, Direction::West) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: match expression looks like `matches!` macro [INFO] [stdout] --> src/world/direction.rs:137:17 [INFO] [stdout] | [INFO] [stdout] 137 | / match other { [INFO] [stdout] 138 | | Direction::East => true, [INFO] [stdout] 139 | | _ => false, [INFO] [stdout] 140 | | } [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] 137 - match other { [INFO] [stdout] 138 - Direction::East => true, [INFO] [stdout] 139 - _ => false, [INFO] [stdout] 140 - } [INFO] [stdout] 137 + matches!(other, Direction::East) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: match expression looks like `matches!` macro [INFO] [stdout] --> src/world/player.rs:15:9 [INFO] [stdout] | [INFO] [stdout] 15 | / match self { [INFO] [stdout] 16 | | PlayerState::Flying => true, [INFO] [stdout] 17 | | _ => false, [INFO] [stdout] 18 | | } [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] 15 - match self { [INFO] [stdout] 16 - PlayerState::Flying => true, [INFO] [stdout] 17 - _ => false, [INFO] [stdout] 18 - } [INFO] [stdout] 15 + matches!(self, PlayerState::Flying) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: match expression looks like `matches!` macro [INFO] [stdout] --> src/world/player.rs:36:9 [INFO] [stdout] | [INFO] [stdout] 36 | / match self { [INFO] [stdout] 37 | | PlayerState::Boarded => true, [INFO] [stdout] 38 | | _ => false, [INFO] [stdout] 39 | | } [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] 36 - match self { [INFO] [stdout] 37 - PlayerState::Boarded => true, [INFO] [stdout] 38 - _ => false, [INFO] [stdout] 39 - } [INFO] [stdout] 36 + matches!(self, PlayerState::Boarded) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: match expression looks like `matches!` macro [INFO] [stdout] --> src/world/player.rs:43:9 [INFO] [stdout] | [INFO] [stdout] 43 | / match self { [INFO] [stdout] 44 | | PlayerState::Flying => true, [INFO] [stdout] 45 | | PlayerState::Falling(_h, _coord) => true, [INFO] [stdout] 46 | | _ => false, [INFO] [stdout] 47 | | } [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] 43 - match self { [INFO] [stdout] 44 - PlayerState::Flying => true, [INFO] [stdout] 45 - PlayerState::Falling(_h, _coord) => true, [INFO] [stdout] 46 - _ => false, [INFO] [stdout] 47 - } [INFO] [stdout] 43 + matches!(self, PlayerState::Flying | PlayerState::Falling(_h, _coord)) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: match expression looks like `matches!` macro [INFO] [stdout] --> src/world/player.rs:51:9 [INFO] [stdout] | [INFO] [stdout] 51 | / match self { [INFO] [stdout] 52 | | PlayerState::Dead(_rank) => false, [INFO] [stdout] 53 | | _ => true, [INFO] [stdout] 54 | | } [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] 51 - match self { [INFO] [stdout] 52 - PlayerState::Dead(_rank) => false, [INFO] [stdout] 53 - _ => true, [INFO] [stdout] 54 - } [INFO] [stdout] 51 + !matches!(self, PlayerState::Dead(_rank)) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you should consider adding a `Default` implementation for `GamerNamer` [INFO] [stdout] --> src/world/player.rs:116:5 [INFO] [stdout] | [INFO] [stdout] 116 | / pub fn new() -> Self { [INFO] [stdout] 117 | | let mut rng = rand::thread_rng(); [INFO] [stdout] 118 | | let mut adj_idxs: Vec = (0..GAME_NAME_ADJ.len()).collect(); [INFO] [stdout] 119 | | adj_idxs.shuffle(&mut rng); [INFO] [stdout] ... | [INFO] [stdout] 128 | | } [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default [INFO] [stdout] = note: `#[warn(clippy::new_without_default)]` on by default [INFO] [stdout] help: try adding this [INFO] [stdout] | [INFO] [stdout] 115 + impl Default for GamerNamer { [INFO] [stdout] 116 + fn default() -> Self { [INFO] [stdout] 117 + Self::new() [INFO] [stdout] 118 + } [INFO] [stdout] 119 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: method `next` can be confused for the standard trait method `std::iter::Iterator::next` [INFO] [stdout] --> src/world/player.rs:130:5 [INFO] [stdout] | [INFO] [stdout] 130 | / pub fn next(&mut self) -> String { [INFO] [stdout] 131 | | let ret = format!( [INFO] [stdout] 132 | | "{} {}", [INFO] [stdout] 133 | | GAME_NAME_ADJ[self.adj_idxs[self.adj_idx]], [INFO] [stdout] ... | [INFO] [stdout] 140 | | ret [INFO] [stdout] 141 | | } [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: consider implementing the trait `std::iter::Iterator` or choosing a less ambiguous method name [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#should_implement_trait [INFO] [stdout] = note: `#[warn(clippy::should_implement_trait)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: casting integer literal to `u16` is unnecessary [INFO] [stdout] --> src/world/fog.rs:27:31 [INFO] [stdout] | [INFO] [stdout] 27 | let zones = vec![vec![0 as u16; shape.x]; shape.y]; [INFO] [stdout] | ^^^^^^^^ help: try: `0_u16` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: casting integer literal to `u16` is unnecessary [INFO] [stdout] --> src/world/fog.rs:69:43 [INFO] [stdout] | [INFO] [stdout] 69 | let mut ret = self.zones.new_with(0 as u16); [INFO] [stdout] | ^^^^^^^^ help: try: `0_u16` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Coord` which implements the `Copy` trait [INFO] [stdout] --> src/world/flyer.rs:19:26 [INFO] [stdout] | [INFO] [stdout] 19 | self.map_shape = shape.clone(); [INFO] [stdout] | ^^^^^^^^^^^^^ help: try removing the `clone` call: `shape` [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: casting integer literal to `u16` is unnecessary [INFO] [stdout] --> src/world/flyer.rs:46:37 [INFO] [stdout] | [INFO] [stdout] 46 | let mut pathmap = vec![vec![0 as u16; self.map_shape.x]; self.map_shape.y]; [INFO] [stdout] | ^^^^^^^^ help: try: `0_u16` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/world.rs:104:58 [INFO] [stdout] | [INFO] [stdout] 104 | Action::Move(uid, _from, _to) => return *uid != user, [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] 104 - Action::Move(uid, _from, _to) => return *uid != user, [INFO] [stdout] 104 + Action::Move(uid, _from, _to) => *uid != user, [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/world.rs:105:30 [INFO] [stdout] | [INFO] [stdout] 105 | _ => return true [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] 105 - _ => return true [INFO] [stdout] 105 + _ => true [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/world.rs:112:42 [INFO] [stdout] | [INFO] [stdout] 112 | Action::Drop(uid) => return *uid == user, [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] 112 - Action::Drop(uid) => return *uid == user, [INFO] [stdout] 112 + Action::Drop(uid) => *uid == user, [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/world.rs:113:47 [INFO] [stdout] | [INFO] [stdout] 113 | Action::Fly(uid, _off) => return *uid == user, [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] 113 - Action::Fly(uid, _off) => return *uid == user, [INFO] [stdout] 113 + Action::Fly(uid, _off) => *uid == user, [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/world.rs:114:26 [INFO] [stdout] | [INFO] [stdout] 114 | _ => return true, [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] 114 - _ => return true, [INFO] [stdout] 114 + _ => true, [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/world.rs:117:54 [INFO] [stdout] | [INFO] [stdout] 117 | Action::Move(uid, _from, _to) => return *uid == user, [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] 117 - Action::Move(uid, _from, _to) => return *uid == user, [INFO] [stdout] 117 + Action::Move(uid, _from, _to) => *uid == user, [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/world.rs:118:26 [INFO] [stdout] | [INFO] [stdout] 118 | _ => return true, [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] 118 - _ => return true, [INFO] [stdout] 118 + _ => true, [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/world.rs:133:17 [INFO] [stdout] | [INFO] [stdout] 133 | return true [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] 133 - return true [INFO] [stdout] 133 + true [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/world.rs:139:9 [INFO] [stdout] | [INFO] [stdout] 139 | / match action { [INFO] [stdout] 140 | | Action::Move(user, from, to) => { [INFO] [stdout] 141 | | let piece_id = self.pieces_map[from.y][from.x]; [INFO] [stdout] 142 | | if piece_id == 0 { return; } [INFO] [stdout] ... | [INFO] [stdout] 178 | | _ => () [INFO] [stdout] 179 | | } [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] 139 ~ if let Action::Move(user, from, to) = action { [INFO] [stdout] 140 + let piece_id = self.pieces_map[from.y][from.x]; [INFO] [stdout] 141 + if piece_id == 0 { return; } [INFO] [stdout] 142 + let mut other_piece_id = 0 as u16; [INFO] [stdout] 143 + let mut kind = PieceType::Empty; [INFO] [stdout] 144 + match self.pieces.get_mut(&piece_id) { [INFO] [stdout] 145 + Some(piece) => { [INFO] [stdout] 146 + if piece.player != user || !piece.alive { return; } [INFO] [stdout] 147 + match piece.kind.intermediat_steps(from, to) { [INFO] [stdout] 148 + None => (), [INFO] [stdout] 149 + Some(steps) => { [INFO] [stdout] 150 + for step in steps { [INFO] [stdout] 151 + if self.pieces_map[step.y][step.x] > 0 { [INFO] [stdout] 152 + return ; [INFO] [stdout] 153 + } [INFO] [stdout] 154 + } [INFO] [stdout] 155 + [INFO] [stdout] 156 + // Taking (preparing, actual happens below) [INFO] [stdout] 157 + other_piece_id = self.pieces_map[to.y][to.x]; [INFO] [stdout] 158 + kind = piece.kind.clone(); [INFO] [stdout] 159 + [INFO] [stdout] 160 + // Moving [INFO] [stdout] 161 + piece.place(to.clone()); [INFO] [stdout] 162 + self.pieces_map[to.y][to.x] = piece_id; [INFO] [stdout] 163 + self.pieces_map[from.y][from.x] = 0; [INFO] [stdout] 164 + self.historian.record_player( [INFO] [stdout] 165 + user, [INFO] [stdout] 166 + self.tick, [INFO] [stdout] 167 + piece.kind, [INFO] [stdout] 168 + format!("Move {:?} -> {:?}", from, to), [INFO] [stdout] 169 + ) [INFO] [stdout] 170 + } [INFO] [stdout] 171 + } [INFO] [stdout] 172 + } [INFO] [stdout] 173 + _ => (), [INFO] [stdout] 174 + } [INFO] [stdout] 175 + self.do_take(other_piece_id, user, kind); [INFO] [stdout] 176 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: casting integer literal to `u16` is unnecessary [INFO] [stdout] --> src/world.rs:143:42 [INFO] [stdout] | [INFO] [stdout] 143 | let mut other_piece_id = 0 as u16; [INFO] [stdout] | ^^^^^^^^ help: try: `0_u16` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast [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/world.rs:145:17 [INFO] [stdout] | [INFO] [stdout] 145 | / match self.pieces.get_mut(&piece_id) { [INFO] [stdout] 146 | | Some(piece) => { [INFO] [stdout] 147 | | if piece.player != user || !piece.alive { return; } [INFO] [stdout] 148 | | match piece.kind.intermediat_steps(from, to) { [INFO] [stdout] ... | [INFO] [stdout] 174 | | _ => (), [INFO] [stdout] 175 | | } [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] 145 ~ if let Some(piece) = self.pieces.get_mut(&piece_id) { [INFO] [stdout] 146 + if piece.player != user || !piece.alive { return; } [INFO] [stdout] 147 + match piece.kind.intermediat_steps(from, to) { [INFO] [stdout] 148 + None => (), [INFO] [stdout] 149 + Some(steps) => { [INFO] [stdout] 150 + for step in steps { [INFO] [stdout] 151 + if self.pieces_map[step.y][step.x] > 0 { [INFO] [stdout] 152 + return ; [INFO] [stdout] 153 + } [INFO] [stdout] 154 + } [INFO] [stdout] 155 + [INFO] [stdout] 156 + // Taking (preparing, actual happens below) [INFO] [stdout] 157 + other_piece_id = self.pieces_map[to.y][to.x]; [INFO] [stdout] 158 + kind = piece.kind.clone(); [INFO] [stdout] 159 + [INFO] [stdout] 160 + // Moving [INFO] [stdout] 161 + piece.place(to.clone()); [INFO] [stdout] 162 + self.pieces_map[to.y][to.x] = piece_id; [INFO] [stdout] 163 + self.pieces_map[from.y][from.x] = 0; [INFO] [stdout] 164 + self.historian.record_player( [INFO] [stdout] 165 + user, [INFO] [stdout] 166 + self.tick, [INFO] [stdout] 167 + piece.kind, [INFO] [stdout] 168 + format!("Move {:?} -> {:?}", from, to), [INFO] [stdout] 169 + ) [INFO] [stdout] 170 + } [INFO] [stdout] 171 + } [INFO] [stdout] 172 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `PieceType` which implements the `Copy` trait [INFO] [stdout] --> src/world.rs:159:40 [INFO] [stdout] | [INFO] [stdout] 159 | ... kind = piece.kind.clone(); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `piece.kind` [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 `Coord` which implements the `Copy` trait [INFO] [stdout] --> src/world.rs:162:45 [INFO] [stdout] | [INFO] [stdout] 162 | ... piece.place(to.clone()); [INFO] [stdout] | ^^^^^^^^^^ help: try removing the `clone` call: `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: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` [INFO] [stdout] --> src/world.rs:183:9 [INFO] [stdout] | [INFO] [stdout] 183 | / match self.pieces.get_mut(&other_piece_id) { [INFO] [stdout] 184 | | Some(other) => { [INFO] [stdout] 185 | | if !other.alive { return; } [INFO] [stdout] 186 | | let pos = other.position().unwrap().clone(); [INFO] [stdout] ... | [INFO] [stdout] 221 | | _ => (), [INFO] [stdout] 222 | | } [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] 183 ~ if let Some(other) = self.pieces.get_mut(&other_piece_id) { [INFO] [stdout] 184 + if !other.alive { return; } [INFO] [stdout] 185 + let pos = other.position().unwrap().clone(); [INFO] [stdout] 186 + other.alive = false; [INFO] [stdout] 187 + self.players.get_mut(&taker_id).unwrap().score += other.kind.value(); [INFO] [stdout] 188 + match other.kind { [INFO] [stdout] 189 + PieceType::Empty => (), [INFO] [stdout] 190 + PieceType::King => { [INFO] [stdout] 191 + if self.players.contains_key(&other.player) { [INFO] [stdout] 192 + let rank = self.players.iter() [INFO] [stdout] 193 + .filter(| (_, p) | p.state.is_alive()).count(); [INFO] [stdout] 194 + if rank == 2 { [INFO] [stdout] 195 + // Give rank 1 to self [INFO] [stdout] 196 + self.players.get_mut(&taker_id).unwrap() [INFO] [stdout] 197 + .transition(PlayerState::Dead(1)); [INFO] [stdout] 198 + self.alive = false; [INFO] [stdout] 199 + } [INFO] [stdout] 200 + self.players.get_mut(&other.player).unwrap() [INFO] [stdout] 201 + .transition(PlayerState::Dead(rank as u16)); [INFO] [stdout] 202 + } [INFO] [stdout] 203 + self.historian.record_player( [INFO] [stdout] 204 + taker_id, [INFO] [stdout] 205 + self.tick, [INFO] [stdout] 206 + taken_by, [INFO] [stdout] 207 + format!("Capture {:?} @ {:?}", other.kind, pos), [INFO] [stdout] 208 + ); [INFO] [stdout] 209 + }, [INFO] [stdout] 210 + _ => { [INFO] [stdout] 211 + self.historian.record_player( [INFO] [stdout] 212 + taker_id, [INFO] [stdout] 213 + self.tick, [INFO] [stdout] 214 + taken_by, [INFO] [stdout] 215 + format!("Capture {:?} @ {:?}", other.kind, pos), [INFO] [stdout] 216 + ) [INFO] [stdout] 217 + } [INFO] [stdout] 218 + } [INFO] [stdout] 219 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Coord` which implements the `Copy` trait [INFO] [stdout] --> src/world.rs:186:27 [INFO] [stdout] | [INFO] [stdout] 186 | let pos = other.position().unwrap().clone(); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try dereferencing it: `*other.position().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: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` [INFO] [stdout] --> src/world.rs:229:13 [INFO] [stdout] | [INFO] [stdout] 229 | / match action { [INFO] [stdout] 230 | | Action::Fly(user, off) => { [INFO] [stdout] 231 | | if !self.players.contains_key(&user) || !self.players[&user].state.can_fly() { continue; } [INFO] [stdout] 232 | | match self.players[&user].state { [INFO] [stdout] ... | [INFO] [stdout] 248 | | _ => (), [INFO] [stdout] 249 | | } [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] 229 ~ if let Action::Fly(user, off) = action { [INFO] [stdout] 230 + if !self.players.contains_key(&user) || !self.players[&user].state.can_fly() { continue; } [INFO] [stdout] 231 + match self.players[&user].state { [INFO] [stdout] 232 + PlayerState::Falling(h, coord) => { [INFO] [stdout] 233 + let next_coord = coord.translate(off); [INFO] [stdout] 234 + if next_coord.is_inside(&shape) { [INFO] [stdout] 235 + self.players.get_mut(&user).unwrap().transition(PlayerState::Falling(h, next_coord)); [INFO] [stdout] 236 + self.historian.record_player( [INFO] [stdout] 237 + user, [INFO] [stdout] 238 + self.tick, [INFO] [stdout] 239 + PieceType::King, [INFO] [stdout] 240 + format!("Fly -> {:?}", next_coord), [INFO] [stdout] 241 + ); [INFO] [stdout] 242 + } [INFO] [stdout] 243 + }, [INFO] [stdout] 244 + _ => (), [INFO] [stdout] 245 + } [INFO] [stdout] 246 + } [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/world.rs:232:21 [INFO] [stdout] | [INFO] [stdout] 232 | / match self.players[&user].state { [INFO] [stdout] 233 | | PlayerState::Falling(h, coord) => { [INFO] [stdout] 234 | | let next_coord = coord.translate(off); [INFO] [stdout] 235 | | if next_coord.is_inside(&shape) { [INFO] [stdout] ... | [INFO] [stdout] 245 | | _ => (), [INFO] [stdout] 246 | | } [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] 232 ~ if let PlayerState::Falling(h, coord) = self.players[&user].state { [INFO] [stdout] 233 + let next_coord = coord.translate(off); [INFO] [stdout] 234 + if next_coord.is_inside(&shape) { [INFO] [stdout] 235 + self.players.get_mut(&user).unwrap().transition(PlayerState::Falling(h, next_coord)); [INFO] [stdout] 236 + self.historian.record_player( [INFO] [stdout] 237 + user, [INFO] [stdout] 238 + self.tick, [INFO] [stdout] 239 + PieceType::King, [INFO] [stdout] 240 + format!("Fly -> {:?}", next_coord), [INFO] [stdout] 241 + ); [INFO] [stdout] 242 + } [INFO] [stdout] 243 + } [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/world.rs:256:13 [INFO] [stdout] | [INFO] [stdout] 256 | / match self.flyer.coord() { [INFO] [stdout] 257 | | Some(flyer) => { [INFO] [stdout] 258 | | let uids: Vec = self.players.iter().map(|(k, _)| k.clone()).collect(); [INFO] [stdout] 259 | | for uid in uids { [INFO] [stdout] ... | [INFO] [stdout] 270 | | _ => (), [INFO] [stdout] 271 | | } [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] 256 ~ if let Some(flyer) = self.flyer.coord() { [INFO] [stdout] 257 + let uids: Vec = self.players.iter().map(|(k, _)| k.clone()).collect(); [INFO] [stdout] 258 + for uid in uids { [INFO] [stdout] 259 + if !self.players.contains_key(&uid) || !self.players[&uid].state.is_flying() { continue; } [INFO] [stdout] 260 + self.players.get_mut(&uid).unwrap().transition(PlayerState::Falling(self.settings.drop_height, flyer.clone())); [INFO] [stdout] 261 + self.historian.record_player( [INFO] [stdout] 262 + uid, [INFO] [stdout] 263 + self.tick, [INFO] [stdout] 264 + PieceType::King, [INFO] [stdout] 265 + format!("Drop -> {:?}:{}", flyer, self.settings.drop_height), [INFO] [stdout] 266 + ); [INFO] [stdout] 267 + } [INFO] [stdout] 268 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: iterating on a map's keys [INFO] [stdout] --> src/world.rs:258:42 [INFO] [stdout] | [INFO] [stdout] 258 | let uids: Vec = self.players.iter().map(|(k, _)| k.clone()).collect(); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `self.players.keys().map(|k| k.clone())` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#iter_kv_map [INFO] [stdout] = note: `#[warn(clippy::iter_kv_map)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `u16` which implements the `Copy` trait [INFO] [stdout] --> src/world.rs:258:75 [INFO] [stdout] | [INFO] [stdout] 258 | let uids: Vec = self.players.iter().map(|(k, _)| k.clone()).collect(); [INFO] [stdout] | ^^^^^^^^^ help: try dereferencing it: `*k` [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 `Coord` which implements the `Copy` trait [INFO] [stdout] --> src/world.rs:261:120 [INFO] [stdout] | [INFO] [stdout] 261 | ...Falling(self.settings.drop_height, flyer.clone())); [INFO] [stdout] | ^^^^^^^^^^^^^ help: try removing the `clone` call: `flyer` [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 seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` [INFO] [stdout] --> src/world.rs:274:13 [INFO] [stdout] | [INFO] [stdout] 274 | / match self.flyer.coord() { [INFO] [stdout] 275 | | Some(flyer) => { [INFO] [stdout] 276 | | while let Some(action) = drop_actions.pop() { [INFO] [stdout] 277 | | match action { [INFO] [stdout] ... | [INFO] [stdout] 293 | | _ => (), [INFO] [stdout] 294 | | } [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] 274 ~ if let Some(flyer) = self.flyer.coord() { [INFO] [stdout] 275 + while let Some(action) = drop_actions.pop() { [INFO] [stdout] 276 + match action { [INFO] [stdout] 277 + Action::Drop(user) => { [INFO] [stdout] 278 + if !self.players.contains_key(&user) || !self.players[&user].state.is_flying() { continue; } [INFO] [stdout] 279 + self.players.get_mut(&user).unwrap().transition(PlayerState::Falling(self.settings.drop_height, flyer.clone())); [INFO] [stdout] 280 + self.historian.record_player( [INFO] [stdout] 281 + user, [INFO] [stdout] 282 + self.tick, [INFO] [stdout] 283 + PieceType::King, [INFO] [stdout] 284 + format!("Drop -> {:?}:{}", flyer, self.settings.drop_height), [INFO] [stdout] 285 + ); [INFO] [stdout] 286 + } [INFO] [stdout] 287 + _ => (), [INFO] [stdout] 288 + } [INFO] [stdout] 289 + } [INFO] [stdout] 290 + [INFO] [stdout] 291 + } [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/world.rs:277:25 [INFO] [stdout] | [INFO] [stdout] 277 | / ... match action { [INFO] [stdout] 278 | | ... Action::Drop(user) => { [INFO] [stdout] 279 | | ... if !self.players.contains_key(&user) || !self.players[&user].state.is_flying() { continue; } [INFO] [stdout] 280 | | ... self.players.get_mut(&user).unwrap().transition(PlayerState::Falling(self.settings.drop_height, flyer.clone())); [INFO] [stdout] ... | [INFO] [stdout] 288 | | ... _ => (), [INFO] [stdout] 289 | | ... } [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] 277 ~ if let Action::Drop(user) = action { [INFO] [stdout] 278 + if !self.players.contains_key(&user) || !self.players[&user].state.is_flying() { continue; } [INFO] [stdout] 279 + self.players.get_mut(&user).unwrap().transition(PlayerState::Falling(self.settings.drop_height, flyer.clone())); [INFO] [stdout] 280 + self.historian.record_player( [INFO] [stdout] 281 + user, [INFO] [stdout] 282 + self.tick, [INFO] [stdout] 283 + PieceType::King, [INFO] [stdout] 284 + format!("Drop -> {:?}:{}", flyer, self.settings.drop_height), [INFO] [stdout] 285 + ); [INFO] [stdout] 286 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Coord` which implements the `Copy` trait [INFO] [stdout] --> src/world.rs:280:129 [INFO] [stdout] | [INFO] [stdout] 280 | ... self.players.get_mut(&user).unwrap().transition(PlayerState::Falling(self.settings.drop_height, flyer.clone())); [INFO] [stdout] | ^^^^^^^^^^^^^ help: try removing the `clone` call: `flyer` [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: iterating on a map's keys [INFO] [stdout] --> src/world.rs:299:30 [INFO] [stdout] | [INFO] [stdout] 299 | let uids: Vec = self.players.iter().map(|(k, _)| k.clone()).collect(); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `self.players.keys().map(|k| k.clone())` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#iter_kv_map [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `u16` which implements the `Copy` trait [INFO] [stdout] --> src/world.rs:299:63 [INFO] [stdout] | [INFO] [stdout] 299 | let uids: Vec = self.players.iter().map(|(k, _)| k.clone()).collect(); [INFO] [stdout] | ^^^^^^^^^ help: try dereferencing it: `*k` [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 seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` [INFO] [stdout] --> src/world.rs:301:13 [INFO] [stdout] | [INFO] [stdout] 301 | / match self.players[uid].state { [INFO] [stdout] 302 | | PlayerState::Falling(h, coord) => { [INFO] [stdout] 303 | | if h > 1 { [INFO] [stdout] 304 | | self.players.get_mut(uid).unwrap().transition(PlayerState::Falling(h - 1, coord)); [INFO] [stdout] ... | [INFO] [stdout] 334 | | _ => (), [INFO] [stdout] 335 | | } [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] 301 ~ if let PlayerState::Falling(h, coord) = self.players[uid].state { [INFO] [stdout] 302 + if h > 1 { [INFO] [stdout] 303 + self.players.get_mut(uid).unwrap().transition(PlayerState::Falling(h - 1, coord)); [INFO] [stdout] 304 + self.historian.record_player( [INFO] [stdout] 305 + *uid, [INFO] [stdout] 306 + self.tick, [INFO] [stdout] 307 + PieceType::King, [INFO] [stdout] 308 + format!("Fall -> {:?}:{}", coord, h - 1), [INFO] [stdout] 309 + ) [INFO] [stdout] 310 + } else { [INFO] [stdout] 311 + self.players.get_mut(uid).unwrap().transition(PlayerState::Boarded); [INFO] [stdout] 312 + let mut piece = Piece::new(PieceType::King, *uid); [INFO] [stdout] 313 + piece.place(coord.clone()); [INFO] [stdout] 314 + let piece_id = self.pieces.len() as u16 + 1; [INFO] [stdout] 315 + self.pieces.insert(piece_id, piece); [INFO] [stdout] 316 + self.players.get_mut(uid).unwrap().king_id = piece_id; [INFO] [stdout] 317 + if self.pieces_map[coord.y][coord.x] > 0 { [INFO] [stdout] 318 + self.do_take( [INFO] [stdout] 319 + self.pieces_map[coord.y][coord.x], [INFO] [stdout] 320 + *uid, [INFO] [stdout] 321 + PieceType::King, [INFO] [stdout] 322 + ) [INFO] [stdout] 323 + } [INFO] [stdout] 324 + self.pieces_map[coord.y][coord.x] = piece_id; [INFO] [stdout] 325 + self.historian.record_player( [INFO] [stdout] 326 + *uid, [INFO] [stdout] 327 + self.tick, [INFO] [stdout] 328 + PieceType::King, [INFO] [stdout] 329 + format!("Land -> {:?}", coord), [INFO] [stdout] 330 + ); [INFO] [stdout] 331 + } [INFO] [stdout] 332 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Coord` which implements the `Copy` trait [INFO] [stdout] --> src/world.rs:314:37 [INFO] [stdout] | [INFO] [stdout] 314 | piece.place(coord.clone()); [INFO] [stdout] | ^^^^^^^^^^^^^ help: try removing the `clone` call: `coord` [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: manual implementation of `.is_multiple_of()` [INFO] [stdout] --> src/world.rs:343:16 [INFO] [stdout] | [INFO] [stdout] 343 | if (self.tick % self.settings.flyer_every) == 0 { self.flyer.tick(); } [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `self.tick.is_multiple_of(self.settings.flyer_every)` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_is_multiple_of [INFO] [stdout] = note: `#[warn(clippy::manual_is_multiple_of)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of `.is_multiple_of()` [INFO] [stdout] --> src/world.rs:345:16 [INFO] [stdout] | [INFO] [stdout] 345 | if (self.tick % self.settings.zone_every) == 0 { self.fog.contract(self.settings.zone_rest); } [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `self.tick.is_multiple_of(self.settings.zone_every)` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_is_multiple_of [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you are using an explicit closure for copying elements [INFO] [stdout] --> src/world.rs:349:41 [INFO] [stdout] | [INFO] [stdout] 349 | let drop_actions: Vec = self.req_air_action [INFO] [stdout] | _________________________________________^ [INFO] [stdout] 350 | | .iter() [INFO] [stdout] 351 | | .filter(| e | match e { Action::Drop(_u) => true, _ => false }) [INFO] [stdout] 352 | | .map(|e | e.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] 349 ~ let drop_actions: Vec = self.req_air_action [INFO] [stdout] 350 + .iter() [INFO] [stdout] 351 + .filter(| e | match e { Action::Drop(_u) => true, _ => false }).copied() [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: match expression looks like `matches!` macro [INFO] [stdout] --> src/world.rs:351:27 [INFO] [stdout] | [INFO] [stdout] 351 | .filter(| e | match e { Action::Drop(_u) => true, _ => false }) [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] 351 - .filter(| e | match e { Action::Drop(_u) => true, _ => false }) [INFO] [stdout] 351 + .filter(| e | matches!(e, Action::Drop(_u))) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Action` which implements the `Copy` trait [INFO] [stdout] --> src/world.rs:352:23 [INFO] [stdout] | [INFO] [stdout] 352 | .map(|e | e.clone()) [INFO] [stdout] | ^^^^^^^^^ help: try dereferencing it: `*e` [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/world.rs:354:40 [INFO] [stdout] | [INFO] [stdout] 354 | let fly_actions: Vec = self.req_air_action [INFO] [stdout] | ________________________________________^ [INFO] [stdout] 355 | | .iter() [INFO] [stdout] 356 | | .filter(| e | match e { Action::Fly(_u, _off) => true, _ => false }) [INFO] [stdout] 357 | | .map(|e | e.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] help: consider calling the dedicated `copied` method [INFO] [stdout] | [INFO] [stdout] 354 ~ let fly_actions: Vec = self.req_air_action [INFO] [stdout] 355 + .iter() [INFO] [stdout] 356 + .filter(| e | match e { Action::Fly(_u, _off) => true, _ => false }).copied() [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: match expression looks like `matches!` macro [INFO] [stdout] --> src/world.rs:356:27 [INFO] [stdout] | [INFO] [stdout] 356 | .filter(| e | match e { Action::Fly(_u, _off) => true, _ => false }) [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] 356 - .filter(| e | match e { Action::Fly(_u, _off) => true, _ => false }) [INFO] [stdout] 356 + .filter(| e | matches!(e, Action::Fly(_u, _off))) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Action` which implements the `Copy` trait [INFO] [stdout] --> src/world.rs:357:23 [INFO] [stdout] | [INFO] [stdout] 357 | .map(|e | e.clone()) [INFO] [stdout] | ^^^^^^^^^ help: try dereferencing it: `*e` [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 seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` [INFO] [stdout] --> src/world.rs:367:9 [INFO] [stdout] | [INFO] [stdout] 367 | / match action { [INFO] [stdout] 368 | | Some(action) => self.do_board_move(action), [INFO] [stdout] 369 | | _ => () [INFO] [stdout] 370 | | } [INFO] [stdout] | |_________^ help: try: `if let Some(action) = action { self.do_board_move(action) }` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: iterating on a map's values [INFO] [stdout] --> src/world.rs:375:40 [INFO] [stdout] | [INFO] [stdout] 375 | let mut players: Vec = self.players [INFO] [stdout] | ________________________________________^ [INFO] [stdout] 376 | | .iter() [INFO] [stdout] 377 | | .map(|(_, p)| p.clone()) [INFO] [stdout] | |____________________________________^ help: try: `self.players.values().map(|p| p.clone())` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#iter_kv_map [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: consider using `sort_by_key` [INFO] [stdout] --> src/world.rs:379:9 [INFO] [stdout] | [INFO] [stdout] 379 | players.sort_by(|a, b| b.score.cmp(&a.score)); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_sort_by [INFO] [stdout] = note: `#[warn(clippy::unnecessary_sort_by)]` on by default [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 379 - players.sort_by(|a, b| b.score.cmp(&a.score)); [INFO] [stdout] 379 + players.sort_by_key(|b| std::cmp::Reverse(b.score)); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/world.rs:395:9 [INFO] [stdout] | [INFO] [stdout] 395 | return pos [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] 395 - return pos [INFO] [stdout] 395 + pos [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/world.rs:387:17 [INFO] [stdout] | [INFO] [stdout] 387 | / match piece.position() { [INFO] [stdout] 388 | | Some(coord) => { [INFO] [stdout] 389 | | pos.push((piece.kind, coord.clone())) [INFO] [stdout] ... | [INFO] [stdout] 392 | | } [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] 387 ~ if let Some(coord) = piece.position() { [INFO] [stdout] 388 + pos.push((piece.kind, coord.clone())) [INFO] [stdout] 389 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Coord` which implements the `Copy` trait [INFO] [stdout] --> src/world.rs:389:47 [INFO] [stdout] | [INFO] [stdout] 389 | pos.push((piece.kind, coord.clone())) [INFO] [stdout] | ^^^^^^^^^^^^^ help: try dereferencing it: `*coord` [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: writing `&Vec` instead of `&[_]` involves a new object where a slice will do [INFO] [stdout] --> src/world.rs:412:50 [INFO] [stdout] | [INFO] [stdout] 412 | pub fn spawn(shape: Coord, nzones: u16, players: &Vec) -> World { [INFO] [stdout] | ^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg [INFO] [stdout] help: change this to [INFO] [stdout] | [INFO] [stdout] 412 - pub fn spawn(shape: Coord, nzones: u16, players: &Vec) -> World { [INFO] [stdout] 412 + pub fn spawn(shape: Coord, nzones: u16, players: &[String]) -> World { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do [INFO] [stdout] --> src/world/board.rs:19:33 [INFO] [stdout] | [INFO] [stdout] 19 | fn apply(&mut self, coords: &Vec, value: u16); [INFO] [stdout] | ^^^^^^^^^^^ help: change this to: `&[Coord]` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg [INFO] [stdout] = note: `#[warn(clippy::ptr_arg)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `x` is only used to index `self` [INFO] [stdout] --> src/world/board.rs:60:18 [INFO] [stdout] | [INFO] [stdout] 60 | for x in c1.x..c2.x { [INFO] [stdout] | ^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] = note: `#[warn(clippy::needless_range_loop)]` on by default [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 60 - for x in c1.x..c2.x { [INFO] [stdout] 60 + for in self.iter_mut().take(c2.x).skip(c1.x) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `y` is only used to index `self` [INFO] [stdout] --> src/world/board.rs:61:22 [INFO] [stdout] | [INFO] [stdout] 61 | for y in c1.y..c2.y { [INFO] [stdout] | ^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 61 - for y in c1.y..c2.y { [INFO] [stdout] 61 + for in self.iter_mut().take(c2.y).skip(c1.y) { [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/world/board.rs:82:13 [INFO] [stdout] | [INFO] [stdout] 82 | / match row_max { [INFO] [stdout] 83 | | Some(i) => m = m.max(*i), [INFO] [stdout] 84 | | _ => (), [INFO] [stdout] 85 | | } [INFO] [stdout] | |_____________^ help: try: `if let Some(i) = row_max { m = m.max(*i) }` [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] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `x` is used to index `self` [INFO] [stdout] --> src/world/board.rs:106:18 [INFO] [stdout] | [INFO] [stdout] 106 | for x in 0..shape.x { [INFO] [stdout] | ^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator and enumerate() [INFO] [stdout] | [INFO] [stdout] 106 - for x in 0..shape.x { [INFO] [stdout] 106 + for (x, ) in self.iter().enumerate().take(shape.x) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `y` is used to index `self` [INFO] [stdout] --> src/world/board.rs:107:22 [INFO] [stdout] | [INFO] [stdout] 107 | for y in 0..shape.y { [INFO] [stdout] | ^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator and enumerate() [INFO] [stdout] | [INFO] [stdout] 107 - for y in 0..shape.y { [INFO] [stdout] 107 + for (y, ) in self.iter().enumerate().take(shape.y) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `y` is only used to index `self` [INFO] [stdout] --> src/world/board.rs:232:18 [INFO] [stdout] | [INFO] [stdout] 232 | for y in cmp::max(0, lower_left.y)..cmp::min(upper_right.y + 1, shape.y) { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 232 - for y in cmp::max(0, lower_left.y)..cmp::min(upper_right.y + 1, shape.y) { [INFO] [stdout] 232 + for in self.iter().take(cmp::min(upper_right.y + 1, shape.y)).skip(cmp::max(0, lower_left.y)) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `x` is only used to index `self` [INFO] [stdout] --> src/world/board.rs:233:22 [INFO] [stdout] | [INFO] [stdout] 233 | for x in cmp::max(0, lower_left.x)..cmp::min(upper_right.x + 1, shape.x) { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 233 - for x in cmp::max(0, lower_left.x)..cmp::min(upper_right.x + 1, shape.x) { [INFO] [stdout] 233 + for in self.iter().take(cmp::min(upper_right.x + 1, shape.x)).skip(cmp::max(0, lower_left.x)) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/world/builders.rs:16:5 [INFO] [stdout] | [INFO] [stdout] 16 | return areas [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] 16 - return areas [INFO] [stdout] 16 + areas [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: casting integer literal to `u16` is unnecessary [INFO] [stdout] --> src/world/builders.rs:10:26 [INFO] [stdout] | [INFO] [stdout] 10 | let mut areas = vec![1 as u16; zones.into()]; [INFO] [stdout] | ^^^^^^^^ help: try: `1_u16` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast [INFO] [stdout] = note: `#[warn(clippy::unnecessary_cast)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` can be collapsed into the outer `match` [INFO] [stdout] --> src/world/builders.rs:35:22 [INFO] [stdout] | [INFO] [stdout] 35 | 0 => if c1.x > 1 {c1 = c1.translate_direction(Direction::West)}, [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] 35 - 0 => if c1.x > 1 {c1 = c1.translate_direction(Direction::West)}, [INFO] [stdout] 35 + 0f c1.x > 1 => {c1 = c1.translate_direction(Direction::West), [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` can be collapsed into the outer `match` [INFO] [stdout] --> src/world/builders.rs:36:22 [INFO] [stdout] | [INFO] [stdout] 36 | 1 => if c2.x + 1 < shape.x {c2 = c2.translate_direction(Direction::East)}, [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] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 36 - 1 => if c2.x + 1 < shape.x {c2 = c2.translate_direction(Direction::East)}, [INFO] [stdout] 36 + 1f c2.x + 1 < shape.x => {c2 = c2.translate_direction(Direction::East), [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` can be collapsed into the outer `match` [INFO] [stdout] --> src/world/builders.rs:37:22 [INFO] [stdout] | [INFO] [stdout] 37 | 2 => if c1.y > 1 {c1 = c1.translate_direction(Direction::North)}, [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] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 37 - 2 => if c1.y > 1 {c1 = c1.translate_direction(Direction::North)}, [INFO] [stdout] 37 + 2f c1.y > 1 => {c1 = c1.translate_direction(Direction::North), [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` can be collapsed into the outer `match` [INFO] [stdout] --> src/world/builders.rs:38:22 [INFO] [stdout] | [INFO] [stdout] 38 | 3 => if c2.y + 1 < shape.y {c2 = c2.translate_direction(Direction::South)}, [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] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 38 - 3 => if c2.y + 1 < shape.y {c2 = c2.translate_direction(Direction::South)}, [INFO] [stdout] 38 + 3f c2.y + 1 < shape.y => {c2 = c2.translate_direction(Direction::South), [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/world/builders.rs:67:53 [INFO] [stdout] | [INFO] [stdout] 67 | let this_zone = zones.coords_when(zone, &fog, 0); [INFO] [stdout] | ^^^^ help: change this to: `fog` [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: length comparison to zero [INFO] [stdout] --> src/world/builders.rs:68:16 [INFO] [stdout] | [INFO] [stdout] 68 | if this_zone.len() == 0 { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `this_zone.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 `Direction` which implements the `Copy` trait [INFO] [stdout] --> src/world/builders.rs:102:23 [INFO] [stdout] | [INFO] [stdout] 102 | let mut dir = orig_dir.clone(); [INFO] [stdout] | ^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `orig_dir` [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: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` [INFO] [stdout] --> src/world/builders.rs:106:9 [INFO] [stdout] | [INFO] [stdout] 106 | / match path.last() { [INFO] [stdout] 107 | | Some(pos) => { [INFO] [stdout] 108 | | let next_pos = pos.translate_direction(dir); [INFO] [stdout] 109 | | if !next_pos.is_inside(&shape) { break; } [INFO] [stdout] ... | [INFO] [stdout] 113 | | None => (), [INFO] [stdout] 114 | | } [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] 106 ~ if let Some(pos) = path.last() { [INFO] [stdout] 107 + let next_pos = pos.translate_direction(dir); [INFO] [stdout] 108 + if !next_pos.is_inside(&shape) { break; } [INFO] [stdout] 109 + path.push(next_pos); [INFO] [stdout] 110 + if next_pos.x == 0 || next_pos.y == 0 { break; } [INFO] [stdout] 111 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do [INFO] [stdout] --> src/world/display.rs:18:27 [INFO] [stdout] | [INFO] [stdout] 18 | pub fn print_board(board: &Vec>) { [INFO] [stdout] | ^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg [INFO] [stdout] help: change this to [INFO] [stdout] | [INFO] [stdout] 18 - pub fn print_board(board: &Vec>) { [INFO] [stdout] 18 + pub fn print_board(board: &[Vec]) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: empty string literal in `println!` [INFO] [stdout] --> src/world/display.rs:19:5 [INFO] [stdout] | [INFO] [stdout] 19 | println!(""); [INFO] [stdout] | ^^^^^^^^^--^ [INFO] [stdout] | | [INFO] [stdout] | help: remove the empty string [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#println_empty_string [INFO] [stdout] = note: `#[warn(clippy::println_empty_string)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `.into_iter()` call is equivalent to `.iter()` and will not consume the `Vec` [INFO] [stdout] --> src/world/display.rs:22:14 [INFO] [stdout] | [INFO] [stdout] 22 | .into_iter() [INFO] [stdout] | ^^^^^^^^^ help: call directly: `iter` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#into_iter_on_ref [INFO] [stdout] = note: `#[warn(clippy::into_iter_on_ref)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do [INFO] [stdout] --> src/world/display.rs:30:32 [INFO] [stdout] | [INFO] [stdout] 30 | pub fn print_board_pair(first: &Vec>, second: &Vec>) { [INFO] [stdout] | ^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg [INFO] [stdout] help: change this to [INFO] [stdout] | [INFO] [stdout] 30 - pub fn print_board_pair(first: &Vec>, second: &Vec>) { [INFO] [stdout] 30 + pub fn print_board_pair(first: &[Vec], second: &Vec>) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do [INFO] [stdout] --> src/world/display.rs:30:56 [INFO] [stdout] | [INFO] [stdout] 30 | pub fn print_board_pair(first: &Vec>, second: &Vec>) { [INFO] [stdout] | ^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg [INFO] [stdout] help: change this to [INFO] [stdout] | [INFO] [stdout] 30 - pub fn print_board_pair(first: &Vec>, second: &Vec>) { [INFO] [stdout] 30 + pub fn print_board_pair(first: &Vec>, second: &[Vec]) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `.into_iter()` call is equivalent to `.iter()` and will not consume the `Vec` [INFO] [stdout] --> src/world/display.rs:33:14 [INFO] [stdout] | [INFO] [stdout] 33 | .into_iter() [INFO] [stdout] | ^^^^^^^^^ help: call directly: `iter` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#into_iter_on_ref [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `.into_iter()` call is equivalent to `.iter()` and will not consume the `Vec` [INFO] [stdout] --> src/world/display.rs:37:14 [INFO] [stdout] | [INFO] [stdout] 37 | .into_iter() [INFO] [stdout] | ^^^^^^^^^ help: call directly: `iter` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#into_iter_on_ref [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: casting integer literal to `u16` is unnecessary [INFO] [stdout] --> src/world/display.rs:49:29 [INFO] [stdout] | [INFO] [stdout] 49 | let mut lvl = vec![vec![0 as u16; shape.x]; shape.y]; [INFO] [stdout] | ^^^^^^^^ help: try: `0_u16` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast [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/world/display.rs:51:9 [INFO] [stdout] | [INFO] [stdout] 51 | / match player.state { [INFO] [stdout] 52 | | PlayerState::Falling(h, coord) => { [INFO] [stdout] 53 | | if h != height { continue; } [INFO] [stdout] 54 | | lvl[coord.y][coord.x] = player.player_id; [INFO] [stdout] 55 | | }, [INFO] [stdout] 56 | | _ => (), [INFO] [stdout] 57 | | } [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] 51 ~ if let PlayerState::Falling(h, coord) = player.state { [INFO] [stdout] 52 + if h != height { continue; } [INFO] [stdout] 53 + lvl[coord.y][coord.x] = player.player_id; [INFO] [stdout] 54 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Coord` which implements the `Copy` trait [INFO] [stdout] --> src/world/position.rs:74:25 [INFO] [stdout] | [INFO] [stdout] 74 | let mut coord = 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 `Coord` which implements the `Copy` trait [INFO] [stdout] --> src/world/position.rs:112:27 [INFO] [stdout] | [INFO] [stdout] 112 | let mut cur = 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 `Coord` which implements the `Copy` trait [INFO] [stdout] --> src/world/position.rs:116:24 [INFO] [stdout] | [INFO] [stdout] 116 | v.push(cur.clone()); [INFO] [stdout] | ^^^^^^^^^^^ help: try removing the `clone` call: `cur` [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/world/position.rs:142:9 [INFO] [stdout] | [INFO] [stdout] 142 | return (a.x - a.y).abs() [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] 142 - return (a.x - a.y).abs() [INFO] [stdout] 142 + (a.x - a.y).abs() [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: match expression looks like `matches!` macro [INFO] [stdout] --> src/world/pieces.rs:54:9 [INFO] [stdout] | [INFO] [stdout] 54 | / match self { [INFO] [stdout] 55 | | PieceType::Rook => true, [INFO] [stdout] 56 | | _ => false [INFO] [stdout] 57 | | } [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] 54 - match self { [INFO] [stdout] 55 - PieceType::Rook => true, [INFO] [stdout] 56 - _ => false [INFO] [stdout] 57 - } [INFO] [stdout] 54 + matches!(self, PieceType::Rook) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: length comparison to zero [INFO] [stdout] --> src/world/pieces.rs:95:16 [INFO] [stdout] | [INFO] [stdout] 95 | if cross.len() == 0 { [INFO] [stdout] | ^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `cross.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] [INFO] [stdout] [INFO] [stdout] warning: length comparison to zero [INFO] [stdout] --> src/world/pieces.rs:108:9 [INFO] [stdout] | [INFO] [stdout] 108 | / king [INFO] [stdout] 109 | | .others_threatening_me_at(world, king.position().unwrap()) [INFO] [stdout] 110 | | .len() > 0 [INFO] [stdout] | |______________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero [INFO] [stdout] help: using `!is_empty` is clearer and more explicit [INFO] [stdout] | [INFO] [stdout] 108 ~ !king [INFO] [stdout] 109 + .others_threatening_me_at(world, king.position().unwrap()).is_empty() [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this boolean expression can be simplified [INFO] [stdout] --> src/world/pieces.rs:140:20 [INFO] [stdout] | [INFO] [stdout] 140 | if !(off.chebyshev() == 2) { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(off.chebyshev() != 2)` [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/world/pieces.rs:192:17 [INFO] [stdout] | [INFO] [stdout] 192 | / return self.threatening(world) [INFO] [stdout] 193 | | .iter() [INFO] [stdout] 194 | | .any(|c: &Coord | c.x == coord.x && c.y == coord.y); [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] 192 ~ self.threatening(world) [INFO] [stdout] 193 + .iter() [INFO] [stdout] 194 ~ .any(|c: &Coord | c.x == coord.x && c.y == coord.y) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` can be collapsed into the outer `match` [INFO] [stdout] --> src/world/pieces.rs:121:17 [INFO] [stdout] | [INFO] [stdout] 121 | / if target_piece.player == self.player { [INFO] [stdout] 122 | | return false [INFO] [stdout] 123 | | } [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] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 120 ~ Some(target_piece) [INFO] [stdout] 121 ~ if target_piece.player == self.player => { [INFO] [stdout] 122 | return false [INFO] [stdout] 123 ~ }, [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/world/pieces.rs:119:9 [INFO] [stdout] | [INFO] [stdout] 119 | / match world.pieces.get(&world.pieces_map[coord.y][coord.x]) { [INFO] [stdout] 120 | | Some(target_piece) => { [INFO] [stdout] 121 | | if target_piece.player == self.player { [INFO] [stdout] 122 | | return false [INFO] [stdout] ... | [INFO] [stdout] 125 | | _ => (), [INFO] [stdout] 126 | | } [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] 119 ~ if let Some(target_piece) = world.pieces.get(&world.pieces_map[coord.y][coord.x]) { [INFO] [stdout] 120 + if target_piece.player == self.player { [INFO] [stdout] 121 + return false [INFO] [stdout] 122 + } [INFO] [stdout] 123 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: length comparison to zero [INFO] [stdout] --> src/world/pieces.rs:132:24 [INFO] [stdout] | [INFO] [stdout] 132 | && self.others_threatening_me_at(world, coord).len() == 0 [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `self.others_threatening_me_at(world, coord).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] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Coord` which implements the `Copy` trait [INFO] [stdout] --> src/world/pieces.rs:145:35 [INFO] [stdout] | [INFO] [stdout] 145 | let mut current = pos.clone(); [INFO] [stdout] | ^^^^^^^^^^^ help: try dereferencing it: `*pos` [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: length comparison to zero [INFO] [stdout] --> src/world/pieces.rs:148:24 [INFO] [stdout] | [INFO] [stdout] 148 | if self.others_threatening_me_at(world, ¤t).len() > 0 { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!self.others_threatening_me_at(world, ¤t).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] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/world/pieces.rs:154:51 [INFO] [stdout] | [INFO] [stdout] 154 | match world.pieces_map.find_first(&coord, dir) { [INFO] [stdout] | ^^^^^^ help: change this to: `coord` [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/world/pieces.rs:302:9 [INFO] [stdout] | [INFO] [stdout] 302 | return coords [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] 302 - return coords [INFO] [stdout] 302 + coords [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Coord` which implements the `Copy` trait [INFO] [stdout] --> src/world/pieces.rs:258:38 [INFO] [stdout] | [INFO] [stdout] 258 | let mut current: Coord = pos.clone(); [INFO] [stdout] | ^^^^^^^^^^^ help: try dereferencing it: `*pos` [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 `Direction` which implements the `Copy` trait [INFO] [stdout] --> src/world/direction.rs:67:18 [INFO] [stdout] | [INFO] [stdout] 67 | _ => 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: match expression looks like `matches!` macro [INFO] [stdout] --> src/world/direction.rs:95:17 [INFO] [stdout] | [INFO] [stdout] 95 | / match other { [INFO] [stdout] 96 | | Direction::North => true, [INFO] [stdout] 97 | | _ => false, [INFO] [stdout] 98 | | } [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] 95 - match other { [INFO] [stdout] 96 - Direction::North => true, [INFO] [stdout] 97 - _ => false, [INFO] [stdout] 98 - } [INFO] [stdout] 95 + matches!(other, Direction::North) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: match expression looks like `matches!` macro [INFO] [stdout] --> src/world/direction.rs:101:17 [INFO] [stdout] | [INFO] [stdout] 101 | / match other { [INFO] [stdout] 102 | | Direction::NorthEast => true, [INFO] [stdout] 103 | | _ => false, [INFO] [stdout] 104 | | } [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] 101 - match other { [INFO] [stdout] 102 - Direction::NorthEast => true, [INFO] [stdout] 103 - _ => false, [INFO] [stdout] 104 - } [INFO] [stdout] 101 + matches!(other, Direction::NorthEast) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: match expression looks like `matches!` macro [INFO] [stdout] --> src/world/direction.rs:107:17 [INFO] [stdout] | [INFO] [stdout] 107 | / match other { [INFO] [stdout] 108 | | Direction::NorthWest => true, [INFO] [stdout] 109 | | _ => false, [INFO] [stdout] 110 | | } [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] 107 - match other { [INFO] [stdout] 108 - Direction::NorthWest => true, [INFO] [stdout] 109 - _ => false, [INFO] [stdout] 110 - } [INFO] [stdout] 107 + matches!(other, Direction::NorthWest) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: match expression looks like `matches!` macro [INFO] [stdout] --> src/world/direction.rs:113:17 [INFO] [stdout] | [INFO] [stdout] 113 | / match other { [INFO] [stdout] 114 | | Direction::South => true, [INFO] [stdout] 115 | | _ => false, [INFO] [stdout] 116 | | } [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] 113 - match other { [INFO] [stdout] 114 - Direction::South => true, [INFO] [stdout] 115 - _ => false, [INFO] [stdout] 116 - } [INFO] [stdout] 113 + matches!(other, Direction::South) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: match expression looks like `matches!` macro [INFO] [stdout] --> src/world/direction.rs:119:17 [INFO] [stdout] | [INFO] [stdout] 119 | / match other { [INFO] [stdout] 120 | | Direction::SouthWest => true, [INFO] [stdout] 121 | | _ => false, [INFO] [stdout] 122 | | } [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] 119 - match other { [INFO] [stdout] 120 - Direction::SouthWest => true, [INFO] [stdout] 121 - _ => false, [INFO] [stdout] 122 - } [INFO] [stdout] 119 + matches!(other, Direction::SouthWest) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: match expression looks like `matches!` macro [INFO] [stdout] --> src/world/direction.rs:125:17 [INFO] [stdout] | [INFO] [stdout] 125 | / match other { [INFO] [stdout] 126 | | Direction::SouthEast => true, [INFO] [stdout] 127 | | _ => false, [INFO] [stdout] 128 | | } [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] 125 - match other { [INFO] [stdout] 126 - Direction::SouthEast => true, [INFO] [stdout] 127 - _ => false, [INFO] [stdout] 128 - } [INFO] [stdout] 125 + matches!(other, Direction::SouthEast) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: match expression looks like `matches!` macro [INFO] [stdout] --> src/world/direction.rs:131:17 [INFO] [stdout] | [INFO] [stdout] 131 | / match other { [INFO] [stdout] 132 | | Direction::West => true, [INFO] [stdout] 133 | | _ => false, [INFO] [stdout] 134 | | } [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] 131 - match other { [INFO] [stdout] 132 - Direction::West => true, [INFO] [stdout] 133 - _ => false, [INFO] [stdout] 134 - } [INFO] [stdout] 131 + matches!(other, Direction::West) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: match expression looks like `matches!` macro [INFO] [stdout] --> src/world/direction.rs:137:17 [INFO] [stdout] | [INFO] [stdout] 137 | / match other { [INFO] [stdout] 138 | | Direction::East => true, [INFO] [stdout] 139 | | _ => false, [INFO] [stdout] 140 | | } [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] 137 - match other { [INFO] [stdout] 138 - Direction::East => true, [INFO] [stdout] 139 - _ => false, [INFO] [stdout] 140 - } [INFO] [stdout] 137 + matches!(other, Direction::East) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: match expression looks like `matches!` macro [INFO] [stdout] --> src/world/player.rs:15:9 [INFO] [stdout] | [INFO] [stdout] 15 | / match self { [INFO] [stdout] 16 | | PlayerState::Flying => true, [INFO] [stdout] 17 | | _ => false, [INFO] [stdout] 18 | | } [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] 15 - match self { [INFO] [stdout] 16 - PlayerState::Flying => true, [INFO] [stdout] 17 - _ => false, [INFO] [stdout] 18 - } [INFO] [stdout] 15 + matches!(self, PlayerState::Flying) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: match expression looks like `matches!` macro [INFO] [stdout] --> src/world/player.rs:36:9 [INFO] [stdout] | [INFO] [stdout] 36 | / match self { [INFO] [stdout] 37 | | PlayerState::Boarded => true, [INFO] [stdout] 38 | | _ => false, [INFO] [stdout] 39 | | } [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] 36 - match self { [INFO] [stdout] 37 - PlayerState::Boarded => true, [INFO] [stdout] 38 - _ => false, [INFO] [stdout] 39 - } [INFO] [stdout] 36 + matches!(self, PlayerState::Boarded) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: match expression looks like `matches!` macro [INFO] [stdout] --> src/world/player.rs:43:9 [INFO] [stdout] | [INFO] [stdout] 43 | / match self { [INFO] [stdout] 44 | | PlayerState::Flying => true, [INFO] [stdout] 45 | | PlayerState::Falling(_h, _coord) => true, [INFO] [stdout] 46 | | _ => false, [INFO] [stdout] 47 | | } [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] 43 - match self { [INFO] [stdout] 44 - PlayerState::Flying => true, [INFO] [stdout] 45 - PlayerState::Falling(_h, _coord) => true, [INFO] [stdout] 46 - _ => false, [INFO] [stdout] 47 - } [INFO] [stdout] 43 + matches!(self, PlayerState::Flying | PlayerState::Falling(_h, _coord)) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: match expression looks like `matches!` macro [INFO] [stdout] --> src/world/player.rs:51:9 [INFO] [stdout] | [INFO] [stdout] 51 | / match self { [INFO] [stdout] 52 | | PlayerState::Dead(_rank) => false, [INFO] [stdout] 53 | | _ => true, [INFO] [stdout] 54 | | } [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] 51 - match self { [INFO] [stdout] 52 - PlayerState::Dead(_rank) => false, [INFO] [stdout] 53 - _ => true, [INFO] [stdout] 54 - } [INFO] [stdout] 51 + !matches!(self, PlayerState::Dead(_rank)) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you should consider adding a `Default` implementation for `GamerNamer` [INFO] [stdout] --> src/world/player.rs:116:5 [INFO] [stdout] | [INFO] [stdout] 116 | / pub fn new() -> Self { [INFO] [stdout] 117 | | let mut rng = rand::thread_rng(); [INFO] [stdout] 118 | | let mut adj_idxs: Vec = (0..GAME_NAME_ADJ.len()).collect(); [INFO] [stdout] 119 | | adj_idxs.shuffle(&mut rng); [INFO] [stdout] ... | [INFO] [stdout] 128 | | } [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default [INFO] [stdout] = note: `#[warn(clippy::new_without_default)]` on by default [INFO] [stdout] help: try adding this [INFO] [stdout] | [INFO] [stdout] 115 + impl Default for GamerNamer { [INFO] [stdout] 116 + fn default() -> Self { [INFO] [stdout] 117 + Self::new() [INFO] [stdout] 118 + } [INFO] [stdout] 119 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: method `next` can be confused for the standard trait method `std::iter::Iterator::next` [INFO] [stdout] --> src/world/player.rs:130:5 [INFO] [stdout] | [INFO] [stdout] 130 | / pub fn next(&mut self) -> String { [INFO] [stdout] 131 | | let ret = format!( [INFO] [stdout] 132 | | "{} {}", [INFO] [stdout] 133 | | GAME_NAME_ADJ[self.adj_idxs[self.adj_idx]], [INFO] [stdout] ... | [INFO] [stdout] 140 | | ret [INFO] [stdout] 141 | | } [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: consider implementing the trait `std::iter::Iterator` or choosing a less ambiguous method name [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#should_implement_trait [INFO] [stdout] = note: `#[warn(clippy::should_implement_trait)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: casting integer literal to `u16` is unnecessary [INFO] [stdout] --> src/world/fog.rs:27:31 [INFO] [stdout] | [INFO] [stdout] 27 | let zones = vec![vec![0 as u16; shape.x]; shape.y]; [INFO] [stdout] | ^^^^^^^^ help: try: `0_u16` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: casting integer literal to `u16` is unnecessary [INFO] [stdout] --> src/world/fog.rs:69:43 [INFO] [stdout] | [INFO] [stdout] 69 | let mut ret = self.zones.new_with(0 as u16); [INFO] [stdout] | ^^^^^^^^ help: try: `0_u16` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Coord` which implements the `Copy` trait [INFO] [stdout] --> src/world/flyer.rs:19:26 [INFO] [stdout] | [INFO] [stdout] 19 | self.map_shape = shape.clone(); [INFO] [stdout] | ^^^^^^^^^^^^^ help: try removing the `clone` call: `shape` [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: casting integer literal to `u16` is unnecessary [INFO] [stdout] --> src/world/flyer.rs:46:37 [INFO] [stdout] | [INFO] [stdout] 46 | let mut pathmap = vec![vec![0 as u16; self.map_shape.x]; self.map_shape.y]; [INFO] [stdout] | ^^^^^^^^ help: try: `0_u16` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/world.rs:104:58 [INFO] [stdout] | [INFO] [stdout] 104 | Action::Move(uid, _from, _to) => return *uid != user, [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] 104 - Action::Move(uid, _from, _to) => return *uid != user, [INFO] [stdout] 104 + Action::Move(uid, _from, _to) => *uid != user, [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/world.rs:105:30 [INFO] [stdout] | [INFO] [stdout] 105 | _ => return true [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] 105 - _ => return true [INFO] [stdout] 105 + _ => true [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/world.rs:112:42 [INFO] [stdout] | [INFO] [stdout] 112 | Action::Drop(uid) => return *uid == user, [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] 112 - Action::Drop(uid) => return *uid == user, [INFO] [stdout] 112 + Action::Drop(uid) => *uid == user, [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/world.rs:113:47 [INFO] [stdout] | [INFO] [stdout] 113 | Action::Fly(uid, _off) => return *uid == user, [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] 113 - Action::Fly(uid, _off) => return *uid == user, [INFO] [stdout] 113 + Action::Fly(uid, _off) => *uid == user, [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/world.rs:114:26 [INFO] [stdout] | [INFO] [stdout] 114 | _ => return true, [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] 114 - _ => return true, [INFO] [stdout] 114 + _ => true, [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/world.rs:117:54 [INFO] [stdout] | [INFO] [stdout] 117 | Action::Move(uid, _from, _to) => return *uid == user, [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] 117 - Action::Move(uid, _from, _to) => return *uid == user, [INFO] [stdout] 117 + Action::Move(uid, _from, _to) => *uid == user, [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/world.rs:118:26 [INFO] [stdout] | [INFO] [stdout] 118 | _ => return true, [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] 118 - _ => return true, [INFO] [stdout] 118 + _ => true, [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/world.rs:133:17 [INFO] [stdout] | [INFO] [stdout] 133 | return true [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] 133 - return true [INFO] [stdout] 133 + true [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/world.rs:139:9 [INFO] [stdout] | [INFO] [stdout] 139 | / match action { [INFO] [stdout] 140 | | Action::Move(user, from, to) => { [INFO] [stdout] 141 | | let piece_id = self.pieces_map[from.y][from.x]; [INFO] [stdout] 142 | | if piece_id == 0 { return; } [INFO] [stdout] ... | [INFO] [stdout] 178 | | _ => () [INFO] [stdout] 179 | | } [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] 139 ~ if let Action::Move(user, from, to) = action { [INFO] [stdout] 140 + let piece_id = self.pieces_map[from.y][from.x]; [INFO] [stdout] 141 + if piece_id == 0 { return; } [INFO] [stdout] 142 + let mut other_piece_id = 0 as u16; [INFO] [stdout] 143 + let mut kind = PieceType::Empty; [INFO] [stdout] 144 + match self.pieces.get_mut(&piece_id) { [INFO] [stdout] 145 + Some(piece) => { [INFO] [stdout] 146 + if piece.player != user || !piece.alive { return; } [INFO] [stdout] 147 + match piece.kind.intermediat_steps(from, to) { [INFO] [stdout] 148 + None => (), [INFO] [stdout] 149 + Some(steps) => { [INFO] [stdout] 150 + for step in steps { [INFO] [stdout] 151 + if self.pieces_map[step.y][step.x] > 0 { [INFO] [stdout] 152 + return ; [INFO] [stdout] 153 + } [INFO] [stdout] 154 + } [INFO] [stdout] 155 + [INFO] [stdout] 156 + // Taking (preparing, actual happens below) [INFO] [stdout] 157 + other_piece_id = self.pieces_map[to.y][to.x]; [INFO] [stdout] 158 + kind = piece.kind.clone(); [INFO] [stdout] 159 + [INFO] [stdout] 160 + // Moving [INFO] [stdout] 161 + piece.place(to.clone()); [INFO] [stdout] 162 + self.pieces_map[to.y][to.x] = piece_id; [INFO] [stdout] 163 + self.pieces_map[from.y][from.x] = 0; [INFO] [stdout] 164 + self.historian.record_player( [INFO] [stdout] 165 + user, [INFO] [stdout] 166 + self.tick, [INFO] [stdout] 167 + piece.kind, [INFO] [stdout] 168 + format!("Move {:?} -> {:?}", from, to), [INFO] [stdout] 169 + ) [INFO] [stdout] 170 + } [INFO] [stdout] 171 + } [INFO] [stdout] 172 + } [INFO] [stdout] 173 + _ => (), [INFO] [stdout] 174 + } [INFO] [stdout] 175 + self.do_take(other_piece_id, user, kind); [INFO] [stdout] 176 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: casting integer literal to `u16` is unnecessary [INFO] [stdout] --> src/world.rs:143:42 [INFO] [stdout] | [INFO] [stdout] 143 | let mut other_piece_id = 0 as u16; [INFO] [stdout] | ^^^^^^^^ help: try: `0_u16` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast [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/world.rs:145:17 [INFO] [stdout] | [INFO] [stdout] 145 | / match self.pieces.get_mut(&piece_id) { [INFO] [stdout] 146 | | Some(piece) => { [INFO] [stdout] 147 | | if piece.player != user || !piece.alive { return; } [INFO] [stdout] 148 | | match piece.kind.intermediat_steps(from, to) { [INFO] [stdout] ... | [INFO] [stdout] 174 | | _ => (), [INFO] [stdout] 175 | | } [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] 145 ~ if let Some(piece) = self.pieces.get_mut(&piece_id) { [INFO] [stdout] 146 + if piece.player != user || !piece.alive { return; } [INFO] [stdout] 147 + match piece.kind.intermediat_steps(from, to) { [INFO] [stdout] 148 + None => (), [INFO] [stdout] 149 + Some(steps) => { [INFO] [stdout] 150 + for step in steps { [INFO] [stdout] 151 + if self.pieces_map[step.y][step.x] > 0 { [INFO] [stdout] 152 + return ; [INFO] [stdout] 153 + } [INFO] [stdout] 154 + } [INFO] [stdout] 155 + [INFO] [stdout] 156 + // Taking (preparing, actual happens below) [INFO] [stdout] 157 + other_piece_id = self.pieces_map[to.y][to.x]; [INFO] [stdout] 158 + kind = piece.kind.clone(); [INFO] [stdout] 159 + [INFO] [stdout] 160 + // Moving [INFO] [stdout] 161 + piece.place(to.clone()); [INFO] [stdout] 162 + self.pieces_map[to.y][to.x] = piece_id; [INFO] [stdout] 163 + self.pieces_map[from.y][from.x] = 0; [INFO] [stdout] 164 + self.historian.record_player( [INFO] [stdout] 165 + user, [INFO] [stdout] 166 + self.tick, [INFO] [stdout] 167 + piece.kind, [INFO] [stdout] 168 + format!("Move {:?} -> {:?}", from, to), [INFO] [stdout] 169 + ) [INFO] [stdout] 170 + } [INFO] [stdout] 171 + } [INFO] [stdout] 172 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `PieceType` which implements the `Copy` trait [INFO] [stdout] --> src/world.rs:159:40 [INFO] [stdout] | [INFO] [stdout] 159 | ... kind = piece.kind.clone(); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `piece.kind` [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 `Coord` which implements the `Copy` trait [INFO] [stdout] --> src/world.rs:162:45 [INFO] [stdout] | [INFO] [stdout] 162 | ... piece.place(to.clone()); [INFO] [stdout] | ^^^^^^^^^^ help: try removing the `clone` call: `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: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` [INFO] [stdout] --> src/world.rs:183:9 [INFO] [stdout] | [INFO] [stdout] 183 | / match self.pieces.get_mut(&other_piece_id) { [INFO] [stdout] 184 | | Some(other) => { [INFO] [stdout] 185 | | if !other.alive { return; } [INFO] [stdout] 186 | | let pos = other.position().unwrap().clone(); [INFO] [stdout] ... | [INFO] [stdout] 221 | | _ => (), [INFO] [stdout] 222 | | } [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] 183 ~ if let Some(other) = self.pieces.get_mut(&other_piece_id) { [INFO] [stdout] 184 + if !other.alive { return; } [INFO] [stdout] 185 + let pos = other.position().unwrap().clone(); [INFO] [stdout] 186 + other.alive = false; [INFO] [stdout] 187 + self.players.get_mut(&taker_id).unwrap().score += other.kind.value(); [INFO] [stdout] 188 + match other.kind { [INFO] [stdout] 189 + PieceType::Empty => (), [INFO] [stdout] 190 + PieceType::King => { [INFO] [stdout] 191 + if self.players.contains_key(&other.player) { [INFO] [stdout] 192 + let rank = self.players.iter() [INFO] [stdout] 193 + .filter(| (_, p) | p.state.is_alive()).count(); [INFO] [stdout] 194 + if rank == 2 { [INFO] [stdout] 195 + // Give rank 1 to self [INFO] [stdout] 196 + self.players.get_mut(&taker_id).unwrap() [INFO] [stdout] 197 + .transition(PlayerState::Dead(1)); [INFO] [stdout] 198 + self.alive = false; [INFO] [stdout] 199 + } [INFO] [stdout] 200 + self.players.get_mut(&other.player).unwrap() [INFO] [stdout] 201 + .transition(PlayerState::Dead(rank as u16)); [INFO] [stdout] 202 + } [INFO] [stdout] 203 + self.historian.record_player( [INFO] [stdout] 204 + taker_id, [INFO] [stdout] 205 + self.tick, [INFO] [stdout] 206 + taken_by, [INFO] [stdout] 207 + format!("Capture {:?} @ {:?}", other.kind, pos), [INFO] [stdout] 208 + ); [INFO] [stdout] 209 + }, [INFO] [stdout] 210 + _ => { [INFO] [stdout] 211 + self.historian.record_player( [INFO] [stdout] 212 + taker_id, [INFO] [stdout] 213 + self.tick, [INFO] [stdout] 214 + taken_by, [INFO] [stdout] 215 + format!("Capture {:?} @ {:?}", other.kind, pos), [INFO] [stdout] 216 + ) [INFO] [stdout] 217 + } [INFO] [stdout] 218 + } [INFO] [stdout] 219 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Coord` which implements the `Copy` trait [INFO] [stdout] --> src/world.rs:186:27 [INFO] [stdout] | [INFO] [stdout] 186 | let pos = other.position().unwrap().clone(); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try dereferencing it: `*other.position().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: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` [INFO] [stdout] --> src/world.rs:229:13 [INFO] [stdout] | [INFO] [stdout] 229 | / match action { [INFO] [stdout] 230 | | Action::Fly(user, off) => { [INFO] [stdout] 231 | | if !self.players.contains_key(&user) || !self.players[&user].state.can_fly() { continue; } [INFO] [stdout] 232 | | match self.players[&user].state { [INFO] [stdout] ... | [INFO] [stdout] 248 | | _ => (), [INFO] [stdout] 249 | | } [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] 229 ~ if let Action::Fly(user, off) = action { [INFO] [stdout] 230 + if !self.players.contains_key(&user) || !self.players[&user].state.can_fly() { continue; } [INFO] [stdout] 231 + match self.players[&user].state { [INFO] [stdout] 232 + PlayerState::Falling(h, coord) => { [INFO] [stdout] 233 + let next_coord = coord.translate(off); [INFO] [stdout] 234 + if next_coord.is_inside(&shape) { [INFO] [stdout] 235 + self.players.get_mut(&user).unwrap().transition(PlayerState::Falling(h, next_coord)); [INFO] [stdout] 236 + self.historian.record_player( [INFO] [stdout] 237 + user, [INFO] [stdout] 238 + self.tick, [INFO] [stdout] 239 + PieceType::King, [INFO] [stdout] 240 + format!("Fly -> {:?}", next_coord), [INFO] [stdout] 241 + ); [INFO] [stdout] 242 + } [INFO] [stdout] 243 + }, [INFO] [stdout] 244 + _ => (), [INFO] [stdout] 245 + } [INFO] [stdout] 246 + } [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/world.rs:232:21 [INFO] [stdout] | [INFO] [stdout] 232 | / match self.players[&user].state { [INFO] [stdout] 233 | | PlayerState::Falling(h, coord) => { [INFO] [stdout] 234 | | let next_coord = coord.translate(off); [INFO] [stdout] 235 | | if next_coord.is_inside(&shape) { [INFO] [stdout] ... | [INFO] [stdout] 245 | | _ => (), [INFO] [stdout] 246 | | } [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] 232 ~ if let PlayerState::Falling(h, coord) = self.players[&user].state { [INFO] [stdout] 233 + let next_coord = coord.translate(off); [INFO] [stdout] 234 + if next_coord.is_inside(&shape) { [INFO] [stdout] 235 + self.players.get_mut(&user).unwrap().transition(PlayerState::Falling(h, next_coord)); [INFO] [stdout] 236 + self.historian.record_player( [INFO] [stdout] 237 + user, [INFO] [stdout] 238 + self.tick, [INFO] [stdout] 239 + PieceType::King, [INFO] [stdout] 240 + format!("Fly -> {:?}", next_coord), [INFO] [stdout] 241 + ); [INFO] [stdout] 242 + } [INFO] [stdout] 243 + } [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/world.rs:256:13 [INFO] [stdout] | [INFO] [stdout] 256 | / match self.flyer.coord() { [INFO] [stdout] 257 | | Some(flyer) => { [INFO] [stdout] 258 | | let uids: Vec = self.players.iter().map(|(k, _)| k.clone()).collect(); [INFO] [stdout] 259 | | for uid in uids { [INFO] [stdout] ... | [INFO] [stdout] 270 | | _ => (), [INFO] [stdout] 271 | | } [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] 256 ~ if let Some(flyer) = self.flyer.coord() { [INFO] [stdout] 257 + let uids: Vec = self.players.iter().map(|(k, _)| k.clone()).collect(); [INFO] [stdout] 258 + for uid in uids { [INFO] [stdout] 259 + if !self.players.contains_key(&uid) || !self.players[&uid].state.is_flying() { continue; } [INFO] [stdout] 260 + self.players.get_mut(&uid).unwrap().transition(PlayerState::Falling(self.settings.drop_height, flyer.clone())); [INFO] [stdout] 261 + self.historian.record_player( [INFO] [stdout] 262 + uid, [INFO] [stdout] 263 + self.tick, [INFO] [stdout] 264 + PieceType::King, [INFO] [stdout] 265 + format!("Drop -> {:?}:{}", flyer, self.settings.drop_height), [INFO] [stdout] 266 + ); [INFO] [stdout] 267 + } [INFO] [stdout] 268 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: iterating on a map's keys [INFO] [stdout] --> src/world.rs:258:42 [INFO] [stdout] | [INFO] [stdout] 258 | let uids: Vec = self.players.iter().map(|(k, _)| k.clone()).collect(); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `self.players.keys().map(|k| k.clone())` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#iter_kv_map [INFO] [stdout] = note: `#[warn(clippy::iter_kv_map)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `u16` which implements the `Copy` trait [INFO] [stdout] --> src/world.rs:258:75 [INFO] [stdout] | [INFO] [stdout] 258 | let uids: Vec = self.players.iter().map(|(k, _)| k.clone()).collect(); [INFO] [stdout] | ^^^^^^^^^ help: try dereferencing it: `*k` [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 `Coord` which implements the `Copy` trait [INFO] [stdout] --> src/world.rs:261:120 [INFO] [stdout] | [INFO] [stdout] 261 | ...Falling(self.settings.drop_height, flyer.clone())); [INFO] [stdout] | ^^^^^^^^^^^^^ help: try removing the `clone` call: `flyer` [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 seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` [INFO] [stdout] --> src/world.rs:274:13 [INFO] [stdout] | [INFO] [stdout] 274 | / match self.flyer.coord() { [INFO] [stdout] 275 | | Some(flyer) => { [INFO] [stdout] 276 | | while let Some(action) = drop_actions.pop() { [INFO] [stdout] 277 | | match action { [INFO] [stdout] ... | [INFO] [stdout] 293 | | _ => (), [INFO] [stdout] 294 | | } [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] 274 ~ if let Some(flyer) = self.flyer.coord() { [INFO] [stdout] 275 + while let Some(action) = drop_actions.pop() { [INFO] [stdout] 276 + match action { [INFO] [stdout] 277 + Action::Drop(user) => { [INFO] [stdout] 278 + if !self.players.contains_key(&user) || !self.players[&user].state.is_flying() { continue; } [INFO] [stdout] 279 + self.players.get_mut(&user).unwrap().transition(PlayerState::Falling(self.settings.drop_height, flyer.clone())); [INFO] [stdout] 280 + self.historian.record_player( [INFO] [stdout] 281 + user, [INFO] [stdout] 282 + self.tick, [INFO] [stdout] 283 + PieceType::King, [INFO] [stdout] 284 + format!("Drop -> {:?}:{}", flyer, self.settings.drop_height), [INFO] [stdout] 285 + ); [INFO] [stdout] 286 + } [INFO] [stdout] 287 + _ => (), [INFO] [stdout] 288 + } [INFO] [stdout] 289 + } [INFO] [stdout] 290 + [INFO] [stdout] 291 + } [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/world.rs:277:25 [INFO] [stdout] | [INFO] [stdout] 277 | / ... match action { [INFO] [stdout] 278 | | ... Action::Drop(user) => { [INFO] [stdout] 279 | | ... if !self.players.contains_key(&user) || !self.players[&user].state.is_flying() { continue; } [INFO] [stdout] 280 | | ... self.players.get_mut(&user).unwrap().transition(PlayerState::Falling(self.settings.drop_height, flyer.clone())); [INFO] [stdout] ... | [INFO] [stdout] 288 | | ... _ => (), [INFO] [stdout] 289 | | ... } [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] 277 ~ if let Action::Drop(user) = action { [INFO] [stdout] 278 + if !self.players.contains_key(&user) || !self.players[&user].state.is_flying() { continue; } [INFO] [stdout] 279 + self.players.get_mut(&user).unwrap().transition(PlayerState::Falling(self.settings.drop_height, flyer.clone())); [INFO] [stdout] 280 + self.historian.record_player( [INFO] [stdout] 281 + user, [INFO] [stdout] 282 + self.tick, [INFO] [stdout] 283 + PieceType::King, [INFO] [stdout] 284 + format!("Drop -> {:?}:{}", flyer, self.settings.drop_height), [INFO] [stdout] 285 + ); [INFO] [stdout] 286 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Coord` which implements the `Copy` trait [INFO] [stdout] --> src/world.rs:280:129 [INFO] [stdout] | [INFO] [stdout] 280 | ... self.players.get_mut(&user).unwrap().transition(PlayerState::Falling(self.settings.drop_height, flyer.clone())); [INFO] [stdout] | ^^^^^^^^^^^^^ help: try removing the `clone` call: `flyer` [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: iterating on a map's keys [INFO] [stdout] --> src/world.rs:299:30 [INFO] [stdout] | [INFO] [stdout] 299 | let uids: Vec = self.players.iter().map(|(k, _)| k.clone()).collect(); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `self.players.keys().map(|k| k.clone())` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#iter_kv_map [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `u16` which implements the `Copy` trait [INFO] [stdout] --> src/world.rs:299:63 [INFO] [stdout] | [INFO] [stdout] 299 | let uids: Vec = self.players.iter().map(|(k, _)| k.clone()).collect(); [INFO] [stdout] | ^^^^^^^^^ help: try dereferencing it: `*k` [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 seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` [INFO] [stdout] --> src/world.rs:301:13 [INFO] [stdout] | [INFO] [stdout] 301 | / match self.players[uid].state { [INFO] [stdout] 302 | | PlayerState::Falling(h, coord) => { [INFO] [stdout] 303 | | if h > 1 { [INFO] [stdout] 304 | | self.players.get_mut(uid).unwrap().transition(PlayerState::Falling(h - 1, coord)); [INFO] [stdout] ... | [INFO] [stdout] 334 | | _ => (), [INFO] [stdout] 335 | | } [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] 301 ~ if let PlayerState::Falling(h, coord) = self.players[uid].state { [INFO] [stdout] 302 + if h > 1 { [INFO] [stdout] 303 + self.players.get_mut(uid).unwrap().transition(PlayerState::Falling(h - 1, coord)); [INFO] [stdout] 304 + self.historian.record_player( [INFO] [stdout] 305 + *uid, [INFO] [stdout] 306 + self.tick, [INFO] [stdout] 307 + PieceType::King, [INFO] [stdout] 308 + format!("Fall -> {:?}:{}", coord, h - 1), [INFO] [stdout] 309 + ) [INFO] [stdout] 310 + } else { [INFO] [stdout] 311 + self.players.get_mut(uid).unwrap().transition(PlayerState::Boarded); [INFO] [stdout] 312 + let mut piece = Piece::new(PieceType::King, *uid); [INFO] [stdout] 313 + piece.place(coord.clone()); [INFO] [stdout] 314 + let piece_id = self.pieces.len() as u16 + 1; [INFO] [stdout] 315 + self.pieces.insert(piece_id, piece); [INFO] [stdout] 316 + self.players.get_mut(uid).unwrap().king_id = piece_id; [INFO] [stdout] 317 + if self.pieces_map[coord.y][coord.x] > 0 { [INFO] [stdout] 318 + self.do_take( [INFO] [stdout] 319 + self.pieces_map[coord.y][coord.x], [INFO] [stdout] 320 + *uid, [INFO] [stdout] 321 + PieceType::King, [INFO] [stdout] 322 + ) [INFO] [stdout] 323 + } [INFO] [stdout] 324 + self.pieces_map[coord.y][coord.x] = piece_id; [INFO] [stdout] 325 + self.historian.record_player( [INFO] [stdout] 326 + *uid, [INFO] [stdout] 327 + self.tick, [INFO] [stdout] 328 + PieceType::King, [INFO] [stdout] 329 + format!("Land -> {:?}", coord), [INFO] [stdout] 330 + ); [INFO] [stdout] 331 + } [INFO] [stdout] 332 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Coord` which implements the `Copy` trait [INFO] [stdout] --> src/world.rs:314:37 [INFO] [stdout] | [INFO] [stdout] 314 | piece.place(coord.clone()); [INFO] [stdout] | ^^^^^^^^^^^^^ help: try removing the `clone` call: `coord` [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: manual implementation of `.is_multiple_of()` [INFO] [stdout] --> src/world.rs:343:16 [INFO] [stdout] | [INFO] [stdout] 343 | if (self.tick % self.settings.flyer_every) == 0 { self.flyer.tick(); } [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `self.tick.is_multiple_of(self.settings.flyer_every)` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_is_multiple_of [INFO] [stdout] = note: `#[warn(clippy::manual_is_multiple_of)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of `.is_multiple_of()` [INFO] [stdout] --> src/world.rs:345:16 [INFO] [stdout] | [INFO] [stdout] 345 | if (self.tick % self.settings.zone_every) == 0 { self.fog.contract(self.settings.zone_rest); } [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `self.tick.is_multiple_of(self.settings.zone_every)` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_is_multiple_of [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you are using an explicit closure for copying elements [INFO] [stdout] --> src/world.rs:349:41 [INFO] [stdout] | [INFO] [stdout] 349 | let drop_actions: Vec = self.req_air_action [INFO] [stdout] | _________________________________________^ [INFO] [stdout] 350 | | .iter() [INFO] [stdout] 351 | | .filter(| e | match e { Action::Drop(_u) => true, _ => false }) [INFO] [stdout] 352 | | .map(|e | e.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] 349 ~ let drop_actions: Vec = self.req_air_action [INFO] [stdout] 350 + .iter() [INFO] [stdout] 351 + .filter(| e | match e { Action::Drop(_u) => true, _ => false }).copied() [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: match expression looks like `matches!` macro [INFO] [stdout] --> src/world.rs:351:27 [INFO] [stdout] | [INFO] [stdout] 351 | .filter(| e | match e { Action::Drop(_u) => true, _ => false }) [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] 351 - .filter(| e | match e { Action::Drop(_u) => true, _ => false }) [INFO] [stdout] 351 + .filter(| e | matches!(e, Action::Drop(_u))) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Action` which implements the `Copy` trait [INFO] [stdout] --> src/world.rs:352:23 [INFO] [stdout] | [INFO] [stdout] 352 | .map(|e | e.clone()) [INFO] [stdout] | ^^^^^^^^^ help: try dereferencing it: `*e` [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/world.rs:354:40 [INFO] [stdout] | [INFO] [stdout] 354 | let fly_actions: Vec = self.req_air_action [INFO] [stdout] | ________________________________________^ [INFO] [stdout] 355 | | .iter() [INFO] [stdout] 356 | | .filter(| e | match e { Action::Fly(_u, _off) => true, _ => false }) [INFO] [stdout] 357 | | .map(|e | e.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] help: consider calling the dedicated `copied` method [INFO] [stdout] | [INFO] [stdout] 354 ~ let fly_actions: Vec = self.req_air_action [INFO] [stdout] 355 + .iter() [INFO] [stdout] 356 + .filter(| e | match e { Action::Fly(_u, _off) => true, _ => false }).copied() [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: match expression looks like `matches!` macro [INFO] [stdout] --> src/world.rs:356:27 [INFO] [stdout] | [INFO] [stdout] 356 | .filter(| e | match e { Action::Fly(_u, _off) => true, _ => false }) [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] 356 - .filter(| e | match e { Action::Fly(_u, _off) => true, _ => false }) [INFO] [stdout] 356 + .filter(| e | matches!(e, Action::Fly(_u, _off))) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Action` which implements the `Copy` trait [INFO] [stdout] --> src/world.rs:357:23 [INFO] [stdout] | [INFO] [stdout] 357 | .map(|e | e.clone()) [INFO] [stdout] | ^^^^^^^^^ help: try dereferencing it: `*e` [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 seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` [INFO] [stdout] --> src/world.rs:367:9 [INFO] [stdout] | [INFO] [stdout] 367 | / match action { [INFO] [stdout] 368 | | Some(action) => self.do_board_move(action), [INFO] [stdout] 369 | | _ => () [INFO] [stdout] 370 | | } [INFO] [stdout] | |_________^ help: try: `if let Some(action) = action { self.do_board_move(action) }` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: iterating on a map's values [INFO] [stdout] --> src/world.rs:375:40 [INFO] [stdout] | [INFO] [stdout] 375 | let mut players: Vec = self.players [INFO] [stdout] | ________________________________________^ [INFO] [stdout] 376 | | .iter() [INFO] [stdout] 377 | | .map(|(_, p)| p.clone()) [INFO] [stdout] | |____________________________________^ help: try: `self.players.values().map(|p| p.clone())` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#iter_kv_map [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: consider using `sort_by_key` [INFO] [stdout] --> src/world.rs:379:9 [INFO] [stdout] | [INFO] [stdout] 379 | players.sort_by(|a, b| b.score.cmp(&a.score)); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_sort_by [INFO] [stdout] = note: `#[warn(clippy::unnecessary_sort_by)]` on by default [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 379 - players.sort_by(|a, b| b.score.cmp(&a.score)); [INFO] [stdout] 379 + players.sort_by_key(|b| std::cmp::Reverse(b.score)); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/world.rs:395:9 [INFO] [stdout] | [INFO] [stdout] 395 | return pos [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] 395 - return pos [INFO] [stdout] 395 + pos [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/world.rs:387:17 [INFO] [stdout] | [INFO] [stdout] 387 | / match piece.position() { [INFO] [stdout] 388 | | Some(coord) => { [INFO] [stdout] 389 | | pos.push((piece.kind, coord.clone())) [INFO] [stdout] ... | [INFO] [stdout] 392 | | } [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] 387 ~ if let Some(coord) = piece.position() { [INFO] [stdout] 388 + pos.push((piece.kind, coord.clone())) [INFO] [stdout] 389 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Coord` which implements the `Copy` trait [INFO] [stdout] --> src/world.rs:389:47 [INFO] [stdout] | [INFO] [stdout] 389 | pos.push((piece.kind, coord.clone())) [INFO] [stdout] | ^^^^^^^^^^^^^ help: try dereferencing it: `*coord` [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: writing `&Vec` instead of `&[_]` involves a new object where a slice will do [INFO] [stdout] --> src/world.rs:412:50 [INFO] [stdout] | [INFO] [stdout] 412 | pub fn spawn(shape: Coord, nzones: u16, players: &Vec) -> World { [INFO] [stdout] | ^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg [INFO] [stdout] help: change this to [INFO] [stdout] | [INFO] [stdout] 412 - pub fn spawn(shape: Coord, nzones: u16, players: &Vec) -> World { [INFO] [stdout] 412 + pub fn spawn(shape: Coord, nzones: u16, players: &[String]) -> World { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `Coord` which implements the `Copy` trait [INFO] [stdout] --> src/main.rs:40:42 [INFO] [stdout] | [INFO] [stdout] 40 | world.request_action(Action::Move(2, p2[0].1.clone(), to)); [INFO] [stdout] | ^^^^^^^^^^^^^^^ help: try removing the `clone` call: `p2[0].1` [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: using `clone` on type `Coord` which implements the `Copy` trait [INFO] [stdout] --> src/main.rs:40:42 [INFO] [stdout] | [INFO] [stdout] 40 | world.request_action(Action::Move(2, p2[0].1.clone(), to)); [INFO] [stdout] | ^^^^^^^^^^^^^^^ help: try removing the `clone` call: `p2[0].1` [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] [stderr] Finished `dev` profile [unoptimized + debuginfo] target(s) in 3.15s [INFO] running `Command { std: "docker" "inspect" "c467cd616d8c8d90bfc32bb102d466e3745f32af64b71d950286c8bbd9596ac6", kill_on_drop: false }` [INFO] running `Command { std: "docker" "rm" "-f" "c467cd616d8c8d90bfc32bb102d466e3745f32af64b71d950286c8bbd9596ac6", kill_on_drop: false }` [INFO] [stdout] c467cd616d8c8d90bfc32bb102d466e3745f32af64b71d950286c8bbd9596ac6