[INFO] cloning repository https://github.com/NathanNull/AOC2024 [INFO] running `Command { std: "git" "-c" "credential.helper=" "-c" "credential.helper=/workspace/cargo-home/bin/git-credential-null" "clone" "--bare" "https://github.com/NathanNull/AOC2024" "/workspace/cache/git-repos/https%3A%2F%2Fgithub.com%2FNathanNull%2FAOC2024", kill_on_drop: false }` [INFO] [stderr] Cloning into bare repository '/workspace/cache/git-repos/https%3A%2F%2Fgithub.com%2FNathanNull%2FAOC2024'... [INFO] running `Command { std: "git" "rev-parse" "HEAD", kill_on_drop: false }` [INFO] [stdout] b99ac2c9247f4494a2865c58ad7cac3ab5500c14 [INFO] linting NathanNull/AOC2024 against nightly for clippy-nonminimal_bool-denied [INFO] running `Command { std: "git" "clone" "/workspace/cache/git-repos/https%3A%2F%2Fgithub.com%2FNathanNull%2FAOC2024" "/workspace/builds/worker-1-tc1/source", kill_on_drop: false }` [INFO] [stderr] Cloning into '/workspace/builds/worker-1-tc1/source'... [INFO] [stderr] done. [INFO] started tweaking git repo https://github.com/NathanNull/AOC2024 [INFO] finished tweaking git repo https://github.com/NathanNull/AOC2024 [INFO] tweaked toml for git repo https://github.com/NathanNull/AOC2024 written to /workspace/builds/worker-1-tc1/source/Cargo.toml [INFO] validating manifest of git repo https://github.com/NathanNull/AOC2024 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/NathanNull/AOC2024 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-1-tc1/target:/opt/rustwide/target:rw,Z" "-v" "/var/lib/crater-agent-workspace/builds/worker-1-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] 6105f9414e09951396b12225e865dd2551bad7ee1d44be6829e65b26923d332c [INFO] running `Command { std: "docker" "start" "-a" "6105f9414e09951396b12225e865dd2551bad7ee1d44be6829e65b26923d332c", kill_on_drop: false }` [INFO] running `Command { std: "docker" "inspect" "6105f9414e09951396b12225e865dd2551bad7ee1d44be6829e65b26923d332c", kill_on_drop: false }` [INFO] running `Command { std: "docker" "rm" "-f" "6105f9414e09951396b12225e865dd2551bad7ee1d44be6829e65b26923d332c", kill_on_drop: false }` [INFO] [stdout] 6105f9414e09951396b12225e865dd2551bad7ee1d44be6829e65b26923d332c [INFO] running `Command { std: "docker" "create" "-v" "/var/lib/crater-agent-workspace/builds/worker-1-tc1/target:/opt/rustwide/target:rw,Z" "-v" "/var/lib/crater-agent-workspace/builds/worker-1-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] f21cffe8724c37475ac395ebec638d6e4ee8f04ea3ebb208039dc7b14f3a2e77 [INFO] running `Command { std: "docker" "start" "-a" "f21cffe8724c37475ac395ebec638d6e4ee8f04ea3ebb208039dc7b14f3a2e77", kill_on_drop: false }` [INFO] [stderr] Checking aho-corasick v1.1.2 [INFO] [stderr] Checking either v1.13.0 [INFO] [stderr] Checking find_folder v0.3.0 [INFO] [stderr] Checking itertools v0.13.0 [INFO] [stderr] Checking regex-automata v0.4.3 [INFO] [stderr] Checking regex v1.10.2 [INFO] [stderr] Checking aoc2023 v0.1.0 (/opt/rustwide/workdir) [INFO] [stdout] warning: casting to the same type is unnecessary (`i64` -> `i64`) [INFO] [stdout] --> src/day1.rs:32:16 [INFO] [stdout] | [INFO] [stdout] 32 | acc + (pos as i64 - arr2[idx] as i64).abs() [INFO] [stdout] | ^^^^^^^^^^ help: try: `pos` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast [INFO] [stdout] = note: `#[warn(clippy::unnecessary_cast)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: casting to the same type is unnecessary (`i64` -> `i64`) [INFO] [stdout] --> src/day1.rs:32:29 [INFO] [stdout] | [INFO] [stdout] 32 | acc + (pos as i64 - arr2[idx] as i64).abs() [INFO] [stdout] | ^^^^^^^^^^^^^^^^ help: try: `arr2[idx]` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: usage of `contains_key` followed by `insert` on a `HashMap` [INFO] [stdout] --> src/day1.rs:50:9 [INFO] [stdout] | [INFO] [stdout] 50 | / if !freq.contains_key(&i) { [INFO] [stdout] 51 | | freq.insert(i, 1); [INFO] [stdout] 52 | | } else { [INFO] [stdout] 53 | | *freq.get_mut(&i).unwrap() += 1; [INFO] [stdout] 54 | | } [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] 50 ~ if let std::collections::hash_map::Entry::Vacant(e) = freq.entry(i) { [INFO] [stdout] 51 + e.insert(1); [INFO] [stdout] 52 + } else { [INFO] [stdout] 53 + *freq.get_mut(&i).unwrap() += 1; [INFO] [stdout] 54 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/day1.rs:59:47 [INFO] [stdout] | [INFO] [stdout] 59 | .fold(0, |acc, v| acc + (v * freq.get(&v).unwrap_or(&0))); [INFO] [stdout] | ^^ help: change this to: `v` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow [INFO] [stdout] = note: `#[warn(clippy::needless_borrow)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/day10.rs:53:9 [INFO] [stdout] | [INFO] [stdout] 53 | return hs.into_iter().collect(); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] = note: `#[warn(clippy::needless_return)]` on by default [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 53 - return hs.into_iter().collect(); [INFO] [stdout] 53 + hs.into_iter().collect() [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/day10.rs:55:9 [INFO] [stdout] | [INFO] [stdout] 55 | return score; [INFO] [stdout] | ^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 55 - return score; [INFO] [stdout] 55 + score [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: usage of `contains_key` followed by `insert` on a `HashMap` [INFO] [stdout] --> src/day11.rs:6:9 [INFO] [stdout] | [INFO] [stdout] 6 | / if !stones.contains_key(&s) { [INFO] [stdout] 7 | | stones.insert(s, 0); [INFO] [stdout] 8 | | } [INFO] [stdout] | |_________^ help: try: `stones.entry(s).or_insert(0);` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_entry [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: usage of `contains_key` followed by `insert` on a `HashMap` [INFO] [stdout] --> src/day11.rs:29:13 [INFO] [stdout] | [INFO] [stdout] 29 | / if !stones.contains_key(&s) { [INFO] [stdout] 30 | | stones.insert(s, 0); [INFO] [stdout] 31 | | } [INFO] [stdout] | |_____________^ help: try: `stones.entry(s).or_insert(0);` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_entry [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/day12.rs:98:5 [INFO] [stdout] | [INFO] [stdout] 98 | return (seen, perimeter, sides.len()); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 98 - return (seen, perimeter, sides.len()); [INFO] [stdout] 98 + (seen, perimeter, sides.len()) [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/day12.rs:26:11 [INFO] [stdout] | [INFO] [stdout] 26 | grid: &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] 26 - grid: &Vec>, [INFO] [stdout] 26 + grid: &[Vec], [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: very complex type used. Consider factoring parts into `type` definitions [INFO] [stdout] --> src/day12.rs:61:20 [INFO] [stdout] | [INFO] [stdout] 61 | let mut sides: HashSet<((i64, i64), Vec<(i64, i64)>)> = [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity [INFO] [stdout] = note: `#[warn(clippy::type_complexity)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: very complex type used. Consider factoring parts into `type` definitions [INFO] [stdout] --> src/day12.rs:66:28 [INFO] [stdout] | [INFO] [stdout] 66 | let mut new_sides: HashSet<((i64, i64), Vec<(i64, i64)>)> = HashSet::new(); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/day13.rs:37:9 [INFO] [stdout] | [INFO] [stdout] 37 | return (ap, bp); [INFO] [stdout] | ^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 37 - return (ap, bp); [INFO] [stdout] 37 + (ap, bp) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/day13.rs:39:9 [INFO] [stdout] | [INFO] [stdout] 39 | return (0, 0); [INFO] [stdout] | ^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 39 - return (0, 0); [INFO] [stdout] 39 + (0, 0) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: casting to the same type is unnecessary (`i64` -> `i64`) [INFO] [stdout] --> src/day13.rs:35:21 [INFO] [stdout] | [INFO] [stdout] 35 | let (ap, bp) = (ap as i64, bp as i64); [INFO] [stdout] | ^^^^^^^^^ help: try: `ap` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: casting to the same type is unnecessary (`i64` -> `i64`) [INFO] [stdout] --> src/day13.rs:35:32 [INFO] [stdout] | [INFO] [stdout] 35 | let (ap, bp) = (ap as i64, bp as i64); [INFO] [stdout] | ^^^^^^^^^ help: try: `bp` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/day14.rs:84:5 [INFO] [stdout] | [INFO] [stdout] 84 | return diag_count >= 30; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 84 - return diag_count >= 30; [INFO] [stdout] 84 + diag_count >= 30 [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you are using an explicit closure for cloning elements [INFO] [stdout] --> src/day15.rs:12:21 [INFO] [stdout] | [INFO] [stdout] 12 | let old_g = grid.iter().map(|l| l.clone()).collect::>(); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `cloned` method: `grid.iter().cloned()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_clone [INFO] [stdout] = note: `#[warn(clippy::map_clone)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this looks like you are swapping `cur_held` and `grid[move_pos.1 as usize][move_pos.0 as usize]` manually [INFO] [stdout] --> src/day15.rs:76:25 [INFO] [stdout] | [INFO] [stdout] 76 | / let temp = cur_held; [INFO] [stdout] 77 | | cur_held = grid[move_pos.1 as usize][move_pos.0 as usize]; [INFO] [stdout] 78 | | grid[move_pos.1 as usize][move_pos.0 as usize] = temp; [INFO] [stdout] | |______________________________________________________________________________^ help: try: `std::mem::swap(&mut cur_held, &mut grid[move_pos.1 as usize][move_pos.0 as usize]);` [INFO] [stdout] | [INFO] [stdout] = note: or maybe you should use `std::mem::replace`? [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_swap [INFO] [stdout] = note: `#[warn(clippy::manual_swap)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you are using an explicit closure for copying elements [INFO] [stdout] --> src/day15.rs:141:48 [INFO] [stdout] | [INFO] [stdout] 141 | .and_then(|v1| side_2.map(|v2| v1.union(&v2).map(|&p| p).collect::>())) [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `copied` method: `v1.union(&v2).copied()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_clone [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: very complex type used. Consider factoring parts into `type` definitions [INFO] [stdout] --> src/day16.rs:32:25 [INFO] [stdout] | [INFO] [stdout] 32 | let mut to_explore: Vec<((i64, i64), Direction, usize, Vec<(i64, i64)>)> = vec![]; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you are using an explicit closure for copying elements [INFO] [stdout] --> src/day16.rs:69:34 [INFO] [stdout] | [INFO] [stdout] 69 | ... *h = HashSet::<_>::from_iter(h.clone().into_iter().chain(new_hist.clone())) [INFO] [stdout] | ____________________________^ [INFO] [stdout] 70 | | ... .iter() [INFO] [stdout] 71 | | ... .map(|info| *info) [INFO] [stdout] | |____________________________________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_clone [INFO] [stdout] help: consider calling the dedicated `copied` method [INFO] [stdout] | [INFO] [stdout] 69 ~ *h = HashSet::<_>::from_iter(h.clone().into_iter().chain(new_hist.clone())) [INFO] [stdout] 70 + .iter().copied() [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `idx` is used to index `ops` [INFO] [stdout] --> src/day17.rs:64:32 [INFO] [stdout] | [INFO] [stdout] 64 | for idx in i + 1..ops.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 and enumerate() [INFO] [stdout] | [INFO] [stdout] 64 - for idx in i + 1..ops.len() { [INFO] [stdout] 64 + for (idx, ) in ops.iter().enumerate().skip(i + 1) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: accessing first element with `output.get(0)` [INFO] [stdout] --> src/day17.rs:71:24 [INFO] [stdout] | [INFO] [stdout] 71 | if output.get(0).is_some_and(|o| *o == ops[i]) { [INFO] [stdout] | ^^^^^^^^^^^^^ help: try: `output.first()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#get_first [INFO] [stdout] = note: `#[warn(clippy::get_first)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do [INFO] [stdout] --> src/day17.rs:88:48 [INFO] [stdout] | [INFO] [stdout] 88 | fn run_program(mut registers: Vec, ops: &Vec) -> Vec { [INFO] [stdout] | ^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg [INFO] [stdout] help: change this to [INFO] [stdout] | [INFO] [stdout] 88 - fn run_program(mut registers: Vec, ops: &Vec) -> Vec { [INFO] [stdout] 88 + fn run_program(mut registers: Vec, ops: &[usize]) -> Vec { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this loop could be written as a `while let` loop [INFO] [stdout] --> src/day17.rs:91:5 [INFO] [stdout] | [INFO] [stdout] 91 | / loop { [INFO] [stdout] 92 | | if let Some(&op) = ops.get(ins_ptr) { [INFO] [stdout] 93 | | if let Some(&lit) = ops.get(ins_ptr + 1) { [INFO] [stdout] ... | [INFO] [stdout] 128 | | ins_ptr += 2; [INFO] [stdout] 129 | | } [INFO] [stdout] | |_____^ help: try: `while let Some(&op) = ops.get(ins_ptr) { .. }` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#while_let_loop [INFO] [stdout] = note: `#[warn(clippy::while_let_loop)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of an assign operation [INFO] [stdout] --> src/day17.rs:99:26 [INFO] [stdout] | [INFO] [stdout] 99 | 0 => registers[0] = registers[0] / 2usize.pow(combo(lit, ®isters) as u32), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `registers[0] /= 2usize.pow(combo(lit, ®isters) as u32)` [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/day17.rs:100:26 [INFO] [stdout] | [INFO] [stdout] 100 | 1 => registers[1] = registers[1] ^ lit, [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `registers[1] ^= lit` [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: casting to the same type is unnecessary (`usize` -> `usize`) [INFO] [stdout] --> src/day17.rs:104:39 [INFO] [stdout] | [INFO] [stdout] 104 | ... ins_ptr = lit as usize; [INFO] [stdout] | ^^^^^^^^^^^^ help: try: `lit` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of an assign operation [INFO] [stdout] --> src/day17.rs:108:26 [INFO] [stdout] | [INFO] [stdout] 108 | 4 => registers[1] = registers[1] ^ registers[2], [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `registers[1] ^= registers[2]` [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: writing `&Vec` instead of `&[_]` involves a new object where a slice will do [INFO] [stdout] --> src/day17.rs:133:28 [INFO] [stdout] | [INFO] [stdout] 133 | fn combo(lit: usize, regs: &Vec) -> usize { [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] 133 - fn combo(lit: usize, regs: &Vec) -> usize { [INFO] [stdout] 133 + fn combo(lit: usize, regs: &[usize]) -> usize { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: casting to the same type is unnecessary (`usize` -> `usize`) [INFO] [stdout] --> src/day17.rs:136:23 [INFO] [stdout] | [INFO] [stdout] 136 | 4..=6 => regs[(lit - 4) as usize], [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^ help: try: `((lit - 4))` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: importing legacy numeric constants [INFO] [stdout] --> src/day18.rs:1:33 [INFO] [stdout] | [INFO] [stdout] 1 | use std::{collections::HashSet, i64}; [INFO] [stdout] | ^^^ [INFO] [stdout] | [INFO] [stdout] = help: remove this import [INFO] [stdout] = note: then `i64::` 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: unneeded `return` statement [INFO] [stdout] --> src/day18.rs:70:5 [INFO] [stdout] | [INFO] [stdout] 70 | return None; [INFO] [stdout] | ^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 70 - return None; [INFO] [stdout] 70 + None [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/day19.rs:66:5 [INFO] [stdout] | [INFO] [stdout] 66 | return ret; [INFO] [stdout] | ^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 66 - return ret; [INFO] [stdout] 66 + ret [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: length comparison to zero [INFO] [stdout] --> src/day19.rs:44:8 [INFO] [stdout] | [INFO] [stdout] 44 | if pattern.len() == 0 { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `pattern.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/day19.rs:54:11 [INFO] [stdout] | [INFO] [stdout] 54 | while pattern.len() > 0 { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!pattern.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: unneeded `return` statement [INFO] [stdout] --> src/day2.rs:28:17 [INFO] [stdout] | [INFO] [stdout] 28 | return false; [INFO] [stdout] | ^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 28 - return false; [INFO] [stdout] 28 + false [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/day2.rs:47:5 [INFO] [stdout] | [INFO] [stdout] 47 | return true; [INFO] [stdout] | ^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 47 - return true; [INFO] [stdout] 47 + true [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is only used to index `report` [INFO] [stdout] --> src/day2.rs:39:14 [INFO] [stdout] | [INFO] [stdout] 39 | for i in 1..=report.len() - 1 { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 39 - for i in 1..=report.len() - 1 { [INFO] [stdout] 39 + for in report.iter().take((report.len() - 1) + 1).skip(1) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: importing legacy numeric constants [INFO] [stdout] --> src/day20.rs:3:5 [INFO] [stdout] | [INFO] [stdout] 3 | 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] [INFO] [stdout] [INFO] [stdout] warning: called `map(..).flatten()` on `Iterator` [INFO] [stdout] --> src/day20.rs:20:10 [INFO] [stdout] | [INFO] [stdout] 20 | .map(|(y, l)| l.iter().enumerate().map(move |(x, c)| (x, y, c))) [INFO] [stdout] | __________^ [INFO] [stdout] 21 | | .flatten() [INFO] [stdout] | |__________________^ help: try replacing `map` with `flat_map` and remove the `.flatten()`: `flat_map(|(y, l)| l.iter().enumerate().map(move |(x, c)| (x, y, c)))` [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: called `map(..).flatten()` on `Iterator` [INFO] [stdout] --> src/day20.rs:28:10 [INFO] [stdout] | [INFO] [stdout] 28 | .map(|(y, l)| l.iter().enumerate().map(move |(x, c)| (x, y, c))) [INFO] [stdout] | __________^ [INFO] [stdout] 29 | | .flatten() [INFO] [stdout] | |__________________^ help: try replacing `map` with `flat_map` and remove the `.flatten()`: `flat_map(|(y, l)| l.iter().enumerate().map(move |(x, c)| (x, y, c)))` [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: casting the result of `i64::abs()` to usize [INFO] [stdout] --> src/day20.rs:77:55 [INFO] [stdout] | [INFO] [stdout] 77 | ... + v_off.abs() as usize [INFO] [stdout] | ^^^^^^^^^^^ help: replace with: `v_off.unsigned_abs()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_abs_to_unsigned [INFO] [stdout] = note: `#[warn(clippy::cast_abs_to_unsigned)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: casting the result of `i64::abs()` to usize [INFO] [stdout] --> src/day20.rs:78:55 [INFO] [stdout] | [INFO] [stdout] 78 | ... + h_off.abs() as usize [INFO] [stdout] | ^^^^^^^^^^^ help: replace with: `h_off.unsigned_abs()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_abs_to_unsigned [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/day20.rs:131:5 [INFO] [stdout] | [INFO] [stdout] 131 | return vec![]; [INFO] [stdout] | ^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 131 - return vec![]; [INFO] [stdout] 131 + vec![] [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do [INFO] [stdout] --> src/day20.rs:102:20 [INFO] [stdout] | [INFO] [stdout] 102 | fn find_path(grid: &Vec>, start_pos: (i64, i64), end_pos: (i64, i64)) -> Vec<(i64, i64)> { [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] 102 - fn find_path(grid: &Vec>, start_pos: (i64, i64), end_pos: (i64, i64)) -> Vec<(i64, i64)> { [INFO] [stdout] 102 + fn find_path(grid: &[Vec], start_pos: (i64, i64), end_pos: (i64, i64)) -> Vec<(i64, i64)> { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/day21.rs:58:42 [INFO] [stdout] | [INFO] [stdout] 58 | let target_pos = pos_by_char.get(&char).unwrap(); [INFO] [stdout] | ^^^^^ help: change this to: `char` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/day21.rs:99:5 [INFO] [stdout] | [INFO] [stdout] 99 | / return dirs [INFO] [stdout] 100 | | .into_iter() [INFO] [stdout] 101 | | .permutations(len) [INFO] [stdout] 102 | | .unique() [INFO] [stdout] ... | [INFO] [stdout] 119 | | .map(|p| p.into_iter().chain(['a']).collect()) [INFO] [stdout] 120 | | .collect(); [INFO] [stdout] | |__________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 99 ~ dirs [INFO] [stdout] 100 + .into_iter() [INFO] [stdout] 101 + .permutations(len) [INFO] [stdout] 102 + .unique() [INFO] [stdout] 103 + .filter(|d| { [INFO] [stdout] 104 + let mut pos = *curr_pos; [INFO] [stdout] 105 + for dc in d { [INFO] [stdout] 106 + match dc { [INFO] [stdout] 107 + '^' => pos.1 -= 1, [INFO] [stdout] 108 + 'v' => pos.1 += 1, [INFO] [stdout] 109 + '<' => pos.0 -= 1, [INFO] [stdout] 110 + '>' => pos.0 += 1, [INFO] [stdout] 111 + _ => unreachable!(), [INFO] [stdout] 112 + } [INFO] [stdout] 113 + if pos == invalid_space { [INFO] [stdout] 114 + return false; [INFO] [stdout] 115 + } [INFO] [stdout] 116 + } [INFO] [stdout] 117 + true [INFO] [stdout] 118 + }) [INFO] [stdout] 119 + .map(|p| p.into_iter().chain(['a']).collect()) [INFO] [stdout] 120 ~ .collect() [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: usage of `contains_key` followed by `insert` on a `HashMap` [INFO] [stdout] --> src/day22.rs:20:17 [INFO] [stdout] | [INFO] [stdout] 20 | / if !possible_sales.contains_key(&k) { [INFO] [stdout] 21 | | possible_sales.insert(k, price); [INFO] [stdout] 22 | | } [INFO] [stdout] | |_________________^ help: try: `possible_sales.entry(k).or_insert(price);` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_entry [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: usage of `contains_key` followed by `insert` on a `HashMap` [INFO] [stdout] --> src/day22.rs:27:13 [INFO] [stdout] | [INFO] [stdout] 27 | / if !overall_sales.contains_key(&k) { [INFO] [stdout] 28 | | overall_sales.insert(k, v); [INFO] [stdout] 29 | | } else { [INFO] [stdout] 30 | | *overall_sales.get_mut(&k).unwrap() += v; [INFO] [stdout] 31 | | } [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] help: try [INFO] [stdout] | [INFO] [stdout] 27 ~ if let std::collections::hash_map::Entry::Vacant(e) = overall_sales.entry(k) { [INFO] [stdout] 28 + e.insert(v); [INFO] [stdout] 29 + } else { [INFO] [stdout] 30 + *overall_sales.get_mut(&k).unwrap() += v; [INFO] [stdout] 31 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: iterating on a map's keys [INFO] [stdout] --> src/day23.rs:48:13 [INFO] [stdout] | [INFO] [stdout] 48 | connections.iter().map(|(k, _)| *k).collect(), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `connections.keys().map(|k| *k)` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#iter_kv_map [INFO] [stdout] = note: `#[warn(clippy::iter_kv_map)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you are using an explicit closure for copying elements [INFO] [stdout] --> src/day23.rs:79:17 [INFO] [stdout] | [INFO] [stdout] 79 | r.union(&HashSet::from_iter([*v])).map(|n| *n).collect(), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `copied` method: `r.union(&HashSet::from_iter([*v])).copied()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_clone [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you are using an explicit closure for copying elements [INFO] [stdout] --> src/day23.rs:80:17 [INFO] [stdout] | [INFO] [stdout] 80 | p.intersection(n).map(|n| *n).collect(), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `copied` method: `p.intersection(n).copied()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_clone [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you are using an explicit closure for copying elements [INFO] [stdout] --> src/day23.rs:81:17 [INFO] [stdout] | [INFO] [stdout] 81 | x.intersection(n).map(|n| *n).collect(), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `copied` method: `x.intersection(n).copied()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_clone [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: called `.nth(0)` on a `std::iter::Iterator`, when `.next()` is equivalent [INFO] [stdout] --> src/day24.rs:11:14 [INFO] [stdout] | [INFO] [stdout] 11 | (a.split(':').nth(0).unwrap(), b.parse::().unwrap() == 1) [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^ help: try calling `.next()` instead of `.nth(0)`: `a.split(':').next()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#iter_nth_zero [INFO] [stdout] = note: `#[warn(clippy::iter_nth_zero)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: called `map(..).flatten()` on `Iterator` [INFO] [stdout] --> src/day24.rs:24:10 [INFO] [stdout] | [INFO] [stdout] 24 | .map(|g| g.0.iter().map(|s|*s).chain([g.2])) [INFO] [stdout] | __________^ [INFO] [stdout] 25 | | .flatten() [INFO] [stdout] | |__________________^ help: try replacing `map` with `flat_map` and remove the `.flatten()`: `flat_map(|g| g.0.iter().map(|s|*s).chain([g.2]))` [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: you are using an explicit closure for copying elements [INFO] [stdout] --> src/day24.rs:24:18 [INFO] [stdout] | [INFO] [stdout] 24 | .map(|g| g.0.iter().map(|s|*s).chain([g.2])) [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `copied` method: `g.0.iter().copied()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_clone [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: iterating on a map's keys [INFO] [stdout] --> src/day24.rs:26:16 [INFO] [stdout] | [INFO] [stdout] 26 | .chain(inits.iter().map(|(w, _)| *w)) [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `inits.keys().map(|w| *w)` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#iter_kv_map [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is used to index `zn` [INFO] [stdout] --> src/day24.rs:64:22 [INFO] [stdout] | [INFO] [stdout] 64 | for i in 1..=44 { [INFO] [stdout] | ^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator and enumerate() [INFO] [stdout] | [INFO] [stdout] 64 - for i in 1..=44 { [INFO] [stdout] 64 + for (i, ) in zn.iter().enumerate().take(44 + 1).skip(1) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: called `.nth(0)` on a `std::iter::Iterator`, when `.next()` is equivalent [INFO] [stdout] --> src/day25.rs:20:12 [INFO] [stdout] | [INFO] [stdout] 20 | if diagram.chars().nth(0).unwrap() == '#' { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^ help: try calling `.next()` instead of `.nth(0)`: `diagram.chars().next()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#iter_nth_zero [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `.fold` can be written more succinctly using another method [INFO] [stdout] --> src/day3.rs:19:18 [INFO] [stdout] | [INFO] [stdout] 19 | .fold(1, |acc, n| acc * n); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `product::()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_fold [INFO] [stdout] = note: `#[warn(clippy::unnecessary_fold)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this boolean expression can be simplified [INFO] [stdout] --> src/day4.rs:28:32 [INFO] [stdout] | [INFO] [stdout] 28 | ... if !grid [INFO] [stdout] | __________________________^ [INFO] [stdout] 29 | | ... .get(py as usize) [INFO] [stdout] 30 | | ... .and_then(|r| r.get(px as usize)) [INFO] [stdout] 31 | | ... .is_some_and(|l| *l == letter) [INFO] [stdout] | |________________________________________________________^ [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] help: try [INFO] [stdout] | [INFO] [stdout] 28 ~ if grid [INFO] [stdout] 29 + .get(py as usize) [INFO] [stdout] 30 + .and_then(|r| r.get(px as usize)).is_none_or(|l| *l != letter) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: usage of `contains_key` followed by `insert` on a `HashMap` [INFO] [stdout] --> src/day5.rs:23:9 [INFO] [stdout] | [INFO] [stdout] 23 | / if !reqs_dict.contains_key(&second) { [INFO] [stdout] 24 | | reqs_dict.insert(second, vec![]); [INFO] [stdout] 25 | | } [INFO] [stdout] | |_________^ help: try: `reqs_dict.entry(second).or_insert_with(|| vec![]);` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_entry [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/day5.rs:76:5 [INFO] [stdout] | [INFO] [stdout] 76 | return valid; [INFO] [stdout] | ^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 76 - return valid; [INFO] [stdout] 76 + valid [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/day5.rs:66:52 [INFO] [stdout] | [INFO] [stdout] 66 | fn is_valid(reqs: &HashMap>, update: &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] 66 - fn is_valid(reqs: &HashMap>, update: &Vec) -> bool { [INFO] [stdout] 66 + fn is_valid(reqs: &HashMap>, update: &[i64]) -> bool { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/day5.rs:70:32 [INFO] [stdout] | [INFO] [stdout] 70 | if disallowed.contains(&page) { [INFO] [stdout] | ^^^^^ help: change this to: `page` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/day5.rs:74:36 [INFO] [stdout] | [INFO] [stdout] 74 | disallowed.extend(reqs.get(&page).unwrap_or(&vec![])); [INFO] [stdout] | ^^^^^ help: change this to: `page` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: very complex type used. Consider factoring parts into `type` definitions [INFO] [stdout] --> src/day6.rs:56:6 [INFO] [stdout] | [INFO] [stdout] 56 | ) -> Option>> { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/day6.rs:98:5 [INFO] [stdout] | [INFO] [stdout] 98 | return Some(visited); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 98 - return Some(visited); [INFO] [stdout] 98 + Some(visited) [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/day6.rs:54:11 [INFO] [stdout] | [INFO] [stdout] 54 | grid: &Vec>, [INFO] [stdout] | ^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg [INFO] [stdout] help: change this to [INFO] [stdout] | [INFO] [stdout] 54 - grid: &Vec>, [INFO] [stdout] 54 + grid: &[Vec], [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `(i64, i64, i64, i64)` which implements the `Copy` trait [INFO] [stdout] --> src/day6.rs:57:21 [INFO] [stdout] | [INFO] [stdout] 57 | let mut guard = curr_guard.clone(); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `curr_guard` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] = note: `#[warn(clippy::clone_on_copy)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: casting to the same type is unnecessary (`i64` -> `i64`) [INFO] [stdout] --> src/day1.rs:32:16 [INFO] [stdout] | [INFO] [stdout] 32 | acc + (pos as i64 - arr2[idx] as i64).abs() [INFO] [stdout] | ^^^^^^^^^^ help: try: `pos` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast [INFO] [stdout] = note: `#[warn(clippy::unnecessary_cast)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: usage of `contains_key` followed by `insert` on a `HashMap` [INFO] [stdout] --> src/day6.rs:79:17 [INFO] [stdout] | [INFO] [stdout] 79 | / if !visited.contains_key(&(guard.0, guard.1)) { [INFO] [stdout] 80 | | visited.insert((guard.0, guard.1), HashSet::new()); [INFO] [stdout] 81 | | } [INFO] [stdout] | |_________________^ help: try: `visited.entry((guard.0, guard.1)).or_insert_with(|| HashSet::new());` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_entry [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: casting to the same type is unnecessary (`i64` -> `i64`) [INFO] [stdout] --> src/day1.rs:32:29 [INFO] [stdout] | [INFO] [stdout] 32 | acc + (pos as i64 - arr2[idx] as i64).abs() [INFO] [stdout] | ^^^^^^^^^^^^^^^^ help: try: `arr2[idx]` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/day8.rs:6:81 [INFO] [stdout] | [INFO] [stdout] 6 | HashSet::from_iter(input.chars().filter(|c| !['\n', '\r', '.'].contains(&c))); [INFO] [stdout] | ^^ help: change this to: `c` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: usage of `contains_key` followed by `insert` on a `HashMap` [INFO] [stdout] --> src/day1.rs:50:9 [INFO] [stdout] | [INFO] [stdout] 50 | / if !freq.contains_key(&i) { [INFO] [stdout] 51 | | freq.insert(i, 1); [INFO] [stdout] 52 | | } else { [INFO] [stdout] 53 | | *freq.get_mut(&i).unwrap() += 1; [INFO] [stdout] 54 | | } [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] 50 ~ if let std::collections::hash_map::Entry::Vacant(e) = freq.entry(i) { [INFO] [stdout] 51 + e.insert(1); [INFO] [stdout] 52 + } else { [INFO] [stdout] 53 + *freq.get_mut(&i).unwrap() += 1; [INFO] [stdout] 54 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/day1.rs:59:47 [INFO] [stdout] | [INFO] [stdout] 59 | .fold(0, |acc, v| acc + (v * freq.get(&v).unwrap_or(&0))); [INFO] [stdout] | ^^ help: change this to: `v` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow [INFO] [stdout] = note: `#[warn(clippy::needless_borrow)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/day10.rs:53:9 [INFO] [stdout] | [INFO] [stdout] 53 | return hs.into_iter().collect(); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] = note: `#[warn(clippy::needless_return)]` on by default [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 53 - return hs.into_iter().collect(); [INFO] [stdout] 53 + hs.into_iter().collect() [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/day10.rs:55:9 [INFO] [stdout] | [INFO] [stdout] 55 | return score; [INFO] [stdout] | ^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 55 - return score; [INFO] [stdout] 55 + score [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `idx` is only used to index `ret` [INFO] [stdout] --> src/helpers.rs:4:16 [INFO] [stdout] | [INFO] [stdout] 4 | for idx in 0..N { [INFO] [stdout] | ^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 4 - for idx in 0..N { [INFO] [stdout] 4 + for in ret.iter_mut().take(N) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: usage of `contains_key` followed by `insert` on a `HashMap` [INFO] [stdout] --> src/day11.rs:6:9 [INFO] [stdout] | [INFO] [stdout] 6 | / if !stones.contains_key(&s) { [INFO] [stdout] 7 | | stones.insert(s, 0); [INFO] [stdout] 8 | | } [INFO] [stdout] | |_________^ help: try: `stones.entry(s).or_insert(0);` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_entry [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: usage of `contains_key` followed by `insert` on a `HashMap` [INFO] [stdout] --> src/day11.rs:29:13 [INFO] [stdout] | [INFO] [stdout] 29 | / if !stones.contains_key(&s) { [INFO] [stdout] 30 | | stones.insert(s, 0); [INFO] [stdout] 31 | | } [INFO] [stdout] | |_____________^ help: try: `stones.entry(s).or_insert(0);` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_entry [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/day12.rs:98:5 [INFO] [stdout] | [INFO] [stdout] 98 | return (seen, perimeter, sides.len()); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 98 - return (seen, perimeter, sides.len()); [INFO] [stdout] 98 + (seen, perimeter, sides.len()) [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/day12.rs:26:11 [INFO] [stdout] | [INFO] [stdout] 26 | grid: &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] 26 - grid: &Vec>, [INFO] [stdout] 26 + grid: &[Vec], [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: very complex type used. Consider factoring parts into `type` definitions [INFO] [stdout] --> src/day12.rs:61:20 [INFO] [stdout] | [INFO] [stdout] 61 | let mut sides: HashSet<((i64, i64), Vec<(i64, i64)>)> = [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity [INFO] [stdout] = note: `#[warn(clippy::type_complexity)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: very complex type used. Consider factoring parts into `type` definitions [INFO] [stdout] --> src/day12.rs:66:28 [INFO] [stdout] | [INFO] [stdout] 66 | let mut new_sides: HashSet<((i64, i64), Vec<(i64, i64)>)> = HashSet::new(); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/day13.rs:37:9 [INFO] [stdout] | [INFO] [stdout] 37 | return (ap, bp); [INFO] [stdout] | ^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 37 - return (ap, bp); [INFO] [stdout] 37 + (ap, bp) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/day13.rs:39:9 [INFO] [stdout] | [INFO] [stdout] 39 | return (0, 0); [INFO] [stdout] | ^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 39 - return (0, 0); [INFO] [stdout] 39 + (0, 0) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: casting to the same type is unnecessary (`i64` -> `i64`) [INFO] [stdout] --> src/day13.rs:35:21 [INFO] [stdout] | [INFO] [stdout] 35 | let (ap, bp) = (ap as i64, bp as i64); [INFO] [stdout] | ^^^^^^^^^ help: try: `ap` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: casting to the same type is unnecessary (`i64` -> `i64`) [INFO] [stdout] --> src/day13.rs:35:32 [INFO] [stdout] | [INFO] [stdout] 35 | let (ap, bp) = (ap as i64, bp as i64); [INFO] [stdout] | ^^^^^^^^^ help: try: `bp` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/day14.rs:84:5 [INFO] [stdout] | [INFO] [stdout] 84 | return diag_count >= 30; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 84 - return diag_count >= 30; [INFO] [stdout] 84 + diag_count >= 30 [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you are using an explicit closure for cloning elements [INFO] [stdout] --> src/day15.rs:12:21 [INFO] [stdout] | [INFO] [stdout] 12 | let old_g = grid.iter().map(|l| l.clone()).collect::>(); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `cloned` method: `grid.iter().cloned()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_clone [INFO] [stdout] = note: `#[warn(clippy::map_clone)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this looks like you are swapping `cur_held` and `grid[move_pos.1 as usize][move_pos.0 as usize]` manually [INFO] [stdout] --> src/day15.rs:76:25 [INFO] [stdout] | [INFO] [stdout] 76 | / let temp = cur_held; [INFO] [stdout] 77 | | cur_held = grid[move_pos.1 as usize][move_pos.0 as usize]; [INFO] [stdout] 78 | | grid[move_pos.1 as usize][move_pos.0 as usize] = temp; [INFO] [stdout] | |______________________________________________________________________________^ help: try: `std::mem::swap(&mut cur_held, &mut grid[move_pos.1 as usize][move_pos.0 as usize]);` [INFO] [stdout] | [INFO] [stdout] = note: or maybe you should use `std::mem::replace`? [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_swap [INFO] [stdout] = note: `#[warn(clippy::manual_swap)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you are using an explicit closure for copying elements [INFO] [stdout] --> src/day15.rs:141:48 [INFO] [stdout] | [INFO] [stdout] 141 | .and_then(|v1| side_2.map(|v2| v1.union(&v2).map(|&p| p).collect::>())) [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `copied` method: `v1.union(&v2).copied()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_clone [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: very complex type used. Consider factoring parts into `type` definitions [INFO] [stdout] --> src/day16.rs:32:25 [INFO] [stdout] | [INFO] [stdout] 32 | let mut to_explore: Vec<((i64, i64), Direction, usize, Vec<(i64, i64)>)> = vec![]; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you are using an explicit closure for copying elements [INFO] [stdout] --> src/day16.rs:69:34 [INFO] [stdout] | [INFO] [stdout] 69 | ... *h = HashSet::<_>::from_iter(h.clone().into_iter().chain(new_hist.clone())) [INFO] [stdout] | ____________________________^ [INFO] [stdout] 70 | | ... .iter() [INFO] [stdout] 71 | | ... .map(|info| *info) [INFO] [stdout] | |____________________________________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_clone [INFO] [stdout] help: consider calling the dedicated `copied` method [INFO] [stdout] | [INFO] [stdout] 69 ~ *h = HashSet::<_>::from_iter(h.clone().into_iter().chain(new_hist.clone())) [INFO] [stdout] 70 + .iter().copied() [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `idx` is used to index `ops` [INFO] [stdout] --> src/day17.rs:64:32 [INFO] [stdout] | [INFO] [stdout] 64 | for idx in i + 1..ops.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 and enumerate() [INFO] [stdout] | [INFO] [stdout] 64 - for idx in i + 1..ops.len() { [INFO] [stdout] 64 + for (idx, ) in ops.iter().enumerate().skip(i + 1) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: accessing first element with `output.get(0)` [INFO] [stdout] --> src/day17.rs:71:24 [INFO] [stdout] | [INFO] [stdout] 71 | if output.get(0).is_some_and(|o| *o == ops[i]) { [INFO] [stdout] | ^^^^^^^^^^^^^ help: try: `output.first()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#get_first [INFO] [stdout] = note: `#[warn(clippy::get_first)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do [INFO] [stdout] --> src/day17.rs:88:48 [INFO] [stdout] | [INFO] [stdout] 88 | fn run_program(mut registers: Vec, ops: &Vec) -> Vec { [INFO] [stdout] | ^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg [INFO] [stdout] help: change this to [INFO] [stdout] | [INFO] [stdout] 88 - fn run_program(mut registers: Vec, ops: &Vec) -> Vec { [INFO] [stdout] 88 + fn run_program(mut registers: Vec, ops: &[usize]) -> Vec { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this loop could be written as a `while let` loop [INFO] [stdout] --> src/day17.rs:91:5 [INFO] [stdout] | [INFO] [stdout] 91 | / loop { [INFO] [stdout] 92 | | if let Some(&op) = ops.get(ins_ptr) { [INFO] [stdout] 93 | | if let Some(&lit) = ops.get(ins_ptr + 1) { [INFO] [stdout] ... | [INFO] [stdout] 128 | | ins_ptr += 2; [INFO] [stdout] 129 | | } [INFO] [stdout] | |_____^ help: try: `while let Some(&op) = ops.get(ins_ptr) { .. }` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#while_let_loop [INFO] [stdout] = note: `#[warn(clippy::while_let_loop)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of an assign operation [INFO] [stdout] --> src/day17.rs:99:26 [INFO] [stdout] | [INFO] [stdout] 99 | 0 => registers[0] = registers[0] / 2usize.pow(combo(lit, ®isters) as u32), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `registers[0] /= 2usize.pow(combo(lit, ®isters) as u32)` [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/day17.rs:100:26 [INFO] [stdout] | [INFO] [stdout] 100 | 1 => registers[1] = registers[1] ^ lit, [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `registers[1] ^= lit` [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: casting to the same type is unnecessary (`usize` -> `usize`) [INFO] [stdout] --> src/day17.rs:104:39 [INFO] [stdout] | [INFO] [stdout] 104 | ... ins_ptr = lit as usize; [INFO] [stdout] | ^^^^^^^^^^^^ help: try: `lit` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of an assign operation [INFO] [stdout] --> src/day17.rs:108:26 [INFO] [stdout] | [INFO] [stdout] 108 | 4 => registers[1] = registers[1] ^ registers[2], [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `registers[1] ^= registers[2]` [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: writing `&Vec` instead of `&[_]` involves a new object where a slice will do [INFO] [stdout] --> src/day17.rs:133:28 [INFO] [stdout] | [INFO] [stdout] 133 | fn combo(lit: usize, regs: &Vec) -> usize { [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] 133 - fn combo(lit: usize, regs: &Vec) -> usize { [INFO] [stdout] 133 + fn combo(lit: usize, regs: &[usize]) -> usize { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: casting to the same type is unnecessary (`usize` -> `usize`) [INFO] [stdout] --> src/day17.rs:136:23 [INFO] [stdout] | [INFO] [stdout] 136 | 4..=6 => regs[(lit - 4) as usize], [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^ help: try: `((lit - 4))` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: importing legacy numeric constants [INFO] [stdout] --> src/day18.rs:1:33 [INFO] [stdout] | [INFO] [stdout] 1 | use std::{collections::HashSet, i64}; [INFO] [stdout] | ^^^ [INFO] [stdout] | [INFO] [stdout] = help: remove this import [INFO] [stdout] = note: then `i64::` 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: unneeded `return` statement [INFO] [stdout] --> src/day18.rs:70:5 [INFO] [stdout] | [INFO] [stdout] 70 | return None; [INFO] [stdout] | ^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 70 - return None; [INFO] [stdout] 70 + None [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/day19.rs:66:5 [INFO] [stdout] | [INFO] [stdout] 66 | return ret; [INFO] [stdout] | ^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 66 - return ret; [INFO] [stdout] 66 + ret [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: length comparison to zero [INFO] [stdout] --> src/day19.rs:44:8 [INFO] [stdout] | [INFO] [stdout] 44 | if pattern.len() == 0 { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `pattern.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/day19.rs:54:11 [INFO] [stdout] | [INFO] [stdout] 54 | while pattern.len() > 0 { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!pattern.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: unneeded `return` statement [INFO] [stdout] --> src/day2.rs:28:17 [INFO] [stdout] | [INFO] [stdout] 28 | return false; [INFO] [stdout] | ^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 28 - return false; [INFO] [stdout] 28 + false [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/day2.rs:47:5 [INFO] [stdout] | [INFO] [stdout] 47 | return true; [INFO] [stdout] | ^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 47 - return true; [INFO] [stdout] 47 + true [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is only used to index `report` [INFO] [stdout] --> src/day2.rs:39:14 [INFO] [stdout] | [INFO] [stdout] 39 | for i in 1..=report.len() - 1 { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 39 - for i in 1..=report.len() - 1 { [INFO] [stdout] 39 + for in report.iter().take((report.len() - 1) + 1).skip(1) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: importing legacy numeric constants [INFO] [stdout] --> src/day20.rs:3:5 [INFO] [stdout] | [INFO] [stdout] 3 | 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] [INFO] [stdout] [INFO] [stdout] warning: called `map(..).flatten()` on `Iterator` [INFO] [stdout] --> src/day20.rs:20:10 [INFO] [stdout] | [INFO] [stdout] 20 | .map(|(y, l)| l.iter().enumerate().map(move |(x, c)| (x, y, c))) [INFO] [stdout] | __________^ [INFO] [stdout] 21 | | .flatten() [INFO] [stdout] | |__________________^ help: try replacing `map` with `flat_map` and remove the `.flatten()`: `flat_map(|(y, l)| l.iter().enumerate().map(move |(x, c)| (x, y, c)))` [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: called `map(..).flatten()` on `Iterator` [INFO] [stdout] --> src/day20.rs:28:10 [INFO] [stdout] | [INFO] [stdout] 28 | .map(|(y, l)| l.iter().enumerate().map(move |(x, c)| (x, y, c))) [INFO] [stdout] | __________^ [INFO] [stdout] 29 | | .flatten() [INFO] [stdout] | |__________________^ help: try replacing `map` with `flat_map` and remove the `.flatten()`: `flat_map(|(y, l)| l.iter().enumerate().map(move |(x, c)| (x, y, c)))` [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: casting the result of `i64::abs()` to usize [INFO] [stdout] --> src/day20.rs:77:55 [INFO] [stdout] | [INFO] [stdout] 77 | ... + v_off.abs() as usize [INFO] [stdout] | ^^^^^^^^^^^ help: replace with: `v_off.unsigned_abs()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_abs_to_unsigned [INFO] [stdout] = note: `#[warn(clippy::cast_abs_to_unsigned)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: casting the result of `i64::abs()` to usize [INFO] [stdout] --> src/day20.rs:78:55 [INFO] [stdout] | [INFO] [stdout] 78 | ... + h_off.abs() as usize [INFO] [stdout] | ^^^^^^^^^^^ help: replace with: `h_off.unsigned_abs()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_abs_to_unsigned [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/day20.rs:131:5 [INFO] [stdout] | [INFO] [stdout] 131 | return vec![]; [INFO] [stdout] | ^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 131 - return vec![]; [INFO] [stdout] 131 + vec![] [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do [INFO] [stdout] --> src/day20.rs:102:20 [INFO] [stdout] | [INFO] [stdout] 102 | fn find_path(grid: &Vec>, start_pos: (i64, i64), end_pos: (i64, i64)) -> Vec<(i64, i64)> { [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] 102 - fn find_path(grid: &Vec>, start_pos: (i64, i64), end_pos: (i64, i64)) -> Vec<(i64, i64)> { [INFO] [stdout] 102 + fn find_path(grid: &[Vec], start_pos: (i64, i64), end_pos: (i64, i64)) -> Vec<(i64, i64)> { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/day21.rs:58:42 [INFO] [stdout] | [INFO] [stdout] 58 | let target_pos = pos_by_char.get(&char).unwrap(); [INFO] [stdout] | ^^^^^ help: change this to: `char` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/day21.rs:99:5 [INFO] [stdout] | [INFO] [stdout] 99 | / return dirs [INFO] [stdout] 100 | | .into_iter() [INFO] [stdout] 101 | | .permutations(len) [INFO] [stdout] 102 | | .unique() [INFO] [stdout] ... | [INFO] [stdout] 119 | | .map(|p| p.into_iter().chain(['a']).collect()) [INFO] [stdout] 120 | | .collect(); [INFO] [stdout] | |__________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 99 ~ dirs [INFO] [stdout] 100 + .into_iter() [INFO] [stdout] 101 + .permutations(len) [INFO] [stdout] 102 + .unique() [INFO] [stdout] 103 + .filter(|d| { [INFO] [stdout] 104 + let mut pos = *curr_pos; [INFO] [stdout] 105 + for dc in d { [INFO] [stdout] 106 + match dc { [INFO] [stdout] 107 + '^' => pos.1 -= 1, [INFO] [stdout] 108 + 'v' => pos.1 += 1, [INFO] [stdout] 109 + '<' => pos.0 -= 1, [INFO] [stdout] 110 + '>' => pos.0 += 1, [INFO] [stdout] 111 + _ => unreachable!(), [INFO] [stdout] 112 + } [INFO] [stdout] 113 + if pos == invalid_space { [INFO] [stdout] 114 + return false; [INFO] [stdout] 115 + } [INFO] [stdout] 116 + } [INFO] [stdout] 117 + true [INFO] [stdout] 118 + }) [INFO] [stdout] 119 + .map(|p| p.into_iter().chain(['a']).collect()) [INFO] [stdout] 120 ~ .collect() [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: usage of `contains_key` followed by `insert` on a `HashMap` [INFO] [stdout] --> src/day22.rs:20:17 [INFO] [stdout] | [INFO] [stdout] 20 | / if !possible_sales.contains_key(&k) { [INFO] [stdout] 21 | | possible_sales.insert(k, price); [INFO] [stdout] 22 | | } [INFO] [stdout] | |_________________^ help: try: `possible_sales.entry(k).or_insert(price);` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_entry [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: usage of `contains_key` followed by `insert` on a `HashMap` [INFO] [stdout] --> src/day22.rs:27:13 [INFO] [stdout] | [INFO] [stdout] 27 | / if !overall_sales.contains_key(&k) { [INFO] [stdout] 28 | | overall_sales.insert(k, v); [INFO] [stdout] 29 | | } else { [INFO] [stdout] 30 | | *overall_sales.get_mut(&k).unwrap() += v; [INFO] [stdout] 31 | | } [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] help: try [INFO] [stdout] | [INFO] [stdout] 27 ~ if let std::collections::hash_map::Entry::Vacant(e) = overall_sales.entry(k) { [INFO] [stdout] 28 + e.insert(v); [INFO] [stdout] 29 + } else { [INFO] [stdout] 30 + *overall_sales.get_mut(&k).unwrap() += v; [INFO] [stdout] 31 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: iterating on a map's keys [INFO] [stdout] --> src/day23.rs:48:13 [INFO] [stdout] | [INFO] [stdout] 48 | connections.iter().map(|(k, _)| *k).collect(), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `connections.keys().map(|k| *k)` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#iter_kv_map [INFO] [stdout] = note: `#[warn(clippy::iter_kv_map)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you are using an explicit closure for copying elements [INFO] [stdout] --> src/day23.rs:79:17 [INFO] [stdout] | [INFO] [stdout] 79 | r.union(&HashSet::from_iter([*v])).map(|n| *n).collect(), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `copied` method: `r.union(&HashSet::from_iter([*v])).copied()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_clone [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you are using an explicit closure for copying elements [INFO] [stdout] --> src/day23.rs:80:17 [INFO] [stdout] | [INFO] [stdout] 80 | p.intersection(n).map(|n| *n).collect(), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `copied` method: `p.intersection(n).copied()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_clone [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you are using an explicit closure for copying elements [INFO] [stdout] --> src/day23.rs:81:17 [INFO] [stdout] | [INFO] [stdout] 81 | x.intersection(n).map(|n| *n).collect(), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `copied` method: `x.intersection(n).copied()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_clone [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: called `.nth(0)` on a `std::iter::Iterator`, when `.next()` is equivalent [INFO] [stdout] --> src/day24.rs:11:14 [INFO] [stdout] | [INFO] [stdout] 11 | (a.split(':').nth(0).unwrap(), b.parse::().unwrap() == 1) [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^ help: try calling `.next()` instead of `.nth(0)`: `a.split(':').next()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#iter_nth_zero [INFO] [stdout] = note: `#[warn(clippy::iter_nth_zero)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: called `map(..).flatten()` on `Iterator` [INFO] [stdout] --> src/day24.rs:24:10 [INFO] [stdout] | [INFO] [stdout] 24 | .map(|g| g.0.iter().map(|s|*s).chain([g.2])) [INFO] [stdout] | __________^ [INFO] [stdout] 25 | | .flatten() [INFO] [stdout] | |__________________^ help: try replacing `map` with `flat_map` and remove the `.flatten()`: `flat_map(|g| g.0.iter().map(|s|*s).chain([g.2]))` [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: you are using an explicit closure for copying elements [INFO] [stdout] --> src/day24.rs:24:18 [INFO] [stdout] | [INFO] [stdout] 24 | .map(|g| g.0.iter().map(|s|*s).chain([g.2])) [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `copied` method: `g.0.iter().copied()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_clone [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: iterating on a map's keys [INFO] [stdout] --> src/day24.rs:26:16 [INFO] [stdout] | [INFO] [stdout] 26 | .chain(inits.iter().map(|(w, _)| *w)) [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `inits.keys().map(|w| *w)` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#iter_kv_map [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is used to index `zn` [INFO] [stdout] --> src/day24.rs:64:22 [INFO] [stdout] | [INFO] [stdout] 64 | for i in 1..=44 { [INFO] [stdout] | ^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator and enumerate() [INFO] [stdout] | [INFO] [stdout] 64 - for i in 1..=44 { [INFO] [stdout] 64 + for (i, ) in zn.iter().enumerate().take(44 + 1).skip(1) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: called `.nth(0)` on a `std::iter::Iterator`, when `.next()` is equivalent [INFO] [stdout] --> src/day25.rs:20:12 [INFO] [stdout] | [INFO] [stdout] 20 | if diagram.chars().nth(0).unwrap() == '#' { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^ help: try calling `.next()` instead of `.nth(0)`: `diagram.chars().next()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#iter_nth_zero [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `.fold` can be written more succinctly using another method [INFO] [stdout] --> src/day3.rs:19:18 [INFO] [stdout] | [INFO] [stdout] 19 | .fold(1, |acc, n| acc * n); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `product::()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_fold [INFO] [stdout] = note: `#[warn(clippy::unnecessary_fold)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this boolean expression can be simplified [INFO] [stdout] --> src/day4.rs:28:32 [INFO] [stdout] | [INFO] [stdout] 28 | ... if !grid [INFO] [stdout] | __________________________^ [INFO] [stdout] 29 | | ... .get(py as usize) [INFO] [stdout] 30 | | ... .and_then(|r| r.get(px as usize)) [INFO] [stdout] 31 | | ... .is_some_and(|l| *l == letter) [INFO] [stdout] | |________________________________________________________^ [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] help: try [INFO] [stdout] | [INFO] [stdout] 28 ~ if grid [INFO] [stdout] 29 + .get(py as usize) [INFO] [stdout] 30 + .and_then(|r| r.get(px as usize)).is_none_or(|l| *l != letter) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: usage of `contains_key` followed by `insert` on a `HashMap` [INFO] [stdout] --> src/day5.rs:23:9 [INFO] [stdout] | [INFO] [stdout] 23 | / if !reqs_dict.contains_key(&second) { [INFO] [stdout] 24 | | reqs_dict.insert(second, vec![]); [INFO] [stdout] 25 | | } [INFO] [stdout] | |_________^ help: try: `reqs_dict.entry(second).or_insert_with(|| vec![]);` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_entry [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/day5.rs:76:5 [INFO] [stdout] | [INFO] [stdout] 76 | return valid; [INFO] [stdout] | ^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 76 - return valid; [INFO] [stdout] 76 + valid [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/day5.rs:66:52 [INFO] [stdout] | [INFO] [stdout] 66 | fn is_valid(reqs: &HashMap>, update: &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] 66 - fn is_valid(reqs: &HashMap>, update: &Vec) -> bool { [INFO] [stdout] 66 + fn is_valid(reqs: &HashMap>, update: &[i64]) -> bool { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/day5.rs:70:32 [INFO] [stdout] | [INFO] [stdout] 70 | if disallowed.contains(&page) { [INFO] [stdout] | ^^^^^ help: change this to: `page` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/day5.rs:74:36 [INFO] [stdout] | [INFO] [stdout] 74 | disallowed.extend(reqs.get(&page).unwrap_or(&vec![])); [INFO] [stdout] | ^^^^^ help: change this to: `page` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: very complex type used. Consider factoring parts into `type` definitions [INFO] [stdout] --> src/day6.rs:56:6 [INFO] [stdout] | [INFO] [stdout] 56 | ) -> Option>> { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_complexity [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/day6.rs:98:5 [INFO] [stdout] | [INFO] [stdout] 98 | return Some(visited); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 98 - return Some(visited); [INFO] [stdout] 98 + Some(visited) [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/day6.rs:54:11 [INFO] [stdout] | [INFO] [stdout] 54 | grid: &Vec>, [INFO] [stdout] | ^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg [INFO] [stdout] help: change this to [INFO] [stdout] | [INFO] [stdout] 54 - grid: &Vec>, [INFO] [stdout] 54 + grid: &[Vec], [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `(i64, i64, i64, i64)` which implements the `Copy` trait [INFO] [stdout] --> src/day6.rs:57:21 [INFO] [stdout] | [INFO] [stdout] 57 | let mut guard = curr_guard.clone(); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `curr_guard` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] = note: `#[warn(clippy::clone_on_copy)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: usage of `contains_key` followed by `insert` on a `HashMap` [INFO] [stdout] --> src/day6.rs:79:17 [INFO] [stdout] | [INFO] [stdout] 79 | / if !visited.contains_key(&(guard.0, guard.1)) { [INFO] [stdout] 80 | | visited.insert((guard.0, guard.1), HashSet::new()); [INFO] [stdout] 81 | | } [INFO] [stdout] | |_________________^ help: try: `visited.entry((guard.0, guard.1)).or_insert_with(|| HashSet::new());` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_entry [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/day8.rs:6:81 [INFO] [stdout] | [INFO] [stdout] 6 | HashSet::from_iter(input.chars().filter(|c| !['\n', '\r', '.'].contains(&c))); [INFO] [stdout] | ^^ help: change this to: `c` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `idx` is only used to index `ret` [INFO] [stdout] --> src/helpers.rs:4:16 [INFO] [stdout] | [INFO] [stdout] 4 | for idx in 0..N { [INFO] [stdout] | ^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 4 - for idx in 0..N { [INFO] [stdout] 4 + for in ret.iter_mut().take(N) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stderr] Finished `dev` profile [unoptimized + debuginfo] target(s) in 6.24s [INFO] running `Command { std: "docker" "inspect" "f21cffe8724c37475ac395ebec638d6e4ee8f04ea3ebb208039dc7b14f3a2e77", kill_on_drop: false }` [INFO] running `Command { std: "docker" "rm" "-f" "f21cffe8724c37475ac395ebec638d6e4ee8f04ea3ebb208039dc7b14f3a2e77", kill_on_drop: false }` [INFO] [stdout] f21cffe8724c37475ac395ebec638d6e4ee8f04ea3ebb208039dc7b14f3a2e77