[INFO] cloning repository https://github.com/Sorrien/aoc_2024 [INFO] running `Command { std: "git" "-c" "credential.helper=" "-c" "credential.helper=/workspace/cargo-home/bin/git-credential-null" "clone" "--bare" "https://github.com/Sorrien/aoc_2024" "/workspace/cache/git-repos/https%3A%2F%2Fgithub.com%2FSorrien%2Faoc_2024", kill_on_drop: false }` [INFO] [stderr] Cloning into bare repository '/workspace/cache/git-repos/https%3A%2F%2Fgithub.com%2FSorrien%2Faoc_2024'... [INFO] running `Command { std: "git" "rev-parse" "HEAD", kill_on_drop: false }` [INFO] [stdout] 31c9d6ab61d9f4f07777b2d591b9ecb5e501774c [INFO] linting Sorrien/aoc_2024 against nightly for clippy-nonminimal_bool-denied [INFO] running `Command { std: "git" "clone" "/workspace/cache/git-repos/https%3A%2F%2Fgithub.com%2FSorrien%2Faoc_2024" "/workspace/builds/worker-3-tc1/source", kill_on_drop: false }` [INFO] [stderr] Cloning into '/workspace/builds/worker-3-tc1/source'... [INFO] [stderr] done. [INFO] started tweaking git repo https://github.com/Sorrien/aoc_2024 [INFO] finished tweaking git repo https://github.com/Sorrien/aoc_2024 [INFO] tweaked toml for git repo https://github.com/Sorrien/aoc_2024 written to /workspace/builds/worker-3-tc1/source/Cargo.toml [INFO] validating manifest of git repo https://github.com/Sorrien/aoc_2024 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/Sorrien/aoc_2024 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-3-tc1/target:/opt/rustwide/target:rw,Z" "-v" "/var/lib/crater-agent-workspace/builds/worker-3-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] e479ed21cff3a6824973153572fc0ae42dd9dad6cdfa7f10e346842a9ce3464a [INFO] running `Command { std: "docker" "start" "-a" "e479ed21cff3a6824973153572fc0ae42dd9dad6cdfa7f10e346842a9ce3464a", kill_on_drop: false }` [INFO] running `Command { std: "docker" "inspect" "e479ed21cff3a6824973153572fc0ae42dd9dad6cdfa7f10e346842a9ce3464a", kill_on_drop: false }` [INFO] running `Command { std: "docker" "rm" "-f" "e479ed21cff3a6824973153572fc0ae42dd9dad6cdfa7f10e346842a9ce3464a", kill_on_drop: false }` [INFO] [stdout] e479ed21cff3a6824973153572fc0ae42dd9dad6cdfa7f10e346842a9ce3464a [INFO] running `Command { std: "docker" "create" "-v" "/var/lib/crater-agent-workspace/builds/worker-3-tc1/target:/opt/rustwide/target:rw,Z" "-v" "/var/lib/crater-agent-workspace/builds/worker-3-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] ac97cfd8a9cc48b8f65cc4fe003bbd22979c7a1862f62a1c27665585b1b154ce [INFO] running `Command { std: "docker" "start" "-a" "ac97cfd8a9cc48b8f65cc4fe003bbd22979c7a1862f62a1c27665585b1b154ce", kill_on_drop: false }` [INFO] [stderr] Checking memchr v2.7.4 [INFO] [stderr] Checking regex-syntax v0.8.5 [INFO] [stderr] Checking either v1.13.0 [INFO] [stderr] Checking rayon v1.10.0 [INFO] [stderr] Checking aho-corasick v1.1.3 [INFO] [stderr] Checking regex-automata v0.4.9 [INFO] [stderr] Checking regex v1.11.1 [INFO] [stderr] Checking aoc_2024 v0.1.0 (/opt/rustwide/workdir) [INFO] [stdout] warning: length comparison to zero [INFO] [stdout] --> src/day10/part1.rs:36:32 [INFO] [stdout] | [INFO] [stdout] 36 | ... if next_positions.len() == 0 { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `next_positions.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/day10/part2.rs:36:32 [INFO] [stdout] | [INFO] [stdout] 36 | ... if next_positions.len() == 0 { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `next_positions.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: usage of `contains_key` followed by `insert` on a `HashMap` [INFO] [stdout] --> src/day12/part1.rs:60:13 [INFO] [stdout] | [INFO] [stdout] 60 | / if !pos_to_region_hashmap.contains_key(&pos) { [INFO] [stdout] 61 | | let region = vec![pos]; [INFO] [stdout] 62 | | regions.push(region); [INFO] [stdout] 63 | | let new_region_index = regions.len() - 1; [INFO] [stdout] 64 | | pos_to_region_hashmap.insert(pos, new_region_index); [INFO] [stdout] 65 | | } [INFO] [stdout] | |_____________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_entry [INFO] [stdout] = note: `#[warn(clippy::map_entry)]` on by default [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 60 ~ pos_to_region_hashmap.entry(pos).or_insert_with(|| { [INFO] [stdout] 61 + let region = vec![pos]; [INFO] [stdout] 62 + regions.push(region); [INFO] [stdout] 63 + let new_region_index = regions.len() - 1; [INFO] [stdout] 64 + new_region_index [INFO] [stdout] 65 + }); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: length comparison to zero [INFO] [stdout] --> src/day12/part1.rs:72:16 [INFO] [stdout] | [INFO] [stdout] 72 | if region.len() > 0 { [INFO] [stdout] | ^^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!region.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/day12/part2.rs:26:19 [INFO] [stdout] | [INFO] [stdout] 26 | while stack.len() > 0 { [INFO] [stdout] | ^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!stack.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 boolean expression can be simplified [INFO] [stdout] --> src/day13/part1.rs:24:27 [INFO] [stdout] | [INFO] [stdout] 24 | is_finished = !lines.next().is_some(); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `lines.next().is_none()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#nonminimal_bool [INFO] [stdout] = note: `#[warn(clippy::nonminimal_bool)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this boolean expression can be simplified [INFO] [stdout] --> src/day13/part2.rs:24:27 [INFO] [stdout] | [INFO] [stdout] 24 | is_finished = !lines.next().is_some(); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `lines.next().is_none()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#nonminimal_bool [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/day13/part2.rs:86:5 [INFO] [stdout] | [INFO] [stdout] 86 | return ((f - g * y) / c, 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] = note: `#[warn(clippy::needless_return)]` on by default [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 86 - return ((f - g * y) / c, y); [INFO] [stdout] 86 + ((f - g * y) / c, y) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: called `map(..).flatten()` on `Iterator` [INFO] [stdout] --> src/day14/part1.rs:16:18 [INFO] [stdout] | [INFO] [stdout] 16 | .map(|coord_string| coord_string.split(",")) [INFO] [stdout] | __________________^ [INFO] [stdout] 17 | | .flatten() [INFO] [stdout] | |__________________________^ help: try replacing `map` with `flat_map` and remove the `.flatten()`: `flat_map(|coord_string| coord_string.split(","))` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_flatten [INFO] [stdout] = note: `#[warn(clippy::map_flatten)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is only used to index `quad_counts` [INFO] [stdout] --> src/day14/part1.rs:63:14 [INFO] [stdout] | [INFO] [stdout] 63 | for i in 1..quad_counts.len() { [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] 63 - for i in 1..quad_counts.len() { [INFO] [stdout] 63 + for in quad_counts.iter().skip(1) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: called `map(..).flatten()` on `Iterator` [INFO] [stdout] --> src/day14/part2.rs:16:18 [INFO] [stdout] | [INFO] [stdout] 16 | .map(|coord_string| coord_string.split(",")) [INFO] [stdout] | __________________^ [INFO] [stdout] 17 | | .flatten() [INFO] [stdout] | |__________________________^ help: try replacing `map` with `flat_map` and remove the `.flatten()`: `flat_map(|coord_string| coord_string.split(","))` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_flatten [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: comparison to empty slice [INFO] [stdout] --> src/day15/part1.rs:12:16 [INFO] [stdout] | [INFO] [stdout] 12 | if line == "" { [INFO] [stdout] | ^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `line.is_empty()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#comparison_to_empty [INFO] [stdout] = note: `#[warn(clippy::comparison_to_empty)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: called `map(..).flatten()` on `Iterator` [INFO] [stdout] --> src/day15/part1.rs:37:10 [INFO] [stdout] | [INFO] [stdout] 37 | .map(|line| { [INFO] [stdout] | __________^ [INFO] [stdout] 38 | | line.chars().map(|c| match c { [INFO] [stdout] 39 | | '^' => CardinalDirection::North, [INFO] [stdout] 40 | | '>' => CardinalDirection::East, [INFO] [stdout] ... | [INFO] [stdout] 45 | | }) [INFO] [stdout] 46 | | .flatten() [INFO] [stdout] | |__________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_flatten [INFO] [stdout] help: try replacing `map` with `flat_map` and remove the `.flatten()` [INFO] [stdout] | [INFO] [stdout] 37 ~ .flat_map(|line| { [INFO] [stdout] 38 + line.chars().map(|c| match c { [INFO] [stdout] 39 + '^' => CardinalDirection::North, [INFO] [stdout] 40 + '>' => CardinalDirection::East, [INFO] [stdout] 41 + 'v' => CardinalDirection::South, [INFO] [stdout] 42 + '<' => CardinalDirection::West, [INFO] [stdout] 43 + _ => panic!("a new direction has been discovered!"), [INFO] [stdout] 44 + }) [INFO] [stdout] 45 + }) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: comparison to empty slice [INFO] [stdout] --> src/day15/part2.rs:12:16 [INFO] [stdout] | [INFO] [stdout] 12 | if line == "" { [INFO] [stdout] | ^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `line.is_empty()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#comparison_to_empty [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: called `map(..).flatten()` on `Iterator` [INFO] [stdout] --> src/day15/part2.rs:54:10 [INFO] [stdout] | [INFO] [stdout] 54 | .map(|line| { [INFO] [stdout] | __________^ [INFO] [stdout] 55 | | line.chars().map(|c| match c { [INFO] [stdout] 56 | | '^' => CardinalDirection::North, [INFO] [stdout] 57 | | '>' => CardinalDirection::East, [INFO] [stdout] ... | [INFO] [stdout] 62 | | }) [INFO] [stdout] 63 | | .flatten() [INFO] [stdout] | |__________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_flatten [INFO] [stdout] help: try replacing `map` with `flat_map` and remove the `.flatten()` [INFO] [stdout] | [INFO] [stdout] 54 ~ .flat_map(|line| { [INFO] [stdout] 55 + line.chars().map(|c| match c { [INFO] [stdout] 56 + '^' => CardinalDirection::North, [INFO] [stdout] 57 + '>' => CardinalDirection::East, [INFO] [stdout] 58 + 'v' => CardinalDirection::South, [INFO] [stdout] 59 + '<' => CardinalDirection::West, [INFO] [stdout] 60 + _ => panic!("a new direction has been discovered!"), [INFO] [stdout] 61 + }) [INFO] [stdout] 62 + }) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: returning the result of a `let` binding from a block [INFO] [stdout] --> src/day15/part2.rs:167:21 [INFO] [stdout] | [INFO] [stdout] 124 | / let moved = if other_half_dir == dir { [INFO] [stdout] 125 | | let moved_2 = attempt_move(map, pos_2, dir); [INFO] [stdout] 126 | | let moved = if moved_2 { [INFO] [stdout] 127 | | map.swap(pos_2, desired_pos_2); [INFO] [stdout] ... | [INFO] [stdout] 164 | | moved [INFO] [stdout] 165 | | }; [INFO] [stdout] | |______________________- unnecessary `let` binding [INFO] [stdout] 166 | [INFO] [stdout] 167 | moved [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] 124 ~ [INFO] [stdout] 125 | [INFO] [stdout] 126 ~ if other_half_dir == dir { [INFO] [stdout] 127 + let moved_2 = attempt_move(map, pos_2, dir); [INFO] [stdout] 128 + let moved = if moved_2 { [INFO] [stdout] 129 + map.swap(pos_2, desired_pos_2); [INFO] [stdout] 130 + [INFO] [stdout] 131 + let moved_1 = attempt_move(map, desired_pos, dir); [INFO] [stdout] 132 + if !moved_1 { [INFO] [stdout] 133 + map.swap(pos_2, desired_pos_2); [INFO] [stdout] 134 + } [INFO] [stdout] 135 + [INFO] [stdout] 136 + moved_1 [INFO] [stdout] 137 + } else { [INFO] [stdout] 138 + false [INFO] [stdout] 139 + }; [INFO] [stdout] 140 + [INFO] [stdout] 141 + if moved { [INFO] [stdout] 142 + map.swap(desired_pos, desired_pos_1); [INFO] [stdout] 143 + } [INFO] [stdout] 144 + [INFO] [stdout] 145 + moved [INFO] [stdout] 146 + } else { [INFO] [stdout] 147 + let moved_1 = attempt_move(map, desired_pos, dir); [INFO] [stdout] 148 + if moved_1 { [INFO] [stdout] 149 + map.swap(desired_pos, desired_pos_1); [INFO] [stdout] 150 + } [INFO] [stdout] 151 + [INFO] [stdout] 152 + let moved = if moved_1 { [INFO] [stdout] 153 + let moved_2 = attempt_move(map, pos_2, dir); [INFO] [stdout] 154 + if !moved_2 { [INFO] [stdout] 155 + map.swap(desired_pos, desired_pos_1); [INFO] [stdout] 156 + } [INFO] [stdout] 157 + moved_2 [INFO] [stdout] 158 + } else { [INFO] [stdout] 159 + false [INFO] [stdout] 160 + }; [INFO] [stdout] 161 + [INFO] [stdout] 162 + if moved { [INFO] [stdout] 163 + map.swap(pos_2, desired_pos_2); [INFO] [stdout] 164 + } [INFO] [stdout] 165 + [INFO] [stdout] 166 + moved [INFO] [stdout] 167 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant redefinition of a binding `pos` [INFO] [stdout] --> src/day16/part1.rs:119:9 [INFO] [stdout] | [INFO] [stdout] 119 | let pos = pos; [INFO] [stdout] | ^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] help: `pos` is initially defined here [INFO] [stdout] --> src/day16/part1.rs:110:21 [INFO] [stdout] | [INFO] [stdout] 110 | while let Some((pos, direction, score, steps)) = path_options.pop_front() { [INFO] [stdout] | ^^^ [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_locals [INFO] [stdout] = note: `#[warn(clippy::redundant_locals)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant redefinition of a binding `pos` [INFO] [stdout] --> src/day16/part2.rs:120:9 [INFO] [stdout] | [INFO] [stdout] 120 | let pos = pos; [INFO] [stdout] | ^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] help: `pos` is initially defined here [INFO] [stdout] --> src/day16/part2.rs:113:21 [INFO] [stdout] | [INFO] [stdout] 113 | while let Some((pos, direction, score, steps, paths)) = path_options.pop_front() { [INFO] [stdout] | ^^^ [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_locals [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do [INFO] [stdout] --> src/day2/part2.rs:22:27 [INFO] [stdout] | [INFO] [stdout] 22 | fn is_report_safe(report: &Vec) -> bool { [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] 22 - fn is_report_safe(report: &Vec) -> bool { [INFO] [stdout] 22 + fn is_report_safe(report: &[u32]) -> bool { [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/day2/part2.rs:47:37 [INFO] [stdout] | [INFO] [stdout] 47 | fn attempt_problem_dampener(report: &Vec) -> bool { [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] 47 ~ fn attempt_problem_dampener(report: &[u32]) -> bool { [INFO] [stdout] 48 | let mut is_safe = false; [INFO] [stdout] 49 | for i in 0..report.len() { [INFO] [stdout] 50 ~ let mut report_clone = report.to_owned(); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: consider using `sort_by_key` [INFO] [stdout] --> src/day3/part2.rs:40:5 [INFO] [stdout] | [INFO] [stdout] 40 | instructions.sort_by(|a, b| a.index.cmp(&b.index)); [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] 40 - instructions.sort_by(|a, b| a.index.cmp(&b.index)); [INFO] [stdout] 40 + instructions.sort_by_key(|a| a.index); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/day4/part2.rs:35:17 [INFO] [stdout] | [INFO] [stdout] 35 | / if chars.len() == 4 { [INFO] [stdout] 36 | | if is_x_mas(&chars[0..=1]) && is_x_mas(&chars[2..=3]) { [INFO] [stdout] 37 | | count += 1; [INFO] [stdout] 38 | | } [INFO] [stdout] 39 | | } [INFO] [stdout] | |_________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] = note: `#[warn(clippy::collapsible_if)]` on by default [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 35 ~ if chars.len() == 4 [INFO] [stdout] 36 ~ && is_x_mas(&chars[0..=1]) && is_x_mas(&chars[2..=3]) { [INFO] [stdout] 37 | count += 1; [INFO] [stdout] 38 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: comparison to empty slice [INFO] [stdout] --> src/day5/part1.rs:10:16 [INFO] [stdout] | [INFO] [stdout] 10 | if line == "" { [INFO] [stdout] | ^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `line.is_empty()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#comparison_to_empty [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: comparison to empty slice [INFO] [stdout] --> src/day5/part2.rs:10:16 [INFO] [stdout] | [INFO] [stdout] 10 | if line == "" { [INFO] [stdout] | ^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `line.is_empty()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#comparison_to_empty [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: consider using `sort_by_key` [INFO] [stdout] --> src/day5/part2.rs:28:5 [INFO] [stdout] | [INFO] [stdout] 28 | rules.sort_by(|a, b| a.1.cmp(&b.1)); [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] help: try [INFO] [stdout] | [INFO] [stdout] 28 - rules.sort_by(|a, b| a.1.cmp(&b.1)); [INFO] [stdout] 28 + rules.sort_by_key(|a| a.1); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of `Option::map` [INFO] [stdout] --> src/day6/part1.rs:20:13 [INFO] [stdout] | [INFO] [stdout] 20 | / if let Some(y) = line.iter().position(|c| *c == '^') { [INFO] [stdout] 21 | | Some((x, y)) [INFO] [stdout] 22 | | } else { [INFO] [stdout] 23 | | None [INFO] [stdout] 24 | | } [INFO] [stdout] | |_____________^ help: try: `line.iter().position(|c| *c == '^').map(|y| (x, y))` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_map [INFO] [stdout] = note: `#[warn(clippy::manual_map)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of `Option::map` [INFO] [stdout] --> src/day6/part2.rs:20:13 [INFO] [stdout] | [INFO] [stdout] 20 | / if let Some(y) = line.iter().position(|c| *c == '^') { [INFO] [stdout] 21 | | Some((x, y)) [INFO] [stdout] 22 | | } else { [INFO] [stdout] 23 | | None [INFO] [stdout] 24 | | } [INFO] [stdout] | |_____________^ help: try: `line.iter().position(|c| *c == '^').map(|y| (x, y))` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_map [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of `Option::map` [INFO] [stdout] --> src/day6/part2.rs:89:13 [INFO] [stdout] | [INFO] [stdout] 89 | / if let Some(y) = line.iter().position(|c| *c == '^') { [INFO] [stdout] 90 | | Some((x, y)) [INFO] [stdout] 91 | | } else { [INFO] [stdout] 92 | | None [INFO] [stdout] 93 | | } [INFO] [stdout] | |_____________^ help: try: `line.iter().position(|c| *c == '^').map(|y| (x, y))` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_map [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/day7/part1.rs:3:14 [INFO] [stdout] | [INFO] [stdout] 3 | .map(|i| get_all_possible_operator_combos(i)) [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `get_all_possible_operator_combos` [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: returning the result of a `let` binding from a block [INFO] [stdout] --> src/day7/part1.rs:62:5 [INFO] [stdout] | [INFO] [stdout] 60 | let results = permute(results, 1, len); [INFO] [stdout] | --------------------------------------- unnecessary `let` binding [INFO] [stdout] 61 | [INFO] [stdout] 62 | results [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] 60 ~ [INFO] [stdout] 61 | [INFO] [stdout] 62 ~ permute(results, 1, len) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant redefinition of a binding `len` [INFO] [stdout] --> src/day7/part1.rs:51:5 [INFO] [stdout] | [INFO] [stdout] 51 | let len = len; [INFO] [stdout] | ^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] help: `len` is initially defined here [INFO] [stdout] --> src/day7/part1.rs:50:41 [INFO] [stdout] | [INFO] [stdout] 50 | pub fn get_all_possible_operator_combos(len: usize) -> Vec> { [INFO] [stdout] | ^^^ [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_locals [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: calls to `push` immediately after creation [INFO] [stdout] --> src/day7/part1.rs:55:9 [INFO] [stdout] | [INFO] [stdout] 55 | / let mut result = vec![]; [INFO] [stdout] 56 | | result.push(operator); [INFO] [stdout] | |______________________________^ help: consider using the `vec![]` macro: `let result = vec![..];` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#vec_init_then_push [INFO] [stdout] = note: `#[warn(clippy::vec_init_then_push)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/day7/part2.rs:3:14 [INFO] [stdout] | [INFO] [stdout] 3 | .map(|i| get_all_possible_operator_combos(i)) [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `get_all_possible_operator_combos` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: returning the result of a `let` binding from a block [INFO] [stdout] --> src/day7/part2.rs:65:5 [INFO] [stdout] | [INFO] [stdout] 63 | let results = permute(results, 1, len); [INFO] [stdout] | --------------------------------------- unnecessary `let` binding [INFO] [stdout] 64 | [INFO] [stdout] 65 | results [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] 63 ~ [INFO] [stdout] 64 | [INFO] [stdout] 65 ~ permute(results, 1, len) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant redefinition of a binding `len` [INFO] [stdout] --> src/day7/part2.rs:54:5 [INFO] [stdout] | [INFO] [stdout] 54 | let len = len; [INFO] [stdout] | ^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] help: `len` is initially defined here [INFO] [stdout] --> src/day7/part2.rs:53:41 [INFO] [stdout] | [INFO] [stdout] 53 | pub fn get_all_possible_operator_combos(len: usize) -> Vec> { [INFO] [stdout] | ^^^ [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_locals [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: calls to `push` immediately after creation [INFO] [stdout] --> src/day7/part2.rs:58:9 [INFO] [stdout] | [INFO] [stdout] 58 | / let mut result = vec![]; [INFO] [stdout] 59 | | result.push(operator); [INFO] [stdout] | |______________________________^ help: consider using the `vec![]` macro: `let result = vec![..];` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#vec_init_then_push [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: called `map(..).flatten()` on `Iterator` [INFO] [stdout] --> src/day9/part1.rs:7:10 [INFO] [stdout] | [INFO] [stdout] 7 | .map(|(i, length)| { [INFO] [stdout] | __________^ [INFO] [stdout] 8 | | if i % 2 == 0 { [INFO] [stdout] 9 | | let id = file_id; [INFO] [stdout] 10 | | file_id += 1; [INFO] [stdout] ... | [INFO] [stdout] 15 | | }) [INFO] [stdout] 16 | | .flatten() [INFO] [stdout] | |__________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_flatten [INFO] [stdout] help: try replacing `map` with `flat_map` and remove the `.flatten()` [INFO] [stdout] | [INFO] [stdout] 7 ~ .flat_map(|(i, length)| { [INFO] [stdout] 8 + if i % 2 == 0 { [INFO] [stdout] 9 + let id = file_id; [INFO] [stdout] 10 + file_id += 1; [INFO] [stdout] 11 + vec![Some(id); length as usize] [INFO] [stdout] 12 + } else { [INFO] [stdout] 13 + vec![None; length as usize] [INFO] [stdout] 14 + } [INFO] [stdout] 15 + }) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of `Option::map` [INFO] [stdout] --> src/day9/part1.rs:53:13 [INFO] [stdout] | [INFO] [stdout] 53 | / if let Some(block) = block { [INFO] [stdout] 54 | | Some((i * block) as u64) [INFO] [stdout] 55 | | } else { [INFO] [stdout] 56 | | None [INFO] [stdout] 57 | | } [INFO] [stdout] | |_____________^ help: try: `block.as_ref().map(|block| (i * block) as u64)` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_map [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: importing legacy numeric constants [INFO] [stdout] --> src/day9/part2.rs:1:5 [INFO] [stdout] | [INFO] [stdout] 1 | use std::usize; [INFO] [stdout] | ^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: remove this import [INFO] [stdout] = note: then `usize::` will resolve to the respective associated constant [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#legacy_numeric_constants [INFO] [stdout] = note: `#[warn(clippy::legacy_numeric_constants)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `.filter_map(..)` can be written more simply using `.map(..)` [INFO] [stdout] --> src/day9/part2.rs:70:10 [INFO] [stdout] | [INFO] [stdout] 70 | .filter_map(|block| { [INFO] [stdout] | __________^ [INFO] [stdout] 71 | | if block.is_free { [INFO] [stdout] 72 | | Some(vec![0; block.length as usize]) [INFO] [stdout] 73 | | } else { [INFO] [stdout] ... | [INFO] [stdout] 76 | | }) [INFO] [stdout] | |__________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_filter_map [INFO] [stdout] = note: `#[warn(clippy::unnecessary_filter_map)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: useless use of `vec!` [INFO] [stdout] --> src/day14/part1.rs:32:27 [INFO] [stdout] | [INFO] [stdout] 32 | let mut quad_counts = vec![0, 0, 0, 0]; [INFO] [stdout] | ^^^^^^^^^^^^^^^^ help: you can use an array directly: `[0, 0, 0, 0]` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_vec [INFO] [stdout] = note: `#[warn(clippy::useless_vec)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: items after a test module [INFO] [stdout] --> src/common/math.rs:167:1 [INFO] [stdout] | [INFO] [stdout] 167 | mod math_tests { [INFO] [stdout] | ^^^^^^^^^^^^^^ [INFO] [stdout] ... [INFO] [stdout] 210 | pub fn mod_floor(a: isize, n: isize) -> isize { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#items_after_test_module [INFO] [stdout] = note: `#[warn(clippy::items_after_test_module)]` on by default [INFO] [stdout] = help: move the items to before the test module was defined [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: length comparison to zero [INFO] [stdout] --> src/day10/part1.rs:36:32 [INFO] [stdout] | [INFO] [stdout] 36 | ... if next_positions.len() == 0 { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `next_positions.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/day10/part2.rs:36:32 [INFO] [stdout] | [INFO] [stdout] 36 | ... if next_positions.len() == 0 { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `next_positions.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: usage of `contains_key` followed by `insert` on a `HashMap` [INFO] [stdout] --> src/day12/part1.rs:60:13 [INFO] [stdout] | [INFO] [stdout] 60 | / if !pos_to_region_hashmap.contains_key(&pos) { [INFO] [stdout] 61 | | let region = vec![pos]; [INFO] [stdout] 62 | | regions.push(region); [INFO] [stdout] 63 | | let new_region_index = regions.len() - 1; [INFO] [stdout] 64 | | pos_to_region_hashmap.insert(pos, new_region_index); [INFO] [stdout] 65 | | } [INFO] [stdout] | |_____________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_entry [INFO] [stdout] = note: `#[warn(clippy::map_entry)]` on by default [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 60 ~ pos_to_region_hashmap.entry(pos).or_insert_with(|| { [INFO] [stdout] 61 + let region = vec![pos]; [INFO] [stdout] 62 + regions.push(region); [INFO] [stdout] 63 + let new_region_index = regions.len() - 1; [INFO] [stdout] 64 + new_region_index [INFO] [stdout] 65 + }); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: length comparison to zero [INFO] [stdout] --> src/day12/part1.rs:72:16 [INFO] [stdout] | [INFO] [stdout] 72 | if region.len() > 0 { [INFO] [stdout] | ^^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!region.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/day12/part2.rs:26:19 [INFO] [stdout] | [INFO] [stdout] 26 | while stack.len() > 0 { [INFO] [stdout] | ^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!stack.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 boolean expression can be simplified [INFO] [stdout] --> src/day13/part1.rs:24:27 [INFO] [stdout] | [INFO] [stdout] 24 | is_finished = !lines.next().is_some(); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `lines.next().is_none()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#nonminimal_bool [INFO] [stdout] = note: `#[warn(clippy::nonminimal_bool)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this boolean expression can be simplified [INFO] [stdout] --> src/day13/part2.rs:24:27 [INFO] [stdout] | [INFO] [stdout] 24 | is_finished = !lines.next().is_some(); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `lines.next().is_none()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#nonminimal_bool [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/day13/part2.rs:86:5 [INFO] [stdout] | [INFO] [stdout] 86 | return ((f - g * y) / c, 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] = note: `#[warn(clippy::needless_return)]` on by default [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 86 - return ((f - g * y) / c, y); [INFO] [stdout] 86 + ((f - g * y) / c, y) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: called `map(..).flatten()` on `Iterator` [INFO] [stdout] --> src/day14/part1.rs:16:18 [INFO] [stdout] | [INFO] [stdout] 16 | .map(|coord_string| coord_string.split(",")) [INFO] [stdout] | __________________^ [INFO] [stdout] 17 | | .flatten() [INFO] [stdout] | |__________________________^ help: try replacing `map` with `flat_map` and remove the `.flatten()`: `flat_map(|coord_string| coord_string.split(","))` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_flatten [INFO] [stdout] = note: `#[warn(clippy::map_flatten)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is only used to index `quad_counts` [INFO] [stdout] --> src/day14/part1.rs:63:14 [INFO] [stdout] | [INFO] [stdout] 63 | for i in 1..quad_counts.len() { [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] 63 - for i in 1..quad_counts.len() { [INFO] [stdout] 63 + for in quad_counts.iter().skip(1) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: called `map(..).flatten()` on `Iterator` [INFO] [stdout] --> src/day14/part2.rs:16:18 [INFO] [stdout] | [INFO] [stdout] 16 | .map(|coord_string| coord_string.split(",")) [INFO] [stdout] | __________________^ [INFO] [stdout] 17 | | .flatten() [INFO] [stdout] | |__________________________^ help: try replacing `map` with `flat_map` and remove the `.flatten()`: `flat_map(|coord_string| coord_string.split(","))` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_flatten [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: comparison to empty slice [INFO] [stdout] --> src/day15/part1.rs:12:16 [INFO] [stdout] | [INFO] [stdout] 12 | if line == "" { [INFO] [stdout] | ^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `line.is_empty()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#comparison_to_empty [INFO] [stdout] = note: `#[warn(clippy::comparison_to_empty)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: called `map(..).flatten()` on `Iterator` [INFO] [stdout] --> src/day15/part1.rs:37:10 [INFO] [stdout] | [INFO] [stdout] 37 | .map(|line| { [INFO] [stdout] | __________^ [INFO] [stdout] 38 | | line.chars().map(|c| match c { [INFO] [stdout] 39 | | '^' => CardinalDirection::North, [INFO] [stdout] 40 | | '>' => CardinalDirection::East, [INFO] [stdout] ... | [INFO] [stdout] 45 | | }) [INFO] [stdout] 46 | | .flatten() [INFO] [stdout] | |__________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_flatten [INFO] [stdout] help: try replacing `map` with `flat_map` and remove the `.flatten()` [INFO] [stdout] | [INFO] [stdout] 37 ~ .flat_map(|line| { [INFO] [stdout] 38 + line.chars().map(|c| match c { [INFO] [stdout] 39 + '^' => CardinalDirection::North, [INFO] [stdout] 40 + '>' => CardinalDirection::East, [INFO] [stdout] 41 + 'v' => CardinalDirection::South, [INFO] [stdout] 42 + '<' => CardinalDirection::West, [INFO] [stdout] 43 + _ => panic!("a new direction has been discovered!"), [INFO] [stdout] 44 + }) [INFO] [stdout] 45 + }) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: called `.iter().count()` on a `Vec` [INFO] [stdout] --> src/main.rs:46:51 [INFO] [stdout] | [INFO] [stdout] 46 | timings.iter().sum::() as f64 / timings.iter().count() as f64 [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `timings.len()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#iter_count [INFO] [stdout] = note: `#[warn(clippy::iter_count)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: writing `&String` instead of `&str` involves a new object where a slice will do [INFO] [stdout] --> src/main.rs:53:28 [INFO] [stdout] | [INFO] [stdout] 53 | pub fn run_solution(input: &String, day: u8, part: u8) -> String { [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] 53 ~ pub fn run_solution(input: &str, day: u8, part: u8) -> String { [INFO] [stdout] 54 ~ let input = input.to_owned(); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: comparison to empty slice [INFO] [stdout] --> src/day15/part2.rs:12:16 [INFO] [stdout] | [INFO] [stdout] 12 | if line == "" { [INFO] [stdout] | ^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `line.is_empty()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#comparison_to_empty [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: called `map(..).flatten()` on `Iterator` [INFO] [stdout] --> src/day15/part2.rs:54:10 [INFO] [stdout] | [INFO] [stdout] 54 | .map(|line| { [INFO] [stdout] | __________^ [INFO] [stdout] 55 | | line.chars().map(|c| match c { [INFO] [stdout] 56 | | '^' => CardinalDirection::North, [INFO] [stdout] 57 | | '>' => CardinalDirection::East, [INFO] [stdout] ... | [INFO] [stdout] 62 | | }) [INFO] [stdout] 63 | | .flatten() [INFO] [stdout] | |__________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_flatten [INFO] [stdout] help: try replacing `map` with `flat_map` and remove the `.flatten()` [INFO] [stdout] | [INFO] [stdout] 54 ~ .flat_map(|line| { [INFO] [stdout] 55 + line.chars().map(|c| match c { [INFO] [stdout] 56 + '^' => CardinalDirection::North, [INFO] [stdout] 57 + '>' => CardinalDirection::East, [INFO] [stdout] 58 + 'v' => CardinalDirection::South, [INFO] [stdout] 59 + '<' => CardinalDirection::West, [INFO] [stdout] 60 + _ => panic!("a new direction has been discovered!"), [INFO] [stdout] 61 + }) [INFO] [stdout] 62 + }) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: returning the result of a `let` binding from a block [INFO] [stdout] --> src/day15/part2.rs:167:21 [INFO] [stdout] | [INFO] [stdout] 124 | / let moved = if other_half_dir == dir { [INFO] [stdout] 125 | | let moved_2 = attempt_move(map, pos_2, dir); [INFO] [stdout] 126 | | let moved = if moved_2 { [INFO] [stdout] 127 | | map.swap(pos_2, desired_pos_2); [INFO] [stdout] ... | [INFO] [stdout] 164 | | moved [INFO] [stdout] 165 | | }; [INFO] [stdout] | |______________________- unnecessary `let` binding [INFO] [stdout] 166 | [INFO] [stdout] 167 | moved [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] 124 ~ [INFO] [stdout] 125 | [INFO] [stdout] 126 ~ if other_half_dir == dir { [INFO] [stdout] 127 + let moved_2 = attempt_move(map, pos_2, dir); [INFO] [stdout] 128 + let moved = if moved_2 { [INFO] [stdout] 129 + map.swap(pos_2, desired_pos_2); [INFO] [stdout] 130 + [INFO] [stdout] 131 + let moved_1 = attempt_move(map, desired_pos, dir); [INFO] [stdout] 132 + if !moved_1 { [INFO] [stdout] 133 + map.swap(pos_2, desired_pos_2); [INFO] [stdout] 134 + } [INFO] [stdout] 135 + [INFO] [stdout] 136 + moved_1 [INFO] [stdout] 137 + } else { [INFO] [stdout] 138 + false [INFO] [stdout] 139 + }; [INFO] [stdout] 140 + [INFO] [stdout] 141 + if moved { [INFO] [stdout] 142 + map.swap(desired_pos, desired_pos_1); [INFO] [stdout] 143 + } [INFO] [stdout] 144 + [INFO] [stdout] 145 + moved [INFO] [stdout] 146 + } else { [INFO] [stdout] 147 + let moved_1 = attempt_move(map, desired_pos, dir); [INFO] [stdout] 148 + if moved_1 { [INFO] [stdout] 149 + map.swap(desired_pos, desired_pos_1); [INFO] [stdout] 150 + } [INFO] [stdout] 151 + [INFO] [stdout] 152 + let moved = if moved_1 { [INFO] [stdout] 153 + let moved_2 = attempt_move(map, pos_2, dir); [INFO] [stdout] 154 + if !moved_2 { [INFO] [stdout] 155 + map.swap(desired_pos, desired_pos_1); [INFO] [stdout] 156 + } [INFO] [stdout] 157 + moved_2 [INFO] [stdout] 158 + } else { [INFO] [stdout] 159 + false [INFO] [stdout] 160 + }; [INFO] [stdout] 161 + [INFO] [stdout] 162 + if moved { [INFO] [stdout] 163 + map.swap(pos_2, desired_pos_2); [INFO] [stdout] 164 + } [INFO] [stdout] 165 + [INFO] [stdout] 166 + moved [INFO] [stdout] 167 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant redefinition of a binding `pos` [INFO] [stdout] --> src/day16/part1.rs:119:9 [INFO] [stdout] | [INFO] [stdout] 119 | let pos = pos; [INFO] [stdout] | ^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] help: `pos` is initially defined here [INFO] [stdout] --> src/day16/part1.rs:110:21 [INFO] [stdout] | [INFO] [stdout] 110 | while let Some((pos, direction, score, steps)) = path_options.pop_front() { [INFO] [stdout] | ^^^ [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_locals [INFO] [stdout] = note: `#[warn(clippy::redundant_locals)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant redefinition of a binding `pos` [INFO] [stdout] --> src/day16/part2.rs:120:9 [INFO] [stdout] | [INFO] [stdout] 120 | let pos = pos; [INFO] [stdout] | ^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] help: `pos` is initially defined here [INFO] [stdout] --> src/day16/part2.rs:113:21 [INFO] [stdout] | [INFO] [stdout] 113 | while let Some((pos, direction, score, steps, paths)) = path_options.pop_front() { [INFO] [stdout] | ^^^ [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_locals [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do [INFO] [stdout] --> src/day2/part2.rs:22:27 [INFO] [stdout] | [INFO] [stdout] 22 | fn is_report_safe(report: &Vec) -> bool { [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] 22 - fn is_report_safe(report: &Vec) -> bool { [INFO] [stdout] 22 + fn is_report_safe(report: &[u32]) -> bool { [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/day2/part2.rs:47:37 [INFO] [stdout] | [INFO] [stdout] 47 | fn attempt_problem_dampener(report: &Vec) -> bool { [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] 47 ~ fn attempt_problem_dampener(report: &[u32]) -> bool { [INFO] [stdout] 48 | let mut is_safe = false; [INFO] [stdout] 49 | for i in 0..report.len() { [INFO] [stdout] 50 ~ let mut report_clone = report.to_owned(); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: consider using `sort_by_key` [INFO] [stdout] --> src/day3/part2.rs:40:5 [INFO] [stdout] | [INFO] [stdout] 40 | instructions.sort_by(|a, b| a.index.cmp(&b.index)); [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] 40 - instructions.sort_by(|a, b| a.index.cmp(&b.index)); [INFO] [stdout] 40 + instructions.sort_by_key(|a| a.index); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/day4/part2.rs:35:17 [INFO] [stdout] | [INFO] [stdout] 35 | / if chars.len() == 4 { [INFO] [stdout] 36 | | if is_x_mas(&chars[0..=1]) && is_x_mas(&chars[2..=3]) { [INFO] [stdout] 37 | | count += 1; [INFO] [stdout] 38 | | } [INFO] [stdout] 39 | | } [INFO] [stdout] | |_________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] = note: `#[warn(clippy::collapsible_if)]` on by default [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 35 ~ if chars.len() == 4 [INFO] [stdout] 36 ~ && is_x_mas(&chars[0..=1]) && is_x_mas(&chars[2..=3]) { [INFO] [stdout] 37 | count += 1; [INFO] [stdout] 38 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: comparison to empty slice [INFO] [stdout] --> src/day5/part1.rs:10:16 [INFO] [stdout] | [INFO] [stdout] 10 | if line == "" { [INFO] [stdout] | ^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `line.is_empty()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#comparison_to_empty [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: comparison to empty slice [INFO] [stdout] --> src/day5/part2.rs:10:16 [INFO] [stdout] | [INFO] [stdout] 10 | if line == "" { [INFO] [stdout] | ^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `line.is_empty()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#comparison_to_empty [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: consider using `sort_by_key` [INFO] [stdout] --> src/day5/part2.rs:28:5 [INFO] [stdout] | [INFO] [stdout] 28 | rules.sort_by(|a, b| a.1.cmp(&b.1)); [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] help: try [INFO] [stdout] | [INFO] [stdout] 28 - rules.sort_by(|a, b| a.1.cmp(&b.1)); [INFO] [stdout] 28 + rules.sort_by_key(|a| a.1); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of `Option::map` [INFO] [stdout] --> src/day6/part1.rs:20:13 [INFO] [stdout] | [INFO] [stdout] 20 | / if let Some(y) = line.iter().position(|c| *c == '^') { [INFO] [stdout] 21 | | Some((x, y)) [INFO] [stdout] 22 | | } else { [INFO] [stdout] 23 | | None [INFO] [stdout] 24 | | } [INFO] [stdout] | |_____________^ help: try: `line.iter().position(|c| *c == '^').map(|y| (x, y))` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_map [INFO] [stdout] = note: `#[warn(clippy::manual_map)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of `Option::map` [INFO] [stdout] --> src/day6/part2.rs:20:13 [INFO] [stdout] | [INFO] [stdout] 20 | / if let Some(y) = line.iter().position(|c| *c == '^') { [INFO] [stdout] 21 | | Some((x, y)) [INFO] [stdout] 22 | | } else { [INFO] [stdout] 23 | | None [INFO] [stdout] 24 | | } [INFO] [stdout] | |_____________^ help: try: `line.iter().position(|c| *c == '^').map(|y| (x, y))` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_map [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of `Option::map` [INFO] [stdout] --> src/day6/part2.rs:89:13 [INFO] [stdout] | [INFO] [stdout] 89 | / if let Some(y) = line.iter().position(|c| *c == '^') { [INFO] [stdout] 90 | | Some((x, y)) [INFO] [stdout] 91 | | } else { [INFO] [stdout] 92 | | None [INFO] [stdout] 93 | | } [INFO] [stdout] | |_____________^ help: try: `line.iter().position(|c| *c == '^').map(|y| (x, y))` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_map [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/day7/part1.rs:3:14 [INFO] [stdout] | [INFO] [stdout] 3 | .map(|i| get_all_possible_operator_combos(i)) [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `get_all_possible_operator_combos` [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: returning the result of a `let` binding from a block [INFO] [stdout] --> src/day7/part1.rs:62:5 [INFO] [stdout] | [INFO] [stdout] 60 | let results = permute(results, 1, len); [INFO] [stdout] | --------------------------------------- unnecessary `let` binding [INFO] [stdout] 61 | [INFO] [stdout] 62 | results [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] 60 ~ [INFO] [stdout] 61 | [INFO] [stdout] 62 ~ permute(results, 1, len) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant redefinition of a binding `len` [INFO] [stdout] --> src/day7/part1.rs:51:5 [INFO] [stdout] | [INFO] [stdout] 51 | let len = len; [INFO] [stdout] | ^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] help: `len` is initially defined here [INFO] [stdout] --> src/day7/part1.rs:50:41 [INFO] [stdout] | [INFO] [stdout] 50 | pub fn get_all_possible_operator_combos(len: usize) -> Vec> { [INFO] [stdout] | ^^^ [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_locals [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: calls to `push` immediately after creation [INFO] [stdout] --> src/day7/part1.rs:55:9 [INFO] [stdout] | [INFO] [stdout] 55 | / let mut result = vec![]; [INFO] [stdout] 56 | | result.push(operator); [INFO] [stdout] | |______________________________^ help: consider using the `vec![]` macro: `let result = vec![..];` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#vec_init_then_push [INFO] [stdout] = note: `#[warn(clippy::vec_init_then_push)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant closure [INFO] [stdout] --> src/day7/part2.rs:3:14 [INFO] [stdout] | [INFO] [stdout] 3 | .map(|i| get_all_possible_operator_combos(i)) [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace the closure with the function itself: `get_all_possible_operator_combos` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: returning the result of a `let` binding from a block [INFO] [stdout] --> src/day7/part2.rs:65:5 [INFO] [stdout] | [INFO] [stdout] 63 | let results = permute(results, 1, len); [INFO] [stdout] | --------------------------------------- unnecessary `let` binding [INFO] [stdout] 64 | [INFO] [stdout] 65 | results [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] 63 ~ [INFO] [stdout] 64 | [INFO] [stdout] 65 ~ permute(results, 1, len) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant redefinition of a binding `len` [INFO] [stdout] --> src/day7/part2.rs:54:5 [INFO] [stdout] | [INFO] [stdout] 54 | let len = len; [INFO] [stdout] | ^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] help: `len` is initially defined here [INFO] [stdout] --> src/day7/part2.rs:53:41 [INFO] [stdout] | [INFO] [stdout] 53 | pub fn get_all_possible_operator_combos(len: usize) -> Vec> { [INFO] [stdout] | ^^^ [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_locals [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: calls to `push` immediately after creation [INFO] [stdout] --> src/day7/part2.rs:58:9 [INFO] [stdout] | [INFO] [stdout] 58 | / let mut result = vec![]; [INFO] [stdout] 59 | | result.push(operator); [INFO] [stdout] | |______________________________^ help: consider using the `vec![]` macro: `let result = vec![..];` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#vec_init_then_push [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: called `map(..).flatten()` on `Iterator` [INFO] [stdout] --> src/day9/part1.rs:7:10 [INFO] [stdout] | [INFO] [stdout] 7 | .map(|(i, length)| { [INFO] [stdout] | __________^ [INFO] [stdout] 8 | | if i % 2 == 0 { [INFO] [stdout] 9 | | let id = file_id; [INFO] [stdout] 10 | | file_id += 1; [INFO] [stdout] ... | [INFO] [stdout] 15 | | }) [INFO] [stdout] 16 | | .flatten() [INFO] [stdout] | |__________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_flatten [INFO] [stdout] help: try replacing `map` with `flat_map` and remove the `.flatten()` [INFO] [stdout] | [INFO] [stdout] 7 ~ .flat_map(|(i, length)| { [INFO] [stdout] 8 + if i % 2 == 0 { [INFO] [stdout] 9 + let id = file_id; [INFO] [stdout] 10 + file_id += 1; [INFO] [stdout] 11 + vec![Some(id); length as usize] [INFO] [stdout] 12 + } else { [INFO] [stdout] 13 + vec![None; length as usize] [INFO] [stdout] 14 + } [INFO] [stdout] 15 + }) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of `Option::map` [INFO] [stdout] --> src/day9/part1.rs:53:13 [INFO] [stdout] | [INFO] [stdout] 53 | / if let Some(block) = block { [INFO] [stdout] 54 | | Some((i * block) as u64) [INFO] [stdout] 55 | | } else { [INFO] [stdout] 56 | | None [INFO] [stdout] 57 | | } [INFO] [stdout] | |_____________^ help: try: `block.as_ref().map(|block| (i * block) as u64)` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_map [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: importing legacy numeric constants [INFO] [stdout] --> src/day9/part2.rs:1:5 [INFO] [stdout] | [INFO] [stdout] 1 | use std::usize; [INFO] [stdout] | ^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: remove this import [INFO] [stdout] = note: then `usize::` will resolve to the respective associated constant [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#legacy_numeric_constants [INFO] [stdout] = note: `#[warn(clippy::legacy_numeric_constants)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `.filter_map(..)` can be written more simply using `.map(..)` [INFO] [stdout] --> src/day9/part2.rs:70:10 [INFO] [stdout] | [INFO] [stdout] 70 | .filter_map(|block| { [INFO] [stdout] | __________^ [INFO] [stdout] 71 | | if block.is_free { [INFO] [stdout] 72 | | Some(vec![0; block.length as usize]) [INFO] [stdout] 73 | | } else { [INFO] [stdout] ... | [INFO] [stdout] 76 | | }) [INFO] [stdout] | |__________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_filter_map [INFO] [stdout] = note: `#[warn(clippy::unnecessary_filter_map)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: called `.iter().count()` on a `Vec` [INFO] [stdout] --> src/main.rs:46:51 [INFO] [stdout] | [INFO] [stdout] 46 | timings.iter().sum::() as f64 / timings.iter().count() as f64 [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `timings.len()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#iter_count [INFO] [stdout] = note: `#[warn(clippy::iter_count)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: writing `&String` instead of `&str` involves a new object where a slice will do [INFO] [stdout] --> src/main.rs:53:28 [INFO] [stdout] | [INFO] [stdout] 53 | pub fn run_solution(input: &String, day: u8, part: u8) -> String { [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] 53 ~ pub fn run_solution(input: &str, day: u8, part: u8) -> String { [INFO] [stdout] 54 ~ let input = input.to_owned(); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: useless use of `vec!` [INFO] [stdout] --> src/day14/part1.rs:32:27 [INFO] [stdout] | [INFO] [stdout] 32 | let mut quad_counts = vec![0, 0, 0, 0]; [INFO] [stdout] | ^^^^^^^^^^^^^^^^ help: you can use an array directly: `[0, 0, 0, 0]` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_vec [INFO] [stdout] = note: `#[warn(clippy::useless_vec)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stderr] Finished `dev` profile [unoptimized + debuginfo] target(s) in 6.10s [INFO] running `Command { std: "docker" "inspect" "ac97cfd8a9cc48b8f65cc4fe003bbd22979c7a1862f62a1c27665585b1b154ce", kill_on_drop: false }` [INFO] running `Command { std: "docker" "rm" "-f" "ac97cfd8a9cc48b8f65cc4fe003bbd22979c7a1862f62a1c27665585b1b154ce", kill_on_drop: false }` [INFO] [stdout] ac97cfd8a9cc48b8f65cc4fe003bbd22979c7a1862f62a1c27665585b1b154ce