[INFO] cloning repository https://github.com/emilbjornlinger/aoc_lib [INFO] running `Command { std: "git" "-c" "credential.helper=" "-c" "credential.helper=/workspace/cargo-home/bin/git-credential-null" "clone" "--bare" "https://github.com/emilbjornlinger/aoc_lib" "/workspace/cache/git-repos/https%3A%2F%2Fgithub.com%2Femilbjornlinger%2Faoc_lib", kill_on_drop: false }` [INFO] [stderr] Cloning into bare repository '/workspace/cache/git-repos/https%3A%2F%2Fgithub.com%2Femilbjornlinger%2Faoc_lib'... [INFO] running `Command { std: "git" "rev-parse" "HEAD", kill_on_drop: false }` [INFO] [stdout] 83817e7cd47d984a1e8faf68cb6faa4a730df3c8 [INFO] linting emilbjornlinger/aoc_lib against nightly for clippy-nonminimal_bool-denied [INFO] running `Command { std: "git" "clone" "/workspace/cache/git-repos/https%3A%2F%2Fgithub.com%2Femilbjornlinger%2Faoc_lib" "/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/emilbjornlinger/aoc_lib [INFO] finished tweaking git repo https://github.com/emilbjornlinger/aoc_lib [INFO] tweaked toml for git repo https://github.com/emilbjornlinger/aoc_lib written to /workspace/builds/worker-4-tc1/source/Cargo.toml [INFO] validating manifest of git repo https://github.com/emilbjornlinger/aoc_lib 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/emilbjornlinger/aoc_lib 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] d30fffc1492c54657dd6cfcf12e71f83bb65a45b16441a95538429b73fb593b2 [INFO] running `Command { std: "docker" "start" "-a" "d30fffc1492c54657dd6cfcf12e71f83bb65a45b16441a95538429b73fb593b2", kill_on_drop: false }` [INFO] running `Command { std: "docker" "inspect" "d30fffc1492c54657dd6cfcf12e71f83bb65a45b16441a95538429b73fb593b2", kill_on_drop: false }` [INFO] running `Command { std: "docker" "rm" "-f" "d30fffc1492c54657dd6cfcf12e71f83bb65a45b16441a95538429b73fb593b2", kill_on_drop: false }` [INFO] [stdout] d30fffc1492c54657dd6cfcf12e71f83bb65a45b16441a95538429b73fb593b2 [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] 5715bf77082db0af57edb884cefedeeb6a14a93ca94df77be9d636a95ab3a0fb [INFO] running `Command { std: "docker" "start" "-a" "5715bf77082db0af57edb884cefedeeb6a14a93ca94df77be9d636a95ab3a0fb", kill_on_drop: false }` [INFO] [stderr] Checking aoc_lib v0.1.0 (/opt/rustwide/workdir) [INFO] [stdout] warning: you should consider adding a `Default` implementation for `Grid` [INFO] [stdout] --> src/grid.rs:23:5 [INFO] [stdout] | [INFO] [stdout] 23 | / pub fn new() -> Self { [INFO] [stdout] 24 | | Grid { [INFO] [stdout] 25 | | grid: Vec::>::new(), [INFO] [stdout] 26 | | pos: Position { x: 0, y: 0 }, [INFO] [stdout] 27 | | } [INFO] [stdout] 28 | | } [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] 22 + impl Default for Grid { [INFO] [stdout] 23 + fn default() -> Self { [INFO] [stdout] 24 + Self::new() [INFO] [stdout] 25 + } [INFO] [stdout] 26 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this boolean expression can be simplified [INFO] [stdout] --> src/grid.rs:33:13 [INFO] [stdout] | [INFO] [stdout] 33 | !(self.grid.len() == 0) || !(self.grid[0].len() == 0), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(self.grid.len() != 0)` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#nonminimal_bool [INFO] [stdout] = note: `#[warn(clippy::nonminimal_bool)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this boolean expression can be simplified [INFO] [stdout] --> src/grid.rs:33:40 [INFO] [stdout] | [INFO] [stdout] 33 | !(self.grid.len() == 0) || !(self.grid[0].len() == 0), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(self.grid[0].len() != 0)` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#nonminimal_bool [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: returning the result of a `let` binding from a block [INFO] [stdout] --> src/grid.rs:78:9 [INFO] [stdout] | [INFO] [stdout] 43 | / let result = match dir { [INFO] [stdout] 44 | | Direction::Up => { [INFO] [stdout] 45 | | if self.pos.y as i64 - steps as i64 >= 0 { [INFO] [stdout] 46 | | self.pos.y = self.pos.y - steps; [INFO] [stdout] ... | [INFO] [stdout] 76 | | }; [INFO] [stdout] | |__________- unnecessary `let` binding [INFO] [stdout] 77 | [INFO] [stdout] 78 | result [INFO] [stdout] | ^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_and_return [INFO] [stdout] = note: `#[warn(clippy::let_and_return)]` on by default [INFO] [stdout] help: return the expression directly [INFO] [stdout] | [INFO] [stdout] 43 ~ [INFO] [stdout] 44 | [INFO] [stdout] 45 ~ match dir { [INFO] [stdout] 46 + Direction::Up => { [INFO] [stdout] 47 + if self.pos.y as i64 - steps as i64 >= 0 { [INFO] [stdout] 48 + self.pos.y = self.pos.y - steps; [INFO] [stdout] 49 + Ok(()) [INFO] [stdout] 50 + } else { [INFO] [stdout] 51 + Err("Out of bounds") [INFO] [stdout] 52 + } [INFO] [stdout] 53 + } [INFO] [stdout] 54 + Direction::Down => { [INFO] [stdout] 55 + if self.pos.y + steps < self.grid.len() { [INFO] [stdout] 56 + self.pos.y = self.pos.y + steps; [INFO] [stdout] 57 + Ok(()) [INFO] [stdout] 58 + } else { [INFO] [stdout] 59 + Err("Out of bounds") [INFO] [stdout] 60 + } [INFO] [stdout] 61 + } [INFO] [stdout] 62 + Direction::Left => { [INFO] [stdout] 63 + if self.pos.x as i64 - steps as i64 >= 0 { [INFO] [stdout] 64 + self.pos.x = self.pos.x - steps; [INFO] [stdout] 65 + Ok(()) [INFO] [stdout] 66 + } else { [INFO] [stdout] 67 + Err("Out of bounds") [INFO] [stdout] 68 + } [INFO] [stdout] 69 + } [INFO] [stdout] 70 + Direction::Right => { [INFO] [stdout] 71 + if self.pos.x + steps < self.grid[0].len() { [INFO] [stdout] 72 + self.pos.x = self.pos.x + steps; [INFO] [stdout] 73 + Ok(()) [INFO] [stdout] 74 + } else { [INFO] [stdout] 75 + Err("Out of bounds") [INFO] [stdout] 76 + } [INFO] [stdout] 77 + } [INFO] [stdout] 78 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: length comparison to zero [INFO] [stdout] --> src/grid.rs:33:15 [INFO] [stdout] | [INFO] [stdout] 33 | !(self.grid.len() == 0) || !(self.grid[0].len() == 0), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `self.grid.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: length comparison to zero [INFO] [stdout] --> src/grid.rs:33:42 [INFO] [stdout] | [INFO] [stdout] 33 | !(self.grid.len() == 0) || !(self.grid[0].len() == 0), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `self.grid[0].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 pattern reimplements `Option::unwrap_or` [INFO] [stdout] --> src/grid.rs:38:21 [INFO] [stdout] | [INFO] [stdout] 38 | let steps = match steps { [INFO] [stdout] | _____________________^ [INFO] [stdout] 39 | | Some(i) => i, [INFO] [stdout] 40 | | None => 1, [INFO] [stdout] 41 | | }; [INFO] [stdout] | |_________^ help: replace with: `steps.unwrap_or(1)` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_unwrap_or [INFO] [stdout] = note: `#[warn(clippy::manual_unwrap_or)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of an assign operation [INFO] [stdout] --> src/grid.rs:46:21 [INFO] [stdout] | [INFO] [stdout] 46 | self.pos.y = self.pos.y - steps; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `self.pos.y -= steps` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assign_op_pattern [INFO] [stdout] = note: `#[warn(clippy::assign_op_pattern)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of an assign operation [INFO] [stdout] --> src/grid.rs:54:21 [INFO] [stdout] | [INFO] [stdout] 54 | self.pos.y = self.pos.y + steps; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `self.pos.y += steps` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assign_op_pattern [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of an assign operation [INFO] [stdout] --> src/grid.rs:62:21 [INFO] [stdout] | [INFO] [stdout] 62 | self.pos.x = self.pos.x - steps; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `self.pos.x -= steps` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assign_op_pattern [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of an assign operation [INFO] [stdout] --> src/grid.rs:70:21 [INFO] [stdout] | [INFO] [stdout] 70 | self.pos.x = self.pos.x + steps; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `self.pos.x += steps` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assign_op_pattern [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this boolean expression can be simplified [INFO] [stdout] --> src/grid.rs:88:13 [INFO] [stdout] | [INFO] [stdout] 88 | !(self.grid.len() == 0) || !(self.grid[0].len() == 0), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(self.grid.len() != 0)` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#nonminimal_bool [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this boolean expression can be simplified [INFO] [stdout] --> src/grid.rs:88:40 [INFO] [stdout] | [INFO] [stdout] 88 | !(self.grid.len() == 0) || !(self.grid[0].len() == 0), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(self.grid[0].len() != 0)` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#nonminimal_bool [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: returning the result of a `let` binding from a block [INFO] [stdout] --> src/grid.rs:129:9 [INFO] [stdout] | [INFO] [stdout] 98 | / let result = match dir { [INFO] [stdout] 99 | | Direction::Up => { [INFO] [stdout] 100 | | if self.pos.y as i64 - steps as i64 >= 0 { [INFO] [stdout] 101 | | Ok(&self.grid[self.pos.y - steps][self.pos.x]) [INFO] [stdout] ... | [INFO] [stdout] 127 | | }; [INFO] [stdout] | |__________- unnecessary `let` binding [INFO] [stdout] 128 | [INFO] [stdout] 129 | result [INFO] [stdout] | ^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_and_return [INFO] [stdout] help: return the expression directly [INFO] [stdout] | [INFO] [stdout] 98 ~ [INFO] [stdout] 99 | [INFO] [stdout] 100 ~ match dir { [INFO] [stdout] 101 + Direction::Up => { [INFO] [stdout] 102 + if self.pos.y as i64 - steps as i64 >= 0 { [INFO] [stdout] 103 + Ok(&self.grid[self.pos.y - steps][self.pos.x]) [INFO] [stdout] 104 + } else { [INFO] [stdout] 105 + Err("Out of bounds") [INFO] [stdout] 106 + } [INFO] [stdout] 107 + } [INFO] [stdout] 108 + Direction::Down => { [INFO] [stdout] 109 + if self.pos.y + steps < self.grid.len() { [INFO] [stdout] 110 + Ok(&self.grid[self.pos.y + steps][self.pos.x]) [INFO] [stdout] 111 + } else { [INFO] [stdout] 112 + Err("Out of bounds") [INFO] [stdout] 113 + } [INFO] [stdout] 114 + } [INFO] [stdout] 115 + Direction::Left => { [INFO] [stdout] 116 + if self.pos.x as i64 - steps as i64 >= 0 { [INFO] [stdout] 117 + Ok(&self.grid[self.pos.y][self.pos.x - steps]) [INFO] [stdout] 118 + } else { [INFO] [stdout] 119 + Err("Out of bounds") [INFO] [stdout] 120 + } [INFO] [stdout] 121 + } [INFO] [stdout] 122 + Direction::Right => { [INFO] [stdout] 123 + if self.pos.x + steps < self.grid[0].len() { [INFO] [stdout] 124 + Ok(&self.grid[self.pos.y][self.pos.x + steps]) [INFO] [stdout] 125 + } else { [INFO] [stdout] 126 + Err("Out of bounds") [INFO] [stdout] 127 + } [INFO] [stdout] 128 + } [INFO] [stdout] 129 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: length comparison to zero [INFO] [stdout] --> src/grid.rs:88:15 [INFO] [stdout] | [INFO] [stdout] 88 | !(self.grid.len() == 0) || !(self.grid[0].len() == 0), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `self.grid.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/grid.rs:88:42 [INFO] [stdout] | [INFO] [stdout] 88 | !(self.grid.len() == 0) || !(self.grid[0].len() == 0), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `self.grid[0].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 pattern reimplements `Option::unwrap_or` [INFO] [stdout] --> src/grid.rs:93:21 [INFO] [stdout] | [INFO] [stdout] 93 | let steps = match steps { [INFO] [stdout] | _____________________^ [INFO] [stdout] 94 | | Some(i) => i, [INFO] [stdout] 95 | | None => 1, [INFO] [stdout] 96 | | }; [INFO] [stdout] | |_________^ help: replace with: `steps.unwrap_or(1)` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_unwrap_or [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/grid.rs:137:50 [INFO] [stdout] | [INFO] [stdout] 137 | let line: Vec = row.iter().map(|x| f(x)).collect(); [INFO] [stdout] | ^^^^^^^^ help: replace the closure with the function itself: `&f` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] = note: `#[warn(clippy::redundant_closure)]` 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/combination.rs:8:11 [INFO] [stdout] | [INFO] [stdout] 8 | vals: &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] = note: `#[warn(clippy::ptr_arg)]` on by default [INFO] [stdout] help: change this to [INFO] [stdout] | [INFO] [stdout] 8 - vals: &Vec, [INFO] [stdout] 8 + vals: &[T], [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/combination.rs:38:35 [INFO] [stdout] | [INFO] [stdout] 38 | pub fn unordered_pairs(values: &Vec) -> Vec<(&T, &T)> { [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] 38 - pub fn unordered_pairs(values: &Vec) -> Vec<(&T, &T)> { [INFO] [stdout] 38 + pub fn unordered_pairs(values: &[T]) -> Vec<(&T, &T)> { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: returning the result of a `let` binding from a block [INFO] [stdout] --> src/input.rs:18:5 [INFO] [stdout] | [INFO] [stdout] 14 | / let lines = reader.lines().map(|res| match res { [INFO] [stdout] 15 | | Ok(string) => string, [INFO] [stdout] 16 | | Err(_) => panic!("Couldn't parse lines from file") [INFO] [stdout] 17 | | }).collect(); [INFO] [stdout] | |_________________- unnecessary `let` binding [INFO] [stdout] 18 | lines [INFO] [stdout] | ^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_and_return [INFO] [stdout] help: return the expression directly [INFO] [stdout] | [INFO] [stdout] 14 ~ [INFO] [stdout] 15 ~ reader.lines().map(|res| match res { [INFO] [stdout] 16 + Ok(string) => string, [INFO] [stdout] 17 + Err(_) => panic!("Couldn't parse lines from file") [INFO] [stdout] 18 + }).collect() [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the borrowed expression implements the required traits [INFO] [stdout] --> src/input.rs:8:33 [INFO] [stdout] | [INFO] [stdout] 8 | let file = match File::open(&path) { [INFO] [stdout] | ^^^^^ help: change this to: `path` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args [INFO] [stdout] = note: `#[warn(clippy::needless_borrows_for_generic_args)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you should consider adding a `Default` implementation for `Grid` [INFO] [stdout] --> src/grid.rs:23:5 [INFO] [stdout] | [INFO] [stdout] 23 | / pub fn new() -> Self { [INFO] [stdout] 24 | | Grid { [INFO] [stdout] 25 | | grid: Vec::>::new(), [INFO] [stdout] 26 | | pos: Position { x: 0, y: 0 }, [INFO] [stdout] 27 | | } [INFO] [stdout] 28 | | } [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] 22 + impl Default for Grid { [INFO] [stdout] 23 + fn default() -> Self { [INFO] [stdout] 24 + Self::new() [INFO] [stdout] 25 + } [INFO] [stdout] 26 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this boolean expression can be simplified [INFO] [stdout] --> src/grid.rs:33:13 [INFO] [stdout] | [INFO] [stdout] 33 | !(self.grid.len() == 0) || !(self.grid[0].len() == 0), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(self.grid.len() != 0)` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#nonminimal_bool [INFO] [stdout] = note: `#[warn(clippy::nonminimal_bool)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this boolean expression can be simplified [INFO] [stdout] --> src/grid.rs:33:40 [INFO] [stdout] | [INFO] [stdout] 33 | !(self.grid.len() == 0) || !(self.grid[0].len() == 0), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(self.grid[0].len() != 0)` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#nonminimal_bool [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: returning the result of a `let` binding from a block [INFO] [stdout] --> src/grid.rs:78:9 [INFO] [stdout] | [INFO] [stdout] 43 | / let result = match dir { [INFO] [stdout] 44 | | Direction::Up => { [INFO] [stdout] 45 | | if self.pos.y as i64 - steps as i64 >= 0 { [INFO] [stdout] 46 | | self.pos.y = self.pos.y - steps; [INFO] [stdout] ... | [INFO] [stdout] 76 | | }; [INFO] [stdout] | |__________- unnecessary `let` binding [INFO] [stdout] 77 | [INFO] [stdout] 78 | result [INFO] [stdout] | ^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_and_return [INFO] [stdout] = note: `#[warn(clippy::let_and_return)]` on by default [INFO] [stdout] help: return the expression directly [INFO] [stdout] | [INFO] [stdout] 43 ~ [INFO] [stdout] 44 | [INFO] [stdout] 45 ~ match dir { [INFO] [stdout] 46 + Direction::Up => { [INFO] [stdout] 47 + if self.pos.y as i64 - steps as i64 >= 0 { [INFO] [stdout] 48 + self.pos.y = self.pos.y - steps; [INFO] [stdout] 49 + Ok(()) [INFO] [stdout] 50 + } else { [INFO] [stdout] 51 + Err("Out of bounds") [INFO] [stdout] 52 + } [INFO] [stdout] 53 + } [INFO] [stdout] 54 + Direction::Down => { [INFO] [stdout] 55 + if self.pos.y + steps < self.grid.len() { [INFO] [stdout] 56 + self.pos.y = self.pos.y + steps; [INFO] [stdout] 57 + Ok(()) [INFO] [stdout] 58 + } else { [INFO] [stdout] 59 + Err("Out of bounds") [INFO] [stdout] 60 + } [INFO] [stdout] 61 + } [INFO] [stdout] 62 + Direction::Left => { [INFO] [stdout] 63 + if self.pos.x as i64 - steps as i64 >= 0 { [INFO] [stdout] 64 + self.pos.x = self.pos.x - steps; [INFO] [stdout] 65 + Ok(()) [INFO] [stdout] 66 + } else { [INFO] [stdout] 67 + Err("Out of bounds") [INFO] [stdout] 68 + } [INFO] [stdout] 69 + } [INFO] [stdout] 70 + Direction::Right => { [INFO] [stdout] 71 + if self.pos.x + steps < self.grid[0].len() { [INFO] [stdout] 72 + self.pos.x = self.pos.x + steps; [INFO] [stdout] 73 + Ok(()) [INFO] [stdout] 74 + } else { [INFO] [stdout] 75 + Err("Out of bounds") [INFO] [stdout] 76 + } [INFO] [stdout] 77 + } [INFO] [stdout] 78 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: length comparison to zero [INFO] [stdout] --> src/grid.rs:33:15 [INFO] [stdout] | [INFO] [stdout] 33 | !(self.grid.len() == 0) || !(self.grid[0].len() == 0), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `self.grid.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: length comparison to zero [INFO] [stdout] --> src/grid.rs:33:42 [INFO] [stdout] | [INFO] [stdout] 33 | !(self.grid.len() == 0) || !(self.grid[0].len() == 0), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `self.grid[0].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 pattern reimplements `Option::unwrap_or` [INFO] [stdout] --> src/grid.rs:38:21 [INFO] [stdout] | [INFO] [stdout] 38 | let steps = match steps { [INFO] [stdout] | _____________________^ [INFO] [stdout] 39 | | Some(i) => i, [INFO] [stdout] 40 | | None => 1, [INFO] [stdout] 41 | | }; [INFO] [stdout] | |_________^ help: replace with: `steps.unwrap_or(1)` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_unwrap_or [INFO] [stdout] = note: `#[warn(clippy::manual_unwrap_or)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of an assign operation [INFO] [stdout] --> src/grid.rs:46:21 [INFO] [stdout] | [INFO] [stdout] 46 | self.pos.y = self.pos.y - steps; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `self.pos.y -= steps` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assign_op_pattern [INFO] [stdout] = note: `#[warn(clippy::assign_op_pattern)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of an assign operation [INFO] [stdout] --> src/grid.rs:54:21 [INFO] [stdout] | [INFO] [stdout] 54 | self.pos.y = self.pos.y + steps; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `self.pos.y += steps` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assign_op_pattern [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of an assign operation [INFO] [stdout] --> src/grid.rs:62:21 [INFO] [stdout] | [INFO] [stdout] 62 | self.pos.x = self.pos.x - steps; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `self.pos.x -= steps` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assign_op_pattern [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of an assign operation [INFO] [stdout] --> src/grid.rs:70:21 [INFO] [stdout] | [INFO] [stdout] 70 | self.pos.x = self.pos.x + steps; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `self.pos.x += steps` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assign_op_pattern [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this boolean expression can be simplified [INFO] [stdout] --> src/grid.rs:88:13 [INFO] [stdout] | [INFO] [stdout] 88 | !(self.grid.len() == 0) || !(self.grid[0].len() == 0), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(self.grid.len() != 0)` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#nonminimal_bool [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this boolean expression can be simplified [INFO] [stdout] --> src/grid.rs:88:40 [INFO] [stdout] | [INFO] [stdout] 88 | !(self.grid.len() == 0) || !(self.grid[0].len() == 0), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(self.grid[0].len() != 0)` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#nonminimal_bool [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: returning the result of a `let` binding from a block [INFO] [stdout] --> src/grid.rs:129:9 [INFO] [stdout] | [INFO] [stdout] 98 | / let result = match dir { [INFO] [stdout] 99 | | Direction::Up => { [INFO] [stdout] 100 | | if self.pos.y as i64 - steps as i64 >= 0 { [INFO] [stdout] 101 | | Ok(&self.grid[self.pos.y - steps][self.pos.x]) [INFO] [stdout] ... | [INFO] [stdout] 127 | | }; [INFO] [stdout] | |__________- unnecessary `let` binding [INFO] [stdout] 128 | [INFO] [stdout] 129 | result [INFO] [stdout] | ^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_and_return [INFO] [stdout] help: return the expression directly [INFO] [stdout] | [INFO] [stdout] 98 ~ [INFO] [stdout] 99 | [INFO] [stdout] 100 ~ match dir { [INFO] [stdout] 101 + Direction::Up => { [INFO] [stdout] 102 + if self.pos.y as i64 - steps as i64 >= 0 { [INFO] [stdout] 103 + Ok(&self.grid[self.pos.y - steps][self.pos.x]) [INFO] [stdout] 104 + } else { [INFO] [stdout] 105 + Err("Out of bounds") [INFO] [stdout] 106 + } [INFO] [stdout] 107 + } [INFO] [stdout] 108 + Direction::Down => { [INFO] [stdout] 109 + if self.pos.y + steps < self.grid.len() { [INFO] [stdout] 110 + Ok(&self.grid[self.pos.y + steps][self.pos.x]) [INFO] [stdout] 111 + } else { [INFO] [stdout] 112 + Err("Out of bounds") [INFO] [stdout] 113 + } [INFO] [stdout] 114 + } [INFO] [stdout] 115 + Direction::Left => { [INFO] [stdout] 116 + if self.pos.x as i64 - steps as i64 >= 0 { [INFO] [stdout] 117 + Ok(&self.grid[self.pos.y][self.pos.x - steps]) [INFO] [stdout] 118 + } else { [INFO] [stdout] 119 + Err("Out of bounds") [INFO] [stdout] 120 + } [INFO] [stdout] 121 + } [INFO] [stdout] 122 + Direction::Right => { [INFO] [stdout] 123 + if self.pos.x + steps < self.grid[0].len() { [INFO] [stdout] 124 + Ok(&self.grid[self.pos.y][self.pos.x + steps]) [INFO] [stdout] 125 + } else { [INFO] [stdout] 126 + Err("Out of bounds") [INFO] [stdout] 127 + } [INFO] [stdout] 128 + } [INFO] [stdout] 129 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: length comparison to zero [INFO] [stdout] --> src/grid.rs:88:15 [INFO] [stdout] | [INFO] [stdout] 88 | !(self.grid.len() == 0) || !(self.grid[0].len() == 0), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `self.grid.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/grid.rs:88:42 [INFO] [stdout] | [INFO] [stdout] 88 | !(self.grid.len() == 0) || !(self.grid[0].len() == 0), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `self.grid[0].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 pattern reimplements `Option::unwrap_or` [INFO] [stdout] --> src/grid.rs:93:21 [INFO] [stdout] | [INFO] [stdout] 93 | let steps = match steps { [INFO] [stdout] | _____________________^ [INFO] [stdout] 94 | | Some(i) => i, [INFO] [stdout] 95 | | None => 1, [INFO] [stdout] 96 | | }; [INFO] [stdout] | |_________^ help: replace with: `steps.unwrap_or(1)` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_unwrap_or [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/grid.rs:137:50 [INFO] [stdout] | [INFO] [stdout] 137 | let line: Vec = row.iter().map(|x| f(x)).collect(); [INFO] [stdout] | ^^^^^^^^ help: replace the closure with the function itself: `&f` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] = note: `#[warn(clippy::redundant_closure)]` 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/combination.rs:8:11 [INFO] [stdout] | [INFO] [stdout] 8 | vals: &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] = note: `#[warn(clippy::ptr_arg)]` on by default [INFO] [stdout] help: change this to [INFO] [stdout] | [INFO] [stdout] 8 - vals: &Vec, [INFO] [stdout] 8 + vals: &[T], [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/combination.rs:38:35 [INFO] [stdout] | [INFO] [stdout] 38 | pub fn unordered_pairs(values: &Vec) -> Vec<(&T, &T)> { [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] 38 - pub fn unordered_pairs(values: &Vec) -> Vec<(&T, &T)> { [INFO] [stdout] 38 + pub fn unordered_pairs(values: &[T]) -> Vec<(&T, &T)> { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: returning the result of a `let` binding from a block [INFO] [stdout] --> src/input.rs:18:5 [INFO] [stdout] | [INFO] [stdout] 14 | / let lines = reader.lines().map(|res| match res { [INFO] [stdout] 15 | | Ok(string) => string, [INFO] [stdout] 16 | | Err(_) => panic!("Couldn't parse lines from file") [INFO] [stdout] 17 | | }).collect(); [INFO] [stdout] | |_________________- unnecessary `let` binding [INFO] [stdout] 18 | lines [INFO] [stdout] | ^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#let_and_return [INFO] [stdout] help: return the expression directly [INFO] [stdout] | [INFO] [stdout] 14 ~ [INFO] [stdout] 15 ~ reader.lines().map(|res| match res { [INFO] [stdout] 16 + Ok(string) => string, [INFO] [stdout] 17 + Err(_) => panic!("Couldn't parse lines from file") [INFO] [stdout] 18 + }).collect() [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the borrowed expression implements the required traits [INFO] [stdout] --> src/input.rs:8:33 [INFO] [stdout] | [INFO] [stdout] 8 | let file = match File::open(&path) { [INFO] [stdout] | ^^^^^ help: change this to: `path` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args [INFO] [stdout] = note: `#[warn(clippy::needless_borrows_for_generic_args)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stderr] Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.36s [INFO] running `Command { std: "docker" "inspect" "5715bf77082db0af57edb884cefedeeb6a14a93ca94df77be9d636a95ab3a0fb", kill_on_drop: false }` [INFO] running `Command { std: "docker" "rm" "-f" "5715bf77082db0af57edb884cefedeeb6a14a93ca94df77be9d636a95ab3a0fb", kill_on_drop: false }` [INFO] [stdout] 5715bf77082db0af57edb884cefedeeb6a14a93ca94df77be9d636a95ab3a0fb