[INFO] cloning repository https://github.com/cy6581/aoc_2024_rs [INFO] running `Command { std: "git" "-c" "credential.helper=" "-c" "credential.helper=/workspace/cargo-home/bin/git-credential-null" "clone" "--bare" "https://github.com/cy6581/aoc_2024_rs" "/workspace/cache/git-repos/https%3A%2F%2Fgithub.com%2Fcy6581%2Faoc_2024_rs", kill_on_drop: false }` [INFO] [stderr] Cloning into bare repository '/workspace/cache/git-repos/https%3A%2F%2Fgithub.com%2Fcy6581%2Faoc_2024_rs'... [INFO] running `Command { std: "git" "rev-parse" "HEAD", kill_on_drop: false }` [INFO] [stdout] 4b861f4097866fca12c5c35382260ae1e188660e [INFO] linting cy6581/aoc_2024_rs against nightly for clippy-nonminimal_bool-denied [INFO] running `Command { std: "git" "clone" "/workspace/cache/git-repos/https%3A%2F%2Fgithub.com%2Fcy6581%2Faoc_2024_rs" "/workspace/builds/worker-7-tc1/source", kill_on_drop: false }` [INFO] [stderr] Cloning into '/workspace/builds/worker-7-tc1/source'... [INFO] [stderr] done. [INFO] started tweaking git repo https://github.com/cy6581/aoc_2024_rs [INFO] finished tweaking git repo https://github.com/cy6581/aoc_2024_rs [INFO] tweaked toml for git repo https://github.com/cy6581/aoc_2024_rs written to /workspace/builds/worker-7-tc1/source/Cargo.toml [INFO] validating manifest of git repo https://github.com/cy6581/aoc_2024_rs 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/cy6581/aoc_2024_rs already has a lockfile, it will not be regenerated [INFO] running `Command { std: CARGO_HOME="/workspace/cargo-home" RUSTUP_HOME="/workspace/rustup-home" "/workspace/cargo-home/bin/cargo" "+nightly" "fetch" "--manifest-path" "Cargo.toml", kill_on_drop: false }` [INFO] running `Command { std: "docker" "create" "-v" "/var/lib/crater-agent-workspace/builds/worker-7-tc1/target:/opt/rustwide/target:rw,Z" "-v" "/var/lib/crater-agent-workspace/builds/worker-7-tc1/source:/opt/rustwide/workdir:ro,Z" "-v" "/var/lib/crater-agent-workspace/cargo-home:/opt/rustwide/cargo-home:ro,Z" "-v" "/var/lib/crater-agent-workspace/rustup-home:/opt/rustwide/rustup-home:ro,Z" "-e" "SOURCE_DIR=/opt/rustwide/workdir" "-e" "CARGO_TARGET_DIR=/opt/rustwide/target" "-e" "CARGO_HOME=/opt/rustwide/cargo-home" "-e" "RUSTUP_HOME=/opt/rustwide/rustup-home" "-w" "/opt/rustwide/workdir" "-m" "1610612736" "--user" "0:0" "--network" "none" "ghcr.io/rust-lang/crates-build-env/linux@sha256:d429b63d4308055ea97f60fb1d3dfca48854a00942f1bd2ad806beaf015945ec" "/opt/rustwide/cargo-home/bin/cargo" "+nightly" "metadata" "--no-deps" "--format-version=1", kill_on_drop: false }` [INFO] [stdout] 487b7fefcd06c4bbeac0f78069309a2cfe2635ef5a01d5dfacd1a62fdc228b66 [INFO] running `Command { std: "docker" "start" "-a" "487b7fefcd06c4bbeac0f78069309a2cfe2635ef5a01d5dfacd1a62fdc228b66", kill_on_drop: false }` [INFO] running `Command { std: "docker" "inspect" "487b7fefcd06c4bbeac0f78069309a2cfe2635ef5a01d5dfacd1a62fdc228b66", kill_on_drop: false }` [INFO] running `Command { std: "docker" "rm" "-f" "487b7fefcd06c4bbeac0f78069309a2cfe2635ef5a01d5dfacd1a62fdc228b66", kill_on_drop: false }` [INFO] [stdout] 487b7fefcd06c4bbeac0f78069309a2cfe2635ef5a01d5dfacd1a62fdc228b66 [INFO] running `Command { std: "docker" "create" "-v" "/var/lib/crater-agent-workspace/builds/worker-7-tc1/target:/opt/rustwide/target:rw,Z" "-v" "/var/lib/crater-agent-workspace/builds/worker-7-tc1/source:/opt/rustwide/workdir:ro,Z" "-v" "/var/lib/crater-agent-workspace/cargo-home:/opt/rustwide/cargo-home:ro,Z" "-v" "/var/lib/crater-agent-workspace/rustup-home:/opt/rustwide/rustup-home:ro,Z" "-e" "SOURCE_DIR=/opt/rustwide/workdir" "-e" "CARGO_TARGET_DIR=/opt/rustwide/target" "-e" "CARGO_INCREMENTAL=0" "-e" "RUST_BACKTRACE=full" "-e" "RUSTFLAGS=--cap-lints=forbid" "-e" "RUSTDOCFLAGS=--cap-lints=forbid" "-e" "CARGO_HOME=/opt/rustwide/cargo-home" "-e" "RUSTUP_HOME=/opt/rustwide/rustup-home" "-w" "/opt/rustwide/workdir" "-m" "1610612736" "--user" "0:0" "--network" "none" "ghcr.io/rust-lang/crates-build-env/linux@sha256:d429b63d4308055ea97f60fb1d3dfca48854a00942f1bd2ad806beaf015945ec" "/opt/rustwide/cargo-home/bin/cargo" "+nightly" "clippy" "--frozen" "--all" "--all-targets" "--message-format=json", kill_on_drop: false }` [INFO] [stdout] f7432f10d0ad7e8306320e9ec456b8eb24f1bae7566f697bff36d1f9ac0aa86f [INFO] running `Command { std: "docker" "start" "-a" "f7432f10d0ad7e8306320e9ec456b8eb24f1bae7566f697bff36d1f9ac0aa86f", kill_on_drop: false }` [INFO] [stderr] Checking regex-syntax v0.8.5 [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: constants have by default a `'static` lifetime [INFO] [stdout] --> src/bin/day_01.rs:68:19 [INFO] [stdout] | [INFO] [stdout] 68 | const INPUT: &'static str = include_str!("../input/day_01.txt"); [INFO] [stdout] | -^^^^^^^---- help: consider removing `'static`: `&str` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_static_lifetimes [INFO] [stdout] = note: `#[warn(clippy::redundant_static_lifetimes)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_01.rs:14:5 [INFO] [stdout] | [INFO] [stdout] 14 | /// I decided while solving the challenge that this would be my preferred logical flow and stuck to [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] = note: `#[warn(clippy::doc_lazy_continuation)]` on by default [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 14 | /// I decided while solving the challenge that this would be my preferred logical flow and stuck to [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_01.rs:15:5 [INFO] [stdout] | [INFO] [stdout] 15 | /// it. It will be my default pattern until I understand the merits of the other way. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 15 | /// it. It will be my default pattern until I understand the merits of the other way. [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_01.rs:16:5 [INFO] [stdout] | [INFO] [stdout] 16 | /// TODO examine the pros/cons of why Rust Entry API prescribes the first way. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 16 | /// TODO examine the pros/cons of why Rust Entry API prescribes the first way. [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: constants have by default a `'static` lifetime [INFO] [stdout] --> src/bin/day_01.rs:68:19 [INFO] [stdout] | [INFO] [stdout] 68 | const INPUT: &'static str = include_str!("../input/day_01.txt"); [INFO] [stdout] | -^^^^^^^---- help: consider removing `'static`: `&str` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_static_lifetimes [INFO] [stdout] = note: `#[warn(clippy::redundant_static_lifetimes)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: empty line after doc comment [INFO] [stdout] --> src/bin/day_04.rs:4:1 [INFO] [stdout] | [INFO] [stdout] 4 | / /// crossword word finder. [INFO] [stdout] 5 | | [INFO] [stdout] | |_^ [INFO] [stdout] 6 | fn parse_input(input: &str) -> Vec> { [INFO] [stdout] | -------------- the comment documents this function [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#empty_line_after_doc_comments [INFO] [stdout] = note: `#[warn(clippy::empty_line_after_doc_comments)]` on by default [INFO] [stdout] = help: if the empty line is unintentional, remove it [INFO] [stdout] help: if the comment should document the crate use an inner doc comment [INFO] [stdout] | [INFO] [stdout] 1 ~ //! Commentary [INFO] [stdout] 2 ~ //! [INFO] [stdout] 3 ~ //! This became an excuse for me to practice my DFS. With the result being an over-engineered [INFO] [stdout] 4 ~ //! crossword word finder. [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: constants have by default a `'static` lifetime [INFO] [stdout] --> src/bin/day_04.rs:93:19 [INFO] [stdout] | [INFO] [stdout] 93 | const INPUT: &'static str = include_str!("../input/day_04.txt"); [INFO] [stdout] | -^^^^^^^---- help: consider removing `'static`: `&str` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_static_lifetimes [INFO] [stdout] = note: `#[warn(clippy::redundant_static_lifetimes)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: empty line after doc comment [INFO] [stdout] --> src/bin/day_09.rs:114:1 [INFO] [stdout] | [INFO] [stdout] 114 | / /// much simpler the code is. [INFO] [stdout] 115 | | [INFO] [stdout] | |_^ [INFO] [stdout] 116 | fn parse_input(input: &str) -> Vec> { [INFO] [stdout] | -------------- the comment documents this function [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#empty_line_after_doc_comments [INFO] [stdout] = note: `#[warn(clippy::empty_line_after_doc_comments)]` on by default [INFO] [stdout] = help: if the empty line is unintentional, remove it [INFO] [stdout] help: if the comment should document the crate use an inner doc comment [INFO] [stdout] | [INFO] [stdout] 3 ~ //! # Commentary [INFO] [stdout] 4 ~ //! [INFO] [stdout] 5 ~ //! My first thought was to build a vector representing the blocks, including the empty space. Then, [INFO] [stdout] 6 ~ //! I would use the two pointer technique and process the blocks from front and back, swapping items [INFO] [stdout] 7 ~ //! as needed. The tradeoff is that it is space inefficient, as every "empty" slot would occupy [INFO] [stdout] 8 ~ //! memory that would eventually be redundant. To optimize this, I thought of: [INFO] [stdout] 9 ~ //! 1) maintaining counters to know which items have been processed instead of adding empty slots. [INFO] [stdout] 10 ~ //! (I.e. instead of the data structure representing empty slots for you, you use an abstraction to [INFO] [stdout] 11 ~ //! track it numerically and only append items with ID to the vector). This would be a lot more [INFO] [stdout] 12 ~ //! tedious though, as need variables to compare each block of empty space in the front, to each [INFO] [stdout] 13 ~ //! block of numbers in the back, trying to fit them, calculating the difference where there is a [INFO] [stdout] 14 ~ //! mismatch, and saving the difference for the subsequent set of blocks to be processed. I decided [INFO] [stdout] 15 ~ //! against this eventually. [INFO] [stdout] 16 ~ //! 2) using a different data structure, which would allow me to save memory on empty slots. It [INFO] [stdout] 17 ~ //! crossed my mind to use a doubly-linked list, with certain nodes representing free space as a [INFO] [stdout] 18 ~ //! variable in its data. It would also be faster to build than a vector, since I coulld append any [INFO] [stdout] 19 ~ //! number of elements to the back without triggering memory reallocation (which would be a problem [INFO] [stdout] 20 ~ //! in this case given that I cannot pre-allocate the vector size without knowing concretely the [INFO] [stdout] 21 ~ //! number of items). However, after reading up on the LinkedList that comes with Rust, I was [INFO] [stdout] 22 ~ //! disappointed to find that it not allow me to append or remove nodes easily from the middle of [INFO] [stdout] 23 ~ //! the list, which was exactly what I wanted. Also, there doesn't seem to be a way to iterate from [INFO] [stdout] 24 ~ //! the back of the list? Which means I cannot implement the two-pointer technique. [INFO] [stdout] 25 ~ //! Finally, it seemed like I was back to the initial "naive" solution. [INFO] [stdout] 26 ~ //! [INFO] [stdout] 27 ~ //! # Things I tried and learnt [INFO] [stdout] 28 ~ //! - How to read a single line of text. I was using lines().take(1) in conjunction with .flat_map() [INFO] [stdout] 29 ~ //! to flatten an iterator of lines, with only 1 line, into a single unit and apply .map() to [INFO] [stdout] 30 ~ //! extract the chars from the unit. If this sounds like a mouthful, it truly is, because, to my [INFO] [stdout] 31 ~ //! horror, I realised how silly of me not to directly call .chars() method on the original &str. [INFO] [stdout] 32 ~ //! Urgh! [INFO] [stdout] 33 ~ //! [INFO] [stdout] 34 ~ //! - Iterator operators. In addition to over-engineering the lines() iterator as mentioned, I also [INFO] [stdout] 35 ~ //! experimented with various iterators to compute the checksum. I debated between using .filter(), [INFO] [stdout] 36 ~ //! or its nicer cousin .filter_map() which will automatically unwrap the Option that I have. [INFO] [stdout] 37 ~ //! The downside to both of them though is that they will iterate through the entire Vec, even [INFO] [stdout] 38 ~ //! though we know that after some point all which remain are None (empty slots). So in this case, [INFO] [stdout] 39 ~ //! .take_while() is more efficient because it stops at the first None, ignoring the rest. [INFO] [stdout] 40 ~ //! [INFO] [stdout] 41 ~ //! - Drawbacks of using 'continue' statements in a single loop - part 1. Typically, I'm used to test [INFO] [stdout] 42 ~ //! for a single predicate and 'continue' the loop otherwise, like so: [INFO] [stdout] 43 ~ //! ``` [INFO] [stdout] 44 ~ //! // within the loop [INFO] [stdout] 45 ~ //! if file_blocks[front].is_some() { [INFO] [stdout] 46 ~ //! front += 1; [INFO] [stdout] 47 ~ //! continue; [INFO] [stdout] 48 ~ //! } [INFO] [stdout] 49 ~ //! if file_blocks[back].is_none() { [INFO] [stdout] 50 ~ //! back -= 1; [INFO] [stdout] 51 ~ //! continue; [INFO] [stdout] 52 ~ //! } [INFO] [stdout] 53 ~ //! ``` [INFO] [stdout] 54 ~ //! Thinking about it, however, while this looks more aesthetically pleasing, it is less rigorous [INFO] [stdout] 55 ~ //! when formulating the logic, because there is an implied 'else' clause that isn't explicitly [INFO] [stdout] 56 ~ //! spelt-out, and may lead to missing conditions. Not in this situation. But perhaps in more [INFO] [stdout] 57 ~ //! complicated ones. Worse still, if you forget the `continue` statement, you are just setting [INFO] [stdout] 58 ~ //! yourself up for nasty bugs. So in this day's challenge, I wrote it using an `else-if` statement [INFO] [stdout] 59 ~ //! which makes it 100% clear that these conditions are indeed mutually exclusive and exhaustive. [INFO] [stdout] 60 ~ //! There is no need for the `continue` statement either. Also, it's not as nested as I originally [INFO] [stdout] 61 ~ //! visualised (merely an `else-if` and `else`) so perhaps this style might be growing on me. [INFO] [stdout] 62 ~ //! [INFO] [stdout] 63 ~ //! - Drawbacks of using 'continue' statements - part 2. Part 2 was an even bigger problem in [INFO] [stdout] 64 ~ //! trying to use the style of a single-loop, and the 'continue' statement. For one, it became [INFO] [stdout] 65 ~ //! unavoidable to use a nested-while loop, when we are dealing with multiple pointers (front and [INFO] [stdout] 66 ~ //! back) to represent a block. Let's call the parent left/right pointers 'boundary pointers', they [INFO] [stdout] 67 ~ //! represent the boundary of the processed and unprocessed blocks. However, in part 2, each pointer [INFO] [stdout] 68 ~ //! actually represents a pair of sub-pointers (front and back), that represent the length of a [INFO] [stdout] 69 ~ //! block. The sub-pointers need to be repeatedly incremented or decremented independent of the [INFO] [stdout] 70 ~ //! main pointer, so you have no choice but to write an inner while loop like so. [INFO] [stdout] 71 ~ //! [INFO] [stdout] 72 ~ //! ``` [INFO] [stdout] 73 ~ //! let (mut file_back, mut file_front) = (right, right); [INFO] [stdout] 74 ~ //! while file_front > 0 && blocks[file_front] == blocks[file_front - 1] { [INFO] [stdout] 75 ~ //! file_front -= 1; [INFO] [stdout] 76 ~ //! } [INFO] [stdout] 77 ~ //! ``` [INFO] [stdout] 78 ~ //! Working with sub-pointers becomes even more tricky because you need to ensure that: [INFO] [stdout] 79 ~ //! - Neither of the pointers goes out of bounds (in the main loop, you only check the bounds of [INFO] [stdout] 80 ~ //! parent left and right pointers). [INFO] [stdout] 81 ~ //! - The parent pointers need to be advanced BEYOND the sub-pointers when you are done with a [INFO] [stdout] 82 ~ //! block. Concretely, this means setting it to something like `file_front + 1` while of course [INFO] [stdout] 83 ~ //! checking that it stays within bounds. [INFO] [stdout] 84 ~ //! There must be a better way, and hence my next learning point: [INFO] [stdout] 85 ~ //! [INFO] [stdout] 86 ~ //! - It is MUCH MUCH easier to represent a block using a starting ponter and length. I briefly [INFO] [stdout] 87 ~ //! alluded to this fact when saying that the sub-pointers (front and back) are needed to represent [INFO] [stdout] 88 ~ //! the LENGTH of the block. After referencing the solution of a friend, I realised that I had [INFO] [stdout] 89 ~ //! chosen a cumbersome abstraction. In fact, Rust has already solved this problem and given us a [INFO] [stdout] 90 ~ //! best practice in the form of slices, which are stored under the hood as a starting pointer and [INFO] [stdout] 91 ~ //! a length. This makes it so much easier to: [INFO] [stdout] 92 ~ //! - Compare the length, you literally compare two values, [INFO] [stdout] 93 ~ //! - Iterate over blocks, you literally iterate over starting pointers [INFO] [stdout] 94 ~ //! - Prevent out of bounds, since you never increment pointers that could potentially go out of [INFO] [stdout] 95 ~ //! bounds, you only iterate until the last pointer (which you don't even to do manually). [INFO] [stdout] 96 ~ //! Then I also started to see why I potentially ran into problems using 'while' loops to increment [INFO] [stdout] 97 ~ //! indices as per certain conditions. And this part from the Rust book finally made a lot more sense: [INFO] [stdout] 98 ~ //! [INFO] [stdout] 99 ~ //! "For example, if you changed the definition of the a array to have four elements but forgot to [INFO] [stdout] 100 ~ //! update the condition to while index < 4, the code would panic. It’s also slow, because the [INFO] [stdout] 101 ~ //! compiler adds runtime code to perform the conditional check of whether the index is within the [INFO] [stdout] 102 ~ //! bounds of the array on every iteration through the loop. ... [INFO] [stdout] 103 ~ //! Using the for loop, you wouldn’t need to remember to change any other code if you changed the [INFO] [stdout] 104 ~ //! number of values in the array, as you would with the method used in Listing 3-4. ... [INFO] [stdout] 105 ~ //! The safety and conciseness of for loops make them the most commonly used loop construct in Rust. [INFO] [stdout] 106 ~ //! Even in situations in which you want to run some code a certain number of times, as in the [INFO] [stdout] 107 ~ //! countdown example that used a while loop in Listing 3-3, most Rustaceans would use a for loop." [INFO] [stdout] 108 ~ //! https://doc.rust-lang.org/stable/book/ch03-05-control-flow.html [INFO] [stdout] 109 ~ //! [INFO] [stdout] 110 ~ //! At this risk of sounding cliched, I must say this is quite a paradigm shift. Instead relying too [INFO] [stdout] 111 ~ //! much on the two-pointer technique (which can be easily abused into four-pointers), we should be [INFO] [stdout] 112 ~ //! thinking in terms of iterators, which are less error-prone. [INFO] [stdout] 113 ~ //! To practice this, I solved Part Two once more using this new representation, and you can see how [INFO] [stdout] 114 ~ //! much simpler the code is. [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: empty line after doc comment [INFO] [stdout] --> src/bin/day_02.rs:24:1 [INFO] [stdout] | [INFO] [stdout] 24 | / /// worrying about going out of bounds etc. [INFO] [stdout] 25 | | [INFO] [stdout] | |_^ [INFO] [stdout] 26 | fn parse_input(input: &'static str) -> Vec> { [INFO] [stdout] | -------------- the comment documents this function [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#empty_line_after_doc_comments [INFO] [stdout] = note: `#[warn(clippy::empty_line_after_doc_comments)]` on by default [INFO] [stdout] = help: if the empty line is unintentional, remove it [INFO] [stdout] help: if the comment should document the crate use an inner doc comment [INFO] [stdout] | [INFO] [stdout] 1 ~ //! # Commentary [INFO] [stdout] 2 ~ //! [INFO] [stdout] 3 ~ //! Part One was fairly straightforward, but I got into trouble trying to refactor my fn for use in [INFO] [stdout] 4 ~ //! part Two. Part One was basically a sliding window (size 2) over all elements, to see if any [INFO] [stdout] 5 ~ //! window violated the rules. It could be easily solved using constructs like .any() or .all(), [INFO] [stdout] 6 ~ //! which I initially wrote. However, I got carried away in Part Two which called for a tolerance [INFO] [stdout] 7 ~ //! of one element being in violation of the rules. I tried to reason that this meant having 1 [INFO] [stdout] 8 ~ //! window being in violation, tested some inputs, but failed to realise an important edge case: [INFO] [stdout] 9 ~ //! there could be an input with 1 invalid window, that would still *remain unsafe* even after the [INFO] [stdout] 10 ~ //! removal of 1 element. As an example: [INFO] [stdout] 11 ~ //! [1, 2, 9, 10, 11, 12] -> even though the [2, 9] window is invalid, removing 9 still would not [INFO] [stdout] 12 ~ //! help as it would merely leave another [2, 10] invalid window. [INFO] [stdout] 13 ~ //! [INFO] [stdout] 14 ~ //! I was forced to abandon the "tolerance" approach and revert to the most straightforward idea [INFO] [stdout] 15 ~ //! of testing every sub-array with one element removed. You can see the mess I left, and still [INFO] [stdout] 16 ~ //! leave for posterity's sake, in the `is_safe_with_tolerance` fn. [INFO] [stdout] 17 ~ //! [INFO] [stdout] 18 ~ //! # Things I tried and learnt [INFO] [stdout] 19 ~ //! - Using the XOR operator to combine 2 mutually exclusive flags, which may help to ferret out [INFO] [stdout] 20 ~ //! strange bugs if the flags are not correctly set, as opposed to using the OR operator. [INFO] [stdout] 21 ~ //! [INFO] [stdout] 22 ~ //! - Using the .windows() method on the Slice type. Which will work for anything "slice-able", [INFO] [stdout] 23 ~ //! like arrays and Vecs. It makes it much much easier to generate all possible windows, without [INFO] [stdout] 24 ~ //! worrying about going out of bounds etc. [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: constants have by default a `'static` lifetime [INFO] [stdout] --> src/bin/day_02.rs:86:19 [INFO] [stdout] | [INFO] [stdout] 86 | const INPUT: &'static str = include_str!("../input/day_02.txt"); [INFO] [stdout] | -^^^^^^^---- help: consider removing `'static`: `&str` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_static_lifetimes [INFO] [stdout] = note: `#[warn(clippy::redundant_static_lifetimes)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: constants have by default a `'static` lifetime [INFO] [stdout] --> src/bin/day_09.rs:282:19 [INFO] [stdout] | [INFO] [stdout] 282 | const INPUT: &'static str = include_str!("../input/day_09.txt"); [INFO] [stdout] | -^^^^^^^---- help: consider removing `'static`: `&str` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_static_lifetimes [INFO] [stdout] = note: `#[warn(clippy::redundant_static_lifetimes)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: constants have by default a `'static` lifetime [INFO] [stdout] --> src/bin/day_03.rs:81:19 [INFO] [stdout] | [INFO] [stdout] 81 | const INPUT: &'static str = include_str!("../input/day_03.txt"); [INFO] [stdout] | -^^^^^^^---- help: consider removing `'static`: `&str` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_static_lifetimes [INFO] [stdout] = note: `#[warn(clippy::redundant_static_lifetimes)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: empty line after doc comment [INFO] [stdout] --> src/bin/day_06.rs:8:1 [INFO] [stdout] | [INFO] [stdout] 8 | / /// forced to take a ref to the grid and use dreaded lifetimes. [INFO] [stdout] 9 | | [INFO] [stdout] | |_^ [INFO] [stdout] 10 | fn parse_input(input: &str) -> Vec> { [INFO] [stdout] | -------------- the comment documents this function [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#empty_line_after_doc_comments [INFO] [stdout] = note: `#[warn(clippy::empty_line_after_doc_comments)]` on by default [INFO] [stdout] = help: if the empty line is unintentional, remove it [INFO] [stdout] help: if the comment should document the crate use an inner doc comment [INFO] [stdout] | [INFO] [stdout] 1 ~ //! Commentary [INFO] [stdout] 2 ~ //! [INFO] [stdout] 3 ~ //! Having seen so many Grid problems, I was frustrated at writing the same code over and over [INFO] [stdout] 4 ~ //! again and decided to create a reusable GridExplorer, and finally get some practice with [INFO] [stdout] 5 ~ //! writing structs. [INFO] [stdout] 6 ~ //! [INFO] [stdout] 7 ~ //! As part of an optimization to use the same grid in memory in every brute-force search, I was [INFO] [stdout] 8 ~ //! forced to take a ref to the grid and use dreaded lifetimes. [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: constants have by default a `'static` lifetime [INFO] [stdout] --> src/bin/day_08.rs:257:19 [INFO] [stdout] | [INFO] [stdout] 257 | const INPUT: &'static str = include_str!("../input/day_08.txt"); [INFO] [stdout] | -^^^^^^^---- help: consider removing `'static`: `&str` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_static_lifetimes [INFO] [stdout] = note: `#[warn(clippy::redundant_static_lifetimes)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_01.rs:14:5 [INFO] [stdout] | [INFO] [stdout] 14 | /// I decided while solving the challenge that this would be my preferred logical flow and stuck to [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] = note: `#[warn(clippy::doc_lazy_continuation)]` on by default [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 14 | /// I decided while solving the challenge that this would be my preferred logical flow and stuck to [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_01.rs:15:5 [INFO] [stdout] | [INFO] [stdout] 15 | /// it. It will be my default pattern until I understand the merits of the other way. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 15 | /// it. It will be my default pattern until I understand the merits of the other way. [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_01.rs:16:5 [INFO] [stdout] | [INFO] [stdout] 16 | /// TODO examine the pros/cons of why Rust Entry API prescribes the first way. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 16 | /// TODO examine the pros/cons of why Rust Entry API prescribes the first way. [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: constants have by default a `'static` lifetime [INFO] [stdout] --> src/bin/day_06.rs:203:19 [INFO] [stdout] | [INFO] [stdout] 203 | const INPUT: &'static str = include_str!("../input/day_06.txt"); [INFO] [stdout] | -^^^^^^^---- help: consider removing `'static`: `&str` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_static_lifetimes [INFO] [stdout] = note: `#[warn(clippy::redundant_static_lifetimes)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_03.rs:9:5 [INFO] [stdout] | [INFO] [stdout] 9 | /// some circles (e.g. Perl), I believe this is called Regex Extended Mode. Also, this mode ignores [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] = note: `#[warn(clippy::doc_lazy_continuation)]` on by default [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 9 | /// some circles (e.g. Perl), I believe this is called Regex Extended Mode. Also, this mode ignores [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_03.rs:10:5 [INFO] [stdout] | [INFO] [stdout] 10 | /// inline comments to explain what you are trying to do. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 10 | /// inline comments to explain what you are trying to do. [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_03.rs:13:5 [INFO] [stdout] | [INFO] [stdout] 13 | /// limits. TODO: read up on the algorithm. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 13 | /// limits. TODO: read up on the algorithm. [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_03.rs:16:5 [INFO] [stdout] | [INFO] [stdout] 16 | /// using a for-loop, but the .fold() here to selectively toggle flags while trying to accumulate [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 16 | /// using a for-loop, but the .fold() here to selectively toggle flags while trying to accumulate [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_03.rs:17:5 [INFO] [stdout] | [INFO] [stdout] 17 | /// the result just looks unelegant. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 17 | /// the result just looks unelegant. [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/bin/day_03.rs:83:42 [INFO] [stdout] | [INFO] [stdout] 83 | let part_one_answer = solve_part_one(&INPUT); [INFO] [stdout] | ^^^^^^ help: change this to: `INPUT` [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: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/bin/day_03.rs:88:42 [INFO] [stdout] | [INFO] [stdout] 88 | let part_two_answer = solve_part_two(&INPUT); [INFO] [stdout] | ^^^^^^ help: change this to: `INPUT` [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: doc list item without indentation [INFO] [stdout] --> src/bin/day_02.rs:20:5 [INFO] [stdout] | [INFO] [stdout] 20 | /// strange bugs if the flags are not correctly set, as opposed to using the OR operator. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] = note: `#[warn(clippy::doc_lazy_continuation)]` on by default [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 20 | /// strange bugs if the flags are not correctly set, as opposed to using the OR operator. [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of `.is_multiple_of()` [INFO] [stdout] --> src/bin/day_11.rs:35:19 [INFO] [stdout] | [INFO] [stdout] 35 | } else if num_str.len() % 2 == 0 { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `num_str.len().is_multiple_of(2)` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_is_multiple_of [INFO] [stdout] = note: `#[warn(clippy::manual_is_multiple_of)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_02.rs:23:5 [INFO] [stdout] | [INFO] [stdout] 23 | /// like arrays and Vecs. It makes it much much easier to generate all possible windows, without [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 23 | /// like arrays and Vecs. It makes it much much easier to generate all possible windows, without [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_02.rs:24:5 [INFO] [stdout] | [INFO] [stdout] 24 | /// worrying about going out of bounds etc. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 24 | /// worrying about going out of bounds etc. [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/bin/day_04.rs:67:25 [INFO] [stdout] | [INFO] [stdout] 67 | fn solve_part_two(grid: &Vec>) -> u32 { [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] 67 - fn solve_part_two(grid: &Vec>) -> u32 { [INFO] [stdout] 67 + fn solve_part_two(grid: &[Vec]) -> u32 { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of `.is_multiple_of()` [INFO] [stdout] --> src/bin/day_11.rs:47:23 [INFO] [stdout] | [INFO] [stdout] 47 | } else if num_str.len() % 2 == 0 { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `num_str.len().is_multiple_of(2)` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_is_multiple_of [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression borrows a value the compiler would automatically borrow [INFO] [stdout] --> src/bin/day_11.rs:50:32 [INFO] [stdout] | [INFO] [stdout] 50 | let left_num = (&num_str[..mid]).parse::().unwrap(); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^ help: change this to: `num_str[..mid]` [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: this expression borrows a value the compiler would automatically borrow [INFO] [stdout] --> src/bin/day_11.rs:51:33 [INFO] [stdout] | [INFO] [stdout] 51 | let right_num = (&num_str[mid..]).parse::().unwrap(); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^ help: change this to: `num_str[mid..]` [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: writing `&Vec` instead of `&[_]` involves a new object where a slice will do [INFO] [stdout] --> src/bin/day_02.rs:70:26 [INFO] [stdout] | [INFO] [stdout] 70 | fn solve_part_one(input: &Vec>) -> u32 { [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] 70 - fn solve_part_one(input: &Vec>) -> u32 { [INFO] [stdout] 70 + fn solve_part_one(input: &[Vec]) -> u32 { [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/bin/day_02.rs:77:26 [INFO] [stdout] | [INFO] [stdout] 77 | fn solve_part_two(input: &Vec>) -> u32 { [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] 77 - fn solve_part_two(input: &Vec>) -> u32 { [INFO] [stdout] 77 + fn solve_part_two(input: &[Vec]) -> u32 { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:10:5 [INFO] [stdout] | [INFO] [stdout] 10 | /// (I.e. instead of the data structure representing empty slots for you, you use an abstraction to [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] = note: `#[warn(clippy::doc_lazy_continuation)]` on by default [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 10 | /// (I.e. instead of the data structure representing empty slots for you, you use an abstraction to [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:11:5 [INFO] [stdout] | [INFO] [stdout] 11 | /// track it numerically and only append items with ID to the vector). This would be a lot more [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 11 | /// track it numerically and only append items with ID to the vector). This would be a lot more [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:12:5 [INFO] [stdout] | [INFO] [stdout] 12 | /// tedious though, as need variables to compare each block of empty space in the front, to each [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 12 | /// tedious though, as need variables to compare each block of empty space in the front, to each [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:13:5 [INFO] [stdout] | [INFO] [stdout] 13 | /// block of numbers in the back, trying to fit them, calculating the difference where there is a [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 13 | /// block of numbers in the back, trying to fit them, calculating the difference where there is a [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:14:5 [INFO] [stdout] | [INFO] [stdout] 14 | /// mismatch, and saving the difference for the subsequent set of blocks to be processed. I decided [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 14 | /// mismatch, and saving the difference for the subsequent set of blocks to be processed. I decided [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:15:5 [INFO] [stdout] | [INFO] [stdout] 15 | /// against this eventually. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 15 | /// against this eventually. [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:17:5 [INFO] [stdout] | [INFO] [stdout] 17 | /// crossed my mind to use a doubly-linked list, with certain nodes representing free space as a [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 17 | /// crossed my mind to use a doubly-linked list, with certain nodes representing free space as a [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:18:5 [INFO] [stdout] | [INFO] [stdout] 18 | /// variable in its data. It would also be faster to build than a vector, since I coulld append any [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 18 | /// variable in its data. It would also be faster to build than a vector, since I coulld append any [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:19:5 [INFO] [stdout] | [INFO] [stdout] 19 | /// number of elements to the back without triggering memory reallocation (which would be a problem [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 19 | /// number of elements to the back without triggering memory reallocation (which would be a problem [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:20:5 [INFO] [stdout] | [INFO] [stdout] 20 | /// in this case given that I cannot pre-allocate the vector size without knowing concretely the [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 20 | /// in this case given that I cannot pre-allocate the vector size without knowing concretely the [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:21:5 [INFO] [stdout] | [INFO] [stdout] 21 | /// number of items). However, after reading up on the LinkedList that comes with Rust, I was [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 21 | /// number of items). However, after reading up on the LinkedList that comes with Rust, I was [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:22:5 [INFO] [stdout] | [INFO] [stdout] 22 | /// disappointed to find that it not allow me to append or remove nodes easily from the middle of [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 22 | /// disappointed to find that it not allow me to append or remove nodes easily from the middle of [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:23:5 [INFO] [stdout] | [INFO] [stdout] 23 | /// the list, which was exactly what I wanted. Also, there doesn't seem to be a way to iterate from [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 23 | /// the list, which was exactly what I wanted. Also, there doesn't seem to be a way to iterate from [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:24:5 [INFO] [stdout] | [INFO] [stdout] 24 | /// the back of the list? Which means I cannot implement the two-pointer technique. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 24 | /// the back of the list? Which means I cannot implement the two-pointer technique. [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:25:5 [INFO] [stdout] | [INFO] [stdout] 25 | /// Finally, it seemed like I was back to the initial "naive" solution. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 25 | /// Finally, it seemed like I was back to the initial "naive" solution. [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:29:5 [INFO] [stdout] | [INFO] [stdout] 29 | /// to flatten an iterator of lines, with only 1 line, into a single unit and apply .map() to [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 29 | /// to flatten an iterator of lines, with only 1 line, into a single unit and apply .map() to [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:30:5 [INFO] [stdout] | [INFO] [stdout] 30 | /// extract the chars from the unit. If this sounds like a mouthful, it truly is, because, to my [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 30 | /// extract the chars from the unit. If this sounds like a mouthful, it truly is, because, to my [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:31:5 [INFO] [stdout] | [INFO] [stdout] 31 | /// horror, I realised how silly of me not to directly call .chars() method on the original &str. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 31 | /// horror, I realised how silly of me not to directly call .chars() method on the original &str. [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:32:5 [INFO] [stdout] | [INFO] [stdout] 32 | /// Urgh! [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 32 | /// Urgh! [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:35:5 [INFO] [stdout] | [INFO] [stdout] 35 | /// experimented with various iterators to compute the checksum. I debated between using .filter(), [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 35 | /// experimented with various iterators to compute the checksum. I debated between using .filter(), [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:36:5 [INFO] [stdout] | [INFO] [stdout] 36 | /// or its nicer cousin .filter_map() which will automatically unwrap the Option that I have. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 36 | /// or its nicer cousin .filter_map() which will automatically unwrap the Option that I have. [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:37:5 [INFO] [stdout] | [INFO] [stdout] 37 | /// The downside to both of them though is that they will iterate through the entire Vec, even [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 37 | /// The downside to both of them though is that they will iterate through the entire Vec, even [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:38:5 [INFO] [stdout] | [INFO] [stdout] 38 | /// though we know that after some point all which remain are None (empty slots). So in this case, [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 38 | /// though we know that after some point all which remain are None (empty slots). So in this case, [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:39:5 [INFO] [stdout] | [INFO] [stdout] 39 | /// .take_while() is more efficient because it stops at the first None, ignoring the rest. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 39 | /// .take_while() is more efficient because it stops at the first None, ignoring the rest. [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:42:5 [INFO] [stdout] | [INFO] [stdout] 42 | /// for a single predicate and 'continue' the loop otherwise, like so: [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 42 | /// for a single predicate and 'continue' the loop otherwise, like so: [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:64:5 [INFO] [stdout] | [INFO] [stdout] 64 | /// trying to use the style of a single-loop, and the 'continue' statement. For one, it became [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 64 | /// trying to use the style of a single-loop, and the 'continue' statement. For one, it became [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:65:5 [INFO] [stdout] | [INFO] [stdout] 65 | /// unavoidable to use a nested-while loop, when we are dealing with multiple pointers (front and [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 65 | /// unavoidable to use a nested-while loop, when we are dealing with multiple pointers (front and [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:66:5 [INFO] [stdout] | [INFO] [stdout] 66 | /// back) to represent a block. Let's call the parent left/right pointers 'boundary pointers', they [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 66 | /// back) to represent a block. Let's call the parent left/right pointers 'boundary pointers', they [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:67:5 [INFO] [stdout] | [INFO] [stdout] 67 | /// represent the boundary of the processed and unprocessed blocks. However, in part 2, each pointer [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 67 | /// represent the boundary of the processed and unprocessed blocks. However, in part 2, each pointer [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:68:5 [INFO] [stdout] | [INFO] [stdout] 68 | /// actually represents a pair of sub-pointers (front and back), that represent the length of a [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 68 | /// actually represents a pair of sub-pointers (front and back), that represent the length of a [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:69:5 [INFO] [stdout] | [INFO] [stdout] 69 | /// block. The sub-pointers need to be repeatedly incremented or decremented independent of the [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 69 | /// block. The sub-pointers need to be repeatedly incremented or decremented independent of the [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:70:5 [INFO] [stdout] | [INFO] [stdout] 70 | /// main pointer, so you have no choice but to write an inner while loop like so. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 70 | /// main pointer, so you have no choice but to write an inner while loop like so. [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:80:5 [INFO] [stdout] | [INFO] [stdout] 80 | /// parent left and right pointers). [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 80 | /// parent left and right pointers). [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:82:5 [INFO] [stdout] | [INFO] [stdout] 82 | /// block. Concretely, this means setting it to something like `file_front + 1` while of course [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 82 | /// block. Concretely, this means setting it to something like `file_front + 1` while of course [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:83:5 [INFO] [stdout] | [INFO] [stdout] 83 | /// checking that it stays within bounds. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 83 | /// checking that it stays within bounds. [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:84:5 [INFO] [stdout] | [INFO] [stdout] 84 | /// There must be a better way, and hence my next learning point: [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 84 | /// There must be a better way, and hence my next learning point: [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:87:5 [INFO] [stdout] | [INFO] [stdout] 87 | /// alluded to this fact when saying that the sub-pointers (front and back) are needed to represent [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 87 | /// alluded to this fact when saying that the sub-pointers (front and back) are needed to represent [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:88:5 [INFO] [stdout] | [INFO] [stdout] 88 | /// the LENGTH of the block. After referencing the solution of a friend, I realised that I had [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 88 | /// the LENGTH of the block. After referencing the solution of a friend, I realised that I had [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:89:5 [INFO] [stdout] | [INFO] [stdout] 89 | /// chosen a cumbersome abstraction. In fact, Rust has already solved this problem and given us a [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 89 | /// chosen a cumbersome abstraction. In fact, Rust has already solved this problem and given us a [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:90:5 [INFO] [stdout] | [INFO] [stdout] 90 | /// best practice in the form of slices, which are stored under the hood as a starting pointer and [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 90 | /// best practice in the form of slices, which are stored under the hood as a starting pointer and [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:91:5 [INFO] [stdout] | [INFO] [stdout] 91 | /// a length. This makes it so much easier to: [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 91 | /// a length. This makes it so much easier to: [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:95:5 [INFO] [stdout] | [INFO] [stdout] 95 | /// bounds, you only iterate until the last pointer (which you don't even to do manually). [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 95 | /// bounds, you only iterate until the last pointer (which you don't even to do manually). [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:96:5 [INFO] [stdout] | [INFO] [stdout] 96 | /// Then I also started to see why I potentially ran into problems using 'while' loops to increment [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 96 | /// Then I also started to see why I potentially ran into problems using 'while' loops to increment [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:97:5 [INFO] [stdout] | [INFO] [stdout] 97 | /// indices as per certain conditions. And this part from the Rust book finally made a lot more sense: [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 97 | /// indices as per certain conditions. And this part from the Rust book finally made a lot more sense: [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this boolean expression can be simplified [INFO] [stdout] --> src/bin/day_09.rs:195:23 [INFO] [stdout] | [INFO] [stdout] 195 | while !(file_back < file_front) { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(file_back >= file_front)` [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 `if` has identical blocks [INFO] [stdout] --> src/bin/day_06.rs:48:29 [INFO] [stdout] | [INFO] [stdout] 48 | if r == 0 && dr < 0 { [INFO] [stdout] | _____________________________^ [INFO] [stdout] 49 | | false [INFO] [stdout] 50 | | } else if c == 0 && dc < 0 { [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] note: same as this [INFO] [stdout] --> src/bin/day_06.rs:50:36 [INFO] [stdout] | [INFO] [stdout] 50 | } else if c == 0 && dc < 0 { [INFO] [stdout] | ____________________________________^ [INFO] [stdout] 51 | | false [INFO] [stdout] 52 | | } else if r == self.rows - 1 && dr > 0 { [INFO] [stdout] | |_________^ [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#if_same_then_else [INFO] [stdout] = note: `#[warn(clippy::if_same_then_else)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` has identical blocks [INFO] [stdout] --> src/bin/day_06.rs:50:36 [INFO] [stdout] | [INFO] [stdout] 50 | } else if c == 0 && dc < 0 { [INFO] [stdout] | ____________________________________^ [INFO] [stdout] 51 | | false [INFO] [stdout] 52 | | } else if r == self.rows - 1 && dr > 0 { [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] note: same as this [INFO] [stdout] --> src/bin/day_06.rs:52:48 [INFO] [stdout] | [INFO] [stdout] 52 | } else if r == self.rows - 1 && dr > 0 { [INFO] [stdout] | ________________________________________________^ [INFO] [stdout] 53 | | false [INFO] [stdout] 54 | | } else if c == self.cols - 1 && dc > 0 { [INFO] [stdout] | |_________^ [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#if_same_then_else [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` has identical blocks [INFO] [stdout] --> src/bin/day_06.rs:52:48 [INFO] [stdout] | [INFO] [stdout] 52 | } else if r == self.rows - 1 && dr > 0 { [INFO] [stdout] | ________________________________________________^ [INFO] [stdout] 53 | | false [INFO] [stdout] 54 | | } else if c == self.cols - 1 && dc > 0 { [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] note: same as this [INFO] [stdout] --> src/bin/day_06.rs:54:48 [INFO] [stdout] | [INFO] [stdout] 54 | } else if c == self.cols - 1 && dc > 0 { [INFO] [stdout] | ________________________________________________^ [INFO] [stdout] 55 | | false [INFO] [stdout] 56 | | } else { [INFO] [stdout] | |_________^ [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#if_same_then_else [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this if-then-else expression returns a bool literal [INFO] [stdout] --> src/bin/day_06.rs:54:16 [INFO] [stdout] | [INFO] [stdout] 54 | } else if c == self.cols - 1 && dc > 0 { [INFO] [stdout] | ________________^ [INFO] [stdout] 55 | | false [INFO] [stdout] 56 | | } else { [INFO] [stdout] 57 | | true [INFO] [stdout] 58 | | } [INFO] [stdout] | |_________^ help: you can reduce it to: `{ !(c == self.cols - 1 && dc > 0) }` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_bool [INFO] [stdout] = note: `#[warn(clippy::needless_bool)]` 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/bin/day_06.rs:152:25 [INFO] [stdout] | [INFO] [stdout] 152 | fn solve_part_one(grid: &Vec>) -> u32 { [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] 152 ~ fn solve_part_one(grid: &[Vec]) -> u32 { [INFO] [stdout] 153 ~ let mut owned_grid = grid.to_owned(); [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/bin/day_06.rs:169:25 [INFO] [stdout] | [INFO] [stdout] 169 | fn solve_part_two(grid: &Vec>) -> u32 { [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] 169 ~ fn solve_part_two(grid: &[Vec]) -> u32 { [INFO] [stdout] 170 | let mut count = 0; [INFO] [stdout] 171 ~ let mut mutated_grid = grid.to_owned(); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this loop could be written as a `while let` loop [INFO] [stdout] --> src/bin/day_06.rs:177:17 [INFO] [stdout] | [INFO] [stdout] 177 | / loop { [INFO] [stdout] 178 | | if let Some(pos) = explorer.next_pos() { [INFO] [stdout] 179 | | if explorer.is_invalid_pos(pos) { [INFO] [stdout] 180 | | explorer.switch_next_move(); [INFO] [stdout] ... | [INFO] [stdout] 192 | | } [INFO] [stdout] | |_________________^ help: try: `while let Some(pos) = explorer.next_pos() { .. }` [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: hiding a lifetime that's named elsewhere is confusing [INFO] [stdout] --> src/bin/day_06.rs:123:46 [INFO] [stdout] | [INFO] [stdout] 123 | fn from(data: &'a mut Vec>) -> GridExplorer { [INFO] [stdout] | -- ^^^^^^^^^^^^ the same lifetime is hidden here [INFO] [stdout] | | [INFO] [stdout] | the lifetime is named here [INFO] [stdout] | [INFO] [stdout] = help: the same lifetime is referred to in inconsistent ways, making the signature confusing [INFO] [stdout] = note: `#[warn(mismatched_lifetime_syntaxes)]` on by default [INFO] [stdout] help: consistently use `'a` [INFO] [stdout] | [INFO] [stdout] 123 | fn from(data: &'a mut Vec>) -> GridExplorer<'a> { [INFO] [stdout] | ++++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:9:5 [INFO] [stdout] | [INFO] [stdout] 9 | /// antennas, where each entry maps the antenna type, e.g. 'A', to a Vec of antenna positions. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] = note: `#[warn(clippy::doc_lazy_continuation)]` on by default [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 9 | /// antennas, where each entry maps the antenna type, e.g. 'A', to a Vec of antenna positions. [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:10:5 [INFO] [stdout] | [INFO] [stdout] 10 | /// Actually, all we need is a Vec>, without the identifier for the antenna type. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 10 | /// Actually, all we need is a Vec>, without the identifier for the antenna type. [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:11:5 [INFO] [stdout] | [INFO] [stdout] 11 | /// However, including the antenna type actually makes it easier to aggregate the data in one pass. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 11 | /// However, including the antenna type actually makes it easier to aggregate the data in one pass. [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:12:5 [INFO] [stdout] | [INFO] [stdout] 12 | /// I eventually called this HashMap 'antenna_groups'. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 12 | /// I eventually called this HashMap 'antenna_groups'. [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:15:5 [INFO] [stdout] | [INFO] [stdout] 15 | /// own it, but turns out it's a bad idea. Assuming that I want to encapsulate the data, I would use [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 15 | /// own it, but turns out it's a bad idea. Assuming that I want to encapsulate the data, I would use [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:16:5 [INFO] [stdout] | [INFO] [stdout] 16 | /// a getter to return a reference to 'antenna_groups'. But this would mean that my getter method [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 16 | /// a getter to return a reference to 'antenna_groups'. But this would mean that my getter method [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:17:5 [INFO] [stdout] | [INFO] [stdout] 17 | /// would need to borrow the entire Grid struct to read 'antenna_groups'. In turn, this would deny [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 17 | /// would need to borrow the entire Grid struct to read 'antenna_groups'. In turn, this would deny [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:18:5 [INFO] [stdout] | [INFO] [stdout] 18 | /// me a mutable ref to update state in the Grid struct. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 18 | /// me a mutable ref to update state in the Grid struct. [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:30:5 [INFO] [stdout] | [INFO] [stdout] 30 | /// `is_next_pos_in_bounds`, made the assumption that we only move one sqaure at a time. This is [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 30 | /// `is_next_pos_in_bounds`, made the assumption that we only move one sqaure at a time. This is [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:31:5 [INFO] [stdout] | [INFO] [stdout] 31 | /// a valid assumption in many grid exploration problems, but not here. In hindsight, it was a poor [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 31 | /// a valid assumption in many grid exploration problems, but not here. In hindsight, it was a poor [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:32:5 [INFO] [stdout] | [INFO] [stdout] 32 | /// fit because we aren't exactly doing an exploration here. So I eventually removed the [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 32 | /// fit because we aren't exactly doing an exploration here. So I eventually removed the [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:33:5 [INFO] [stdout] | [INFO] [stdout] 33 | /// `is_next_pos_in_bounds` fn. I could have refactored it, if not for the next learning point, [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 33 | /// `is_next_pos_in_bounds` fn. I could have refactored it, if not for the next learning point, [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:34:5 [INFO] [stdout] | [INFO] [stdout] 34 | /// which is about issues with integer types. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 34 | /// which is about issues with integer types. [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:37:5 [INFO] [stdout] | [INFO] [stdout] 37 | /// TLDR: I think for purposes of this challenge, it makes thing so much easier to use casting and [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 37 | /// TLDR: I think for purposes of this challenge, it makes thing so much easier to use casting and [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:38:5 [INFO] [stdout] | [INFO] [stdout] 38 | /// accept that it is fine for the nature of this input. We can still be aware with the limits of [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 38 | /// accept that it is fine for the nature of this input. We can still be aware with the limits of [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:39:5 [INFO] [stdout] | [INFO] [stdout] 39 | /// our code. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 39 | /// our code. [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: empty line after doc comment [INFO] [stdout] --> src/bin/day_02.rs:24:1 [INFO] [stdout] | [INFO] [stdout] 24 | / /// worrying about going out of bounds etc. [INFO] [stdout] 25 | | [INFO] [stdout] | |_^ [INFO] [stdout] 26 | fn parse_input(input: &'static str) -> Vec> { [INFO] [stdout] | -------------- the comment documents this function [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#empty_line_after_doc_comments [INFO] [stdout] = note: `#[warn(clippy::empty_line_after_doc_comments)]` on by default [INFO] [stdout] = help: if the empty line is unintentional, remove it [INFO] [stdout] help: if the comment should document the crate use an inner doc comment [INFO] [stdout] | [INFO] [stdout] 1 ~ //! # Commentary [INFO] [stdout] 2 ~ //! [INFO] [stdout] 3 ~ //! Part One was fairly straightforward, but I got into trouble trying to refactor my fn for use in [INFO] [stdout] 4 ~ //! part Two. Part One was basically a sliding window (size 2) over all elements, to see if any [INFO] [stdout] 5 ~ //! window violated the rules. It could be easily solved using constructs like .any() or .all(), [INFO] [stdout] 6 ~ //! which I initially wrote. However, I got carried away in Part Two which called for a tolerance [INFO] [stdout] 7 ~ //! of one element being in violation of the rules. I tried to reason that this meant having 1 [INFO] [stdout] 8 ~ //! window being in violation, tested some inputs, but failed to realise an important edge case: [INFO] [stdout] 9 ~ //! there could be an input with 1 invalid window, that would still *remain unsafe* even after the [INFO] [stdout] 10 ~ //! removal of 1 element. As an example: [INFO] [stdout] 11 ~ //! [1, 2, 9, 10, 11, 12] -> even though the [2, 9] window is invalid, removing 9 still would not [INFO] [stdout] 12 ~ //! help as it would merely leave another [2, 10] invalid window. [INFO] [stdout] 13 ~ //! [INFO] [stdout] 14 ~ //! I was forced to abandon the "tolerance" approach and revert to the most straightforward idea [INFO] [stdout] 15 ~ //! of testing every sub-array with one element removed. You can see the mess I left, and still [INFO] [stdout] 16 ~ //! leave for posterity's sake, in the `is_safe_with_tolerance` fn. [INFO] [stdout] 17 ~ //! [INFO] [stdout] 18 ~ //! # Things I tried and learnt [INFO] [stdout] 19 ~ //! - Using the XOR operator to combine 2 mutually exclusive flags, which may help to ferret out [INFO] [stdout] 20 ~ //! strange bugs if the flags are not correctly set, as opposed to using the OR operator. [INFO] [stdout] 21 ~ //! [INFO] [stdout] 22 ~ //! - Using the .windows() method on the Slice type. Which will work for anything "slice-able", [INFO] [stdout] 23 ~ //! like arrays and Vecs. It makes it much much easier to generate all possible windows, without [INFO] [stdout] 24 ~ //! worrying about going out of bounds etc. [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:49:5 [INFO] [stdout] | [INFO] [stdout] 49 | /// value is too big to fit into isize (e.g. because the value is close to usize::MAX), an overflow [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 49 | /// value is too big to fit into isize (e.g. because the value is close to usize::MAX), an overflow [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:50:5 [INFO] [stdout] | [INFO] [stdout] 50 | /// will silently happen, resulting in a negative number. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 50 | /// will silently happen, resulting in a negative number. [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:51:5 [INFO] [stdout] | [INFO] [stdout] 51 | /// Solution: Perform a range check before casting, or use TryFrom. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 51 | /// Solution: Perform a range check before casting, or use TryFrom. [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:53:5 [INFO] [stdout] | [INFO] [stdout] 53 | /// silently wrapping around (depending on which mode). [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 53 | /// silently wrapping around (depending on which mode). [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:54:5 [INFO] [stdout] | [INFO] [stdout] 54 | /// Solution: Using checked arithmetic, e.g. `checked_add`, or other similar methods. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 54 | /// Solution: Using checked arithmetic, e.g. `checked_add`, or other similar methods. [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:56:5 [INFO] [stdout] | [INFO] [stdout] 56 | /// reinterpreted into a (very large) `usize` which is incorrect (sometimes referred to as [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 56 | /// reinterpreted into a (very large) `usize` which is incorrect (sometimes referred to as [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:57:5 [INFO] [stdout] | [INFO] [stdout] 57 | /// wraparound). [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 57 | /// wraparound). [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:58:5 [INFO] [stdout] | [INFO] [stdout] 58 | /// Solution: Perform a check before casting, or use TryFrom. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 58 | /// Solution: Perform a check before casting, or use TryFrom. [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:67:5 [INFO] [stdout] | [INFO] [stdout] 67 | /// was to start the inner loop at index 1 greater than the outer loop, to ensure that we would not [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 67 | /// was to start the inner loop at index 1 greater than the outer loop, to ensure that we would not [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:68:5 [INFO] [stdout] | [INFO] [stdout] 68 | /// repeat the same combination. This had the downside of having to repeat some code twice, since [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 68 | /// repeat the same combination. This had the downside of having to repeat some code twice, since [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:69:5 [INFO] [stdout] | [INFO] [stdout] 69 | /// each combination of `tower_a` and `tower_b` can appear in two separate permutations (i.e. the [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 69 | /// each combination of `tower_a` and `tower_b` can appear in two separate permutations (i.e. the [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:70:5 [INFO] [stdout] | [INFO] [stdout] 70 | /// antinode for `tower_a` due to `tower_b` and vice versa). The second way to actually iterate [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 70 | /// antinode for `tower_a` due to `tower_b` and vice versa). The second way to actually iterate [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:71:5 [INFO] [stdout] | [INFO] [stdout] 71 | /// through the entire array of antennas in the inner loop again, but add check for whether [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 71 | /// through the entire array of antennas in the inner loop again, but add check for whether [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:72:5 [INFO] [stdout] | [INFO] [stdout] 72 | /// `tower_a` != `tower_b`. Although this is less efficient, it is certainly more elegant, since [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 72 | /// `tower_a` != `tower_b`. Although this is less efficient, it is certainly more elegant, since [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:73:5 [INFO] [stdout] | [INFO] [stdout] 73 | /// all permutations are taken care of automatically. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 73 | /// all permutations are taken care of automatically. [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:76:5 [INFO] [stdout] | [INFO] [stdout] 76 | /// data type in Rust, but the concept of geometric (or Euclidean) vectors. What I did was to [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 76 | /// data type in Rust, but the concept of geometric (or Euclidean) vectors. What I did was to [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:77:5 [INFO] [stdout] | [INFO] [stdout] 77 | /// iterate through various examples to generalize a formula to calculate the antinodes, which was [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 77 | /// iterate through various examples to generalize a formula to calculate the antinodes, which was [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:78:5 [INFO] [stdout] | [INFO] [stdout] 78 | /// tedious to do on the fly. Instead, I learnt that you could use a Vector to model the [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 78 | /// tedious to do on the fly. Instead, I learnt that you could use a Vector to model the [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:79:5 [INFO] [stdout] | [INFO] [stdout] 79 | /// displacement from antenna A to antenna B (Vector A->B (aka from A to B) = B - A). Then it would [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 79 | /// displacement from antenna A to antenna B (Vector A->B (aka from A to B) = B - A). Then it would [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:80:5 [INFO] [stdout] | [INFO] [stdout] 80 | /// be a matter of applying the vector to the point B (or the negative to point A) to calculate the [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 80 | /// be a matter of applying the vector to the point B (or the negative to point A) to calculate the [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:81:5 [INFO] [stdout] | [INFO] [stdout] 81 | /// antinodes. An even easier method would be to double the Vector from the source antenna A, which [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 81 | /// antinodes. An even easier method would be to double the Vector from the source antenna A, which [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:82:5 [INFO] [stdout] | [INFO] [stdout] 82 | /// would give the antinode further from A. In part 2, we could transform the vector by a linearly [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 82 | /// would give the antinode further from A. In part 2, we could transform the vector by a linearly [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:83:5 [INFO] [stdout] | [INFO] [stdout] 83 | /// increasing scalar and apply it multiple times until we leave the grid to get the series of [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 83 | /// increasing scalar and apply it multiple times until we leave the grid to get the series of [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:84:5 [INFO] [stdout] | [INFO] [stdout] 84 | /// antinodes. I think this is a much cleaner way to think about it. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 84 | /// antinodes. I think this is a much cleaner way to think about it. [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: constants have by default a `'static` lifetime [INFO] [stdout] --> src/bin/day_02.rs:86:19 [INFO] [stdout] | [INFO] [stdout] 86 | const INPUT: &'static str = include_str!("../input/day_02.txt"); [INFO] [stdout] | -^^^^^^^---- help: consider removing `'static`: `&str` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_static_lifetimes [INFO] [stdout] = note: `#[warn(clippy::redundant_static_lifetimes)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: constants have by default a `'static` lifetime [INFO] [stdout] --> src/bin/day_03.rs:81:19 [INFO] [stdout] | [INFO] [stdout] 81 | const INPUT: &'static str = include_str!("../input/day_03.txt"); [INFO] [stdout] | -^^^^^^^---- help: consider removing `'static`: `&str` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_static_lifetimes [INFO] [stdout] = note: `#[warn(clippy::redundant_static_lifetimes)]` 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/bin/day_08.rs:212:25 [INFO] [stdout] | [INFO] [stdout] 212 | fn solve_part_one(grid: &Vec>) -> u32 { [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] 212 ~ fn solve_part_one(grid: &[Vec]) -> u32 { [INFO] [stdout] 213 ~ let mut explorer = GridExplorer::from(grid.to_owned()); [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/bin/day_08.rs:232:25 [INFO] [stdout] | [INFO] [stdout] 232 | fn solve_part_two(grid: &Vec>) -> u32 { [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] 232 ~ fn solve_part_two(grid: &[Vec]) -> u32 { [INFO] [stdout] 233 ~ let mut explorer = GridExplorer::from(grid.to_owned()); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: empty line after doc comment [INFO] [stdout] --> src/bin/day_05.rs:7:1 [INFO] [stdout] | [INFO] [stdout] 7 | / /// TBC [INFO] [stdout] 8 | | [INFO] [stdout] | |_^ [INFO] [stdout] ... [INFO] [stdout] 16 | use std::cmp::Ordering; [INFO] [stdout] | - the comment documents this `use` import [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#empty_line_after_doc_comments [INFO] [stdout] = note: `#[warn(clippy::empty_line_after_doc_comments)]` on by default [INFO] [stdout] = help: if the empty line is unintentional, remove it [INFO] [stdout] help: if the comment should document the crate use an inner doc comment [INFO] [stdout] | [INFO] [stdout] 1 ~ //! Commentary [INFO] [stdout] 2 ~ //! [INFO] [stdout] 3 ~ //! Once again, I was overly eager to practice my DFS seeing that this was clearly could be a graph [INFO] [stdout] 4 ~ //! problem describing the relationships between pages and their prequisites. Before I could end up [INFO] [stdout] 5 ~ //! writing the Topological Sort though, I realised that there was much simpler way given the [INFO] [stdout] 6 ~ //! constraints of this graph. [INFO] [stdout] 7 ~ //! TBC [INFO] [stdout] | [INFO] [stdout] help: if the documentation should include the empty line include it in the comment [INFO] [stdout] | [INFO] [stdout] 8 | /// [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: constants have by default a `'static` lifetime [INFO] [stdout] --> src/bin/day_05.rs:109:19 [INFO] [stdout] | [INFO] [stdout] 109 | const INPUT: &'static str = include_str!("../input/day_05.txt"); [INFO] [stdout] | -^^^^^^^---- help: consider removing `'static`: `&str` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_static_lifetimes [INFO] [stdout] = note: `#[warn(clippy::redundant_static_lifetimes)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: empty line after doc comment [INFO] [stdout] --> src/bin/day_06.rs:8:1 [INFO] [stdout] | [INFO] [stdout] 8 | / /// forced to take a ref to the grid and use dreaded lifetimes. [INFO] [stdout] 9 | | [INFO] [stdout] | |_^ [INFO] [stdout] 10 | fn parse_input(input: &str) -> Vec> { [INFO] [stdout] | -------------- the comment documents this function [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#empty_line_after_doc_comments [INFO] [stdout] = note: `#[warn(clippy::empty_line_after_doc_comments)]` on by default [INFO] [stdout] = help: if the empty line is unintentional, remove it [INFO] [stdout] help: if the comment should document the crate use an inner doc comment [INFO] [stdout] | [INFO] [stdout] 1 ~ //! Commentary [INFO] [stdout] 2 ~ //! [INFO] [stdout] 3 ~ //! Having seen so many Grid problems, I was frustrated at writing the same code over and over [INFO] [stdout] 4 ~ //! again and decided to create a reusable GridExplorer, and finally get some practice with [INFO] [stdout] 5 ~ //! writing structs. [INFO] [stdout] 6 ~ //! [INFO] [stdout] 7 ~ //! As part of an optimization to use the same grid in memory in every brute-force search, I was [INFO] [stdout] 8 ~ //! forced to take a ref to the grid and use dreaded lifetimes. [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: constants have by default a `'static` lifetime [INFO] [stdout] --> src/bin/day_06.rs:203:19 [INFO] [stdout] | [INFO] [stdout] 203 | const INPUT: &'static str = include_str!("../input/day_06.txt"); [INFO] [stdout] | -^^^^^^^---- help: consider removing `'static`: `&str` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_static_lifetimes [INFO] [stdout] = note: `#[warn(clippy::redundant_static_lifetimes)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_03.rs:9:5 [INFO] [stdout] | [INFO] [stdout] 9 | /// some circles (e.g. Perl), I believe this is called Regex Extended Mode. Also, this mode ignores [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] = note: `#[warn(clippy::doc_lazy_continuation)]` on by default [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 9 | /// some circles (e.g. Perl), I believe this is called Regex Extended Mode. Also, this mode ignores [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_03.rs:10:5 [INFO] [stdout] | [INFO] [stdout] 10 | /// inline comments to explain what you are trying to do. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 10 | /// inline comments to explain what you are trying to do. [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_03.rs:13:5 [INFO] [stdout] | [INFO] [stdout] 13 | /// limits. TODO: read up on the algorithm. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 13 | /// limits. TODO: read up on the algorithm. [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_03.rs:16:5 [INFO] [stdout] | [INFO] [stdout] 16 | /// using a for-loop, but the .fold() here to selectively toggle flags while trying to accumulate [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 16 | /// using a for-loop, but the .fold() here to selectively toggle flags while trying to accumulate [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_03.rs:17:5 [INFO] [stdout] | [INFO] [stdout] 17 | /// the result just looks unelegant. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 17 | /// the result just looks unelegant. [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_05.rs:11:5 [INFO] [stdout] | [INFO] [stdout] 11 | /// graph is acyclic). Otherwise the list of rules is invalid and the whole problem falls apart. So [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] = note: `#[warn(clippy::doc_lazy_continuation)]` on by default [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 11 | /// graph is acyclic). Otherwise the list of rules is invalid and the whole problem falls apart. So [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_05.rs:12:5 [INFO] [stdout] | [INFO] [stdout] 12 | /// we can skip this check. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 12 | /// we can skip this check. [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_05.rs:14:5 [INFO] [stdout] | [INFO] [stdout] 14 | /// is an explicit rule for every single preq-to-target relationship. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 14 | /// is an explicit rule for every single preq-to-target relationship. [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_05.rs:15:5 [INFO] [stdout] | [INFO] [stdout] 15 | /// TODO: it seems like the term for this might be a Transitive Closure, to check [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 15 | /// TODO: it seems like the term for this might be a Transitive Closure, to check [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: use of `or_insert` to construct default value [INFO] [stdout] --> src/bin/day_05.rs:30:52 [INFO] [stdout] | [INFO] [stdout] 30 | let entry = dep_adj_list.entry(source).or_insert(Vec::new()); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_or_default [INFO] [stdout] = note: `#[warn(clippy::unwrap_or_default)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/bin/day_03.rs:83:42 [INFO] [stdout] | [INFO] [stdout] 83 | let part_one_answer = solve_part_one(&INPUT); [INFO] [stdout] | ^^^^^^ help: change this to: `INPUT` [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: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/bin/day_03.rs:88:42 [INFO] [stdout] | [INFO] [stdout] 88 | let part_two_answer = solve_part_two(&INPUT); [INFO] [stdout] | ^^^^^^ help: change this to: `INPUT` [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: empty line after doc comment [INFO] [stdout] --> src/bin/day_07.rs:17:1 [INFO] [stdout] | [INFO] [stdout] 17 | / /// TODO, I wonder how others modelled this thing. [INFO] [stdout] 18 | | [INFO] [stdout] | |_^ [INFO] [stdout] 19 | fn parse_input(input: &str) -> Vec<(i64, Vec)> { [INFO] [stdout] | -------------- the comment documents this function [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#empty_line_after_doc_comments [INFO] [stdout] = note: `#[warn(clippy::empty_line_after_doc_comments)]` on by default [INFO] [stdout] = help: if the empty line is unintentional, remove it [INFO] [stdout] help: if the comment should document the crate use an inner doc comment [INFO] [stdout] | [INFO] [stdout] 1 ~ //! # Commentary [INFO] [stdout] 2 ~ //! [INFO] [stdout] 3 ~ //! Instinctively, I reached for DFS. Luckily, it didn't seem to be over-engineered for a variable [INFO] [stdout] 4 ~ //! number of operators because surely enough, in part 2, they asked to add another operator. [INFO] [stdout] 5 ~ //! [INFO] [stdout] 6 ~ //! # Things I tried and learnt [INFO] [stdout] 7 ~ //! - Using slices is a memory-efficient way of tracking the remaining elements in the array. [INFO] [stdout] 8 ~ //! Really learning to appreciate the Slice API in Rust. [INFO] [stdout] 9 ~ //! [INFO] [stdout] 10 ~ //! - Using a `match` statement is an elegant way to handle the various operations. It also helps [INFO] [stdout] 11 ~ //! for a combination check on whether there is any previous result and how to proceed with the [INFO] [stdout] 12 ~ //! operation. [INFO] [stdout] 13 ~ //! [INFO] [stdout] 14 ~ //! - The terminal condition for DFS should be when there are no more nums to process, it seems [INFO] [stdout] 15 ~ //! simple but midway I struggled with something more tricky like the length of `results` Vec. [INFO] [stdout] 16 ~ //! I think using a results Vec simplified certain things but threw me off in this way. [INFO] [stdout] 17 ~ //! TODO, I wonder how others modelled this thing. [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: constants have by default a `'static` lifetime [INFO] [stdout] --> src/bin/day_07.rs:106:19 [INFO] [stdout] | [INFO] [stdout] 106 | const INPUT: &'static str = include_str!("../input/day_07.txt"); [INFO] [stdout] | -^^^^^^^---- help: consider removing `'static`: `&str` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_static_lifetimes [INFO] [stdout] = note: `#[warn(clippy::redundant_static_lifetimes)]` 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/bin/day_05.rs:45:34 [INFO] [stdout] | [INFO] [stdout] 45 | fn is_valid_task_path(task_path: &Vec, dep_adj_list: &HashMap>) -> 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] 45 - fn is_valid_task_path(task_path: &Vec, dep_adj_list: &HashMap>) -> bool { [INFO] [stdout] 45 + fn is_valid_task_path(task_path: &[u32], dep_adj_list: &HashMap>) -> bool { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `contains()` instead of `iter().any()` is more efficient [INFO] [stdout] --> src/bin/day_05.rs:52:17 [INFO] [stdout] | [INFO] [stdout] 52 | if !known_destinations.iter().any(|&t| t == dest) { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `known_destinations.contains(&dest)` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_contains [INFO] [stdout] = note: `#[warn(clippy::manual_contains)]` 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/bin/day_05.rs:63:38 [INFO] [stdout] | [INFO] [stdout] 63 | fn to_reordered_task_path(task_path: &Vec, adj_list: &HashMap>) -> 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] 63 - fn to_reordered_task_path(task_path: &Vec, adj_list: &HashMap>) -> Vec { [INFO] [stdout] 63 + fn to_reordered_task_path(task_path: &[u32], adj_list: &HashMap>) -> Vec { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/bin/day_05.rs:70:36 [INFO] [stdout] | [INFO] [stdout] 70 | let v_dests = adj_list.get(&v); [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: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/bin/day_05.rs:71:36 [INFO] [stdout] | [INFO] [stdout] 71 | let w_dests = adj_list.get(&w); [INFO] [stdout] | ^^ help: change this to: `w` [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: writing `&Vec` instead of `&[_]` involves a new object where a slice will do [INFO] [stdout] --> src/bin/day_05.rs:89:65 [INFO] [stdout] | [INFO] [stdout] 89 | fn solve_part_one(dep_adj_list: &HashMap>, tasks: &Vec>) -> u32 { [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] 89 - fn solve_part_one(dep_adj_list: &HashMap>, tasks: &Vec>) -> u32 { [INFO] [stdout] 89 + fn solve_part_one(dep_adj_list: &HashMap>, tasks: &[Vec]) -> u32 { [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/bin/day_05.rs:97:65 [INFO] [stdout] | [INFO] [stdout] 97 | fn solve_part_two(dep_adj_list: &HashMap>, tasks: &Vec>) -> u32 { [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] 97 - fn solve_part_two(dep_adj_list: &HashMap>, tasks: &Vec>) -> u32 { [INFO] [stdout] 97 + fn solve_part_two(dep_adj_list: &HashMap>, tasks: &[Vec]) -> u32 { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of `.is_multiple_of()` [INFO] [stdout] --> src/bin/day_11.rs:35:19 [INFO] [stdout] | [INFO] [stdout] 35 | } else if num_str.len() % 2 == 0 { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `num_str.len().is_multiple_of(2)` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_is_multiple_of [INFO] [stdout] = note: `#[warn(clippy::manual_is_multiple_of)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_02.rs:20:5 [INFO] [stdout] | [INFO] [stdout] 20 | /// strange bugs if the flags are not correctly set, as opposed to using the OR operator. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] = note: `#[warn(clippy::doc_lazy_continuation)]` on by default [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 20 | /// strange bugs if the flags are not correctly set, as opposed to using the OR operator. [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_02.rs:23:5 [INFO] [stdout] | [INFO] [stdout] 23 | /// like arrays and Vecs. It makes it much much easier to generate all possible windows, without [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 23 | /// like arrays and Vecs. It makes it much much easier to generate all possible windows, without [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_02.rs:24:5 [INFO] [stdout] | [INFO] [stdout] 24 | /// worrying about going out of bounds etc. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 24 | /// worrying about going out of bounds etc. [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of `.is_multiple_of()` [INFO] [stdout] --> src/bin/day_11.rs:47:23 [INFO] [stdout] | [INFO] [stdout] 47 | } else if num_str.len() % 2 == 0 { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `num_str.len().is_multiple_of(2)` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_is_multiple_of [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression borrows a value the compiler would automatically borrow [INFO] [stdout] --> src/bin/day_11.rs:50:32 [INFO] [stdout] | [INFO] [stdout] 50 | let left_num = (&num_str[..mid]).parse::().unwrap(); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^ help: change this to: `num_str[..mid]` [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: this expression borrows a value the compiler would automatically borrow [INFO] [stdout] --> src/bin/day_11.rs:51:33 [INFO] [stdout] | [INFO] [stdout] 51 | let right_num = (&num_str[mid..]).parse::().unwrap(); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^ help: change this to: `num_str[mid..]` [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 `if` has identical blocks [INFO] [stdout] --> src/bin/day_06.rs:48:29 [INFO] [stdout] | [INFO] [stdout] 48 | if r == 0 && dr < 0 { [INFO] [stdout] | _____________________________^ [INFO] [stdout] 49 | | false [INFO] [stdout] 50 | | } else if c == 0 && dc < 0 { [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] note: same as this [INFO] [stdout] --> src/bin/day_06.rs:50:36 [INFO] [stdout] | [INFO] [stdout] 50 | } else if c == 0 && dc < 0 { [INFO] [stdout] | ____________________________________^ [INFO] [stdout] 51 | | false [INFO] [stdout] 52 | | } else if r == self.rows - 1 && dr > 0 { [INFO] [stdout] | |_________^ [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#if_same_then_else [INFO] [stdout] = note: `#[warn(clippy::if_same_then_else)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` has identical blocks [INFO] [stdout] --> src/bin/day_06.rs:50:36 [INFO] [stdout] | [INFO] [stdout] 50 | } else if c == 0 && dc < 0 { [INFO] [stdout] | ____________________________________^ [INFO] [stdout] 51 | | false [INFO] [stdout] 52 | | } else if r == self.rows - 1 && dr > 0 { [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] note: same as this [INFO] [stdout] --> src/bin/day_06.rs:52:48 [INFO] [stdout] | [INFO] [stdout] 52 | } else if r == self.rows - 1 && dr > 0 { [INFO] [stdout] | ________________________________________________^ [INFO] [stdout] 53 | | false [INFO] [stdout] 54 | | } else if c == self.cols - 1 && dc > 0 { [INFO] [stdout] | |_________^ [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#if_same_then_else [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` has identical blocks [INFO] [stdout] --> src/bin/day_06.rs:52:48 [INFO] [stdout] | [INFO] [stdout] 52 | } else if r == self.rows - 1 && dr > 0 { [INFO] [stdout] | ________________________________________________^ [INFO] [stdout] 53 | | false [INFO] [stdout] 54 | | } else if c == self.cols - 1 && dc > 0 { [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] note: same as this [INFO] [stdout] --> src/bin/day_06.rs:54:48 [INFO] [stdout] | [INFO] [stdout] 54 | } else if c == self.cols - 1 && dc > 0 { [INFO] [stdout] | ________________________________________________^ [INFO] [stdout] 55 | | false [INFO] [stdout] 56 | | } else { [INFO] [stdout] | |_________^ [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#if_same_then_else [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this if-then-else expression returns a bool literal [INFO] [stdout] --> src/bin/day_06.rs:54:16 [INFO] [stdout] | [INFO] [stdout] 54 | } else if c == self.cols - 1 && dc > 0 { [INFO] [stdout] | ________________^ [INFO] [stdout] 55 | | false [INFO] [stdout] 56 | | } else { [INFO] [stdout] 57 | | true [INFO] [stdout] 58 | | } [INFO] [stdout] | |_________^ help: you can reduce it to: `{ !(c == self.cols - 1 && dc > 0) }` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_bool [INFO] [stdout] = note: `#[warn(clippy::needless_bool)]` 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/bin/day_02.rs:70:26 [INFO] [stdout] | [INFO] [stdout] 70 | fn solve_part_one(input: &Vec>) -> u32 { [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] 70 - fn solve_part_one(input: &Vec>) -> u32 { [INFO] [stdout] 70 + fn solve_part_one(input: &[Vec]) -> u32 { [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/bin/day_02.rs:77:26 [INFO] [stdout] | [INFO] [stdout] 77 | fn solve_part_two(input: &Vec>) -> u32 { [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] 77 - fn solve_part_two(input: &Vec>) -> u32 { [INFO] [stdout] 77 + fn solve_part_two(input: &[Vec]) -> u32 { [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/bin/day_06.rs:152:25 [INFO] [stdout] | [INFO] [stdout] 152 | fn solve_part_one(grid: &Vec>) -> u32 { [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] 152 ~ fn solve_part_one(grid: &[Vec]) -> u32 { [INFO] [stdout] 153 ~ let mut owned_grid = grid.to_owned(); [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/bin/day_06.rs:169:25 [INFO] [stdout] | [INFO] [stdout] 169 | fn solve_part_two(grid: &Vec>) -> u32 { [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] 169 ~ fn solve_part_two(grid: &[Vec]) -> u32 { [INFO] [stdout] 170 | let mut count = 0; [INFO] [stdout] 171 ~ let mut mutated_grid = grid.to_owned(); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this loop could be written as a `while let` loop [INFO] [stdout] --> src/bin/day_06.rs:177:17 [INFO] [stdout] | [INFO] [stdout] 177 | / loop { [INFO] [stdout] 178 | | if let Some(pos) = explorer.next_pos() { [INFO] [stdout] 179 | | if explorer.is_invalid_pos(pos) { [INFO] [stdout] 180 | | explorer.switch_next_move(); [INFO] [stdout] ... | [INFO] [stdout] 192 | | } [INFO] [stdout] | |_________________^ help: try: `while let Some(pos) = explorer.next_pos() { .. }` [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: constants have by default a `'static` lifetime [INFO] [stdout] --> src/bin/day_08.rs:257:19 [INFO] [stdout] | [INFO] [stdout] 257 | const INPUT: &'static str = include_str!("../input/day_08.txt"); [INFO] [stdout] | -^^^^^^^---- help: consider removing `'static`: `&str` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_static_lifetimes [INFO] [stdout] = note: `#[warn(clippy::redundant_static_lifetimes)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: hiding a lifetime that's named elsewhere is confusing [INFO] [stdout] --> src/bin/day_06.rs:123:46 [INFO] [stdout] | [INFO] [stdout] 123 | fn from(data: &'a mut Vec>) -> GridExplorer { [INFO] [stdout] | -- ^^^^^^^^^^^^ the same lifetime is hidden here [INFO] [stdout] | | [INFO] [stdout] | the lifetime is named here [INFO] [stdout] | [INFO] [stdout] = help: the same lifetime is referred to in inconsistent ways, making the signature confusing [INFO] [stdout] = note: `#[warn(mismatched_lifetime_syntaxes)]` on by default [INFO] [stdout] help: consistently use `'a` [INFO] [stdout] | [INFO] [stdout] 123 | fn from(data: &'a mut Vec>) -> GridExplorer<'a> { [INFO] [stdout] | ++++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: empty line after doc comment [INFO] [stdout] --> src/bin/day_05.rs:7:1 [INFO] [stdout] | [INFO] [stdout] 7 | / /// TBC [INFO] [stdout] 8 | | [INFO] [stdout] | |_^ [INFO] [stdout] ... [INFO] [stdout] 16 | use std::cmp::Ordering; [INFO] [stdout] | - the comment documents this `use` import [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#empty_line_after_doc_comments [INFO] [stdout] = note: `#[warn(clippy::empty_line_after_doc_comments)]` on by default [INFO] [stdout] = help: if the empty line is unintentional, remove it [INFO] [stdout] help: if the comment should document the crate use an inner doc comment [INFO] [stdout] | [INFO] [stdout] 1 ~ //! Commentary [INFO] [stdout] 2 ~ //! [INFO] [stdout] 3 ~ //! Once again, I was overly eager to practice my DFS seeing that this was clearly could be a graph [INFO] [stdout] 4 ~ //! problem describing the relationships between pages and their prequisites. Before I could end up [INFO] [stdout] 5 ~ //! writing the Topological Sort though, I realised that there was much simpler way given the [INFO] [stdout] 6 ~ //! constraints of this graph. [INFO] [stdout] 7 ~ //! TBC [INFO] [stdout] | [INFO] [stdout] help: if the documentation should include the empty line include it in the comment [INFO] [stdout] | [INFO] [stdout] 8 | /// [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: constants have by default a `'static` lifetime [INFO] [stdout] --> src/bin/day_05.rs:109:19 [INFO] [stdout] | [INFO] [stdout] 109 | const INPUT: &'static str = include_str!("../input/day_05.txt"); [INFO] [stdout] | -^^^^^^^---- help: consider removing `'static`: `&str` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_static_lifetimes [INFO] [stdout] = note: `#[warn(clippy::redundant_static_lifetimes)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:9:5 [INFO] [stdout] | [INFO] [stdout] 9 | /// antennas, where each entry maps the antenna type, e.g. 'A', to a Vec of antenna positions. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] = note: `#[warn(clippy::doc_lazy_continuation)]` on by default [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 9 | /// antennas, where each entry maps the antenna type, e.g. 'A', to a Vec of antenna positions. [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:10:5 [INFO] [stdout] | [INFO] [stdout] 10 | /// Actually, all we need is a Vec>, without the identifier for the antenna type. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 10 | /// Actually, all we need is a Vec>, without the identifier for the antenna type. [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:11:5 [INFO] [stdout] | [INFO] [stdout] 11 | /// However, including the antenna type actually makes it easier to aggregate the data in one pass. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 11 | /// However, including the antenna type actually makes it easier to aggregate the data in one pass. [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:12:5 [INFO] [stdout] | [INFO] [stdout] 12 | /// I eventually called this HashMap 'antenna_groups'. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 12 | /// I eventually called this HashMap 'antenna_groups'. [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:15:5 [INFO] [stdout] | [INFO] [stdout] 15 | /// own it, but turns out it's a bad idea. Assuming that I want to encapsulate the data, I would use [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 15 | /// own it, but turns out it's a bad idea. Assuming that I want to encapsulate the data, I would use [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:16:5 [INFO] [stdout] | [INFO] [stdout] 16 | /// a getter to return a reference to 'antenna_groups'. But this would mean that my getter method [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 16 | /// a getter to return a reference to 'antenna_groups'. But this would mean that my getter method [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:17:5 [INFO] [stdout] | [INFO] [stdout] 17 | /// would need to borrow the entire Grid struct to read 'antenna_groups'. In turn, this would deny [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 17 | /// would need to borrow the entire Grid struct to read 'antenna_groups'. In turn, this would deny [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:18:5 [INFO] [stdout] | [INFO] [stdout] 18 | /// me a mutable ref to update state in the Grid struct. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 18 | /// me a mutable ref to update state in the Grid struct. [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:30:5 [INFO] [stdout] | [INFO] [stdout] 30 | /// `is_next_pos_in_bounds`, made the assumption that we only move one sqaure at a time. This is [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 30 | /// `is_next_pos_in_bounds`, made the assumption that we only move one sqaure at a time. This is [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:31:5 [INFO] [stdout] | [INFO] [stdout] 31 | /// a valid assumption in many grid exploration problems, but not here. In hindsight, it was a poor [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 31 | /// a valid assumption in many grid exploration problems, but not here. In hindsight, it was a poor [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:32:5 [INFO] [stdout] | [INFO] [stdout] 32 | /// fit because we aren't exactly doing an exploration here. So I eventually removed the [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 32 | /// fit because we aren't exactly doing an exploration here. So I eventually removed the [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:33:5 [INFO] [stdout] | [INFO] [stdout] 33 | /// `is_next_pos_in_bounds` fn. I could have refactored it, if not for the next learning point, [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 33 | /// `is_next_pos_in_bounds` fn. I could have refactored it, if not for the next learning point, [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:34:5 [INFO] [stdout] | [INFO] [stdout] 34 | /// which is about issues with integer types. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 34 | /// which is about issues with integer types. [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:37:5 [INFO] [stdout] | [INFO] [stdout] 37 | /// TLDR: I think for purposes of this challenge, it makes thing so much easier to use casting and [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 37 | /// TLDR: I think for purposes of this challenge, it makes thing so much easier to use casting and [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:38:5 [INFO] [stdout] | [INFO] [stdout] 38 | /// accept that it is fine for the nature of this input. We can still be aware with the limits of [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 38 | /// accept that it is fine for the nature of this input. We can still be aware with the limits of [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:39:5 [INFO] [stdout] | [INFO] [stdout] 39 | /// our code. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 39 | /// our code. [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:49:5 [INFO] [stdout] | [INFO] [stdout] 49 | /// value is too big to fit into isize (e.g. because the value is close to usize::MAX), an overflow [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 49 | /// value is too big to fit into isize (e.g. because the value is close to usize::MAX), an overflow [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:50:5 [INFO] [stdout] | [INFO] [stdout] 50 | /// will silently happen, resulting in a negative number. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 50 | /// will silently happen, resulting in a negative number. [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:51:5 [INFO] [stdout] | [INFO] [stdout] 51 | /// Solution: Perform a range check before casting, or use TryFrom. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 51 | /// Solution: Perform a range check before casting, or use TryFrom. [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:53:5 [INFO] [stdout] | [INFO] [stdout] 53 | /// silently wrapping around (depending on which mode). [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 53 | /// silently wrapping around (depending on which mode). [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:54:5 [INFO] [stdout] | [INFO] [stdout] 54 | /// Solution: Using checked arithmetic, e.g. `checked_add`, or other similar methods. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 54 | /// Solution: Using checked arithmetic, e.g. `checked_add`, or other similar methods. [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:56:5 [INFO] [stdout] | [INFO] [stdout] 56 | /// reinterpreted into a (very large) `usize` which is incorrect (sometimes referred to as [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 56 | /// reinterpreted into a (very large) `usize` which is incorrect (sometimes referred to as [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:57:5 [INFO] [stdout] | [INFO] [stdout] 57 | /// wraparound). [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 57 | /// wraparound). [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:58:5 [INFO] [stdout] | [INFO] [stdout] 58 | /// Solution: Perform a check before casting, or use TryFrom. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 58 | /// Solution: Perform a check before casting, or use TryFrom. [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:67:5 [INFO] [stdout] | [INFO] [stdout] 67 | /// was to start the inner loop at index 1 greater than the outer loop, to ensure that we would not [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 67 | /// was to start the inner loop at index 1 greater than the outer loop, to ensure that we would not [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:68:5 [INFO] [stdout] | [INFO] [stdout] 68 | /// repeat the same combination. This had the downside of having to repeat some code twice, since [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 68 | /// repeat the same combination. This had the downside of having to repeat some code twice, since [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:69:5 [INFO] [stdout] | [INFO] [stdout] 69 | /// each combination of `tower_a` and `tower_b` can appear in two separate permutations (i.e. the [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 69 | /// each combination of `tower_a` and `tower_b` can appear in two separate permutations (i.e. the [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:70:5 [INFO] [stdout] | [INFO] [stdout] 70 | /// antinode for `tower_a` due to `tower_b` and vice versa). The second way to actually iterate [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 70 | /// antinode for `tower_a` due to `tower_b` and vice versa). The second way to actually iterate [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:71:5 [INFO] [stdout] | [INFO] [stdout] 71 | /// through the entire array of antennas in the inner loop again, but add check for whether [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 71 | /// through the entire array of antennas in the inner loop again, but add check for whether [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:72:5 [INFO] [stdout] | [INFO] [stdout] 72 | /// `tower_a` != `tower_b`. Although this is less efficient, it is certainly more elegant, since [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 72 | /// `tower_a` != `tower_b`. Although this is less efficient, it is certainly more elegant, since [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:73:5 [INFO] [stdout] | [INFO] [stdout] 73 | /// all permutations are taken care of automatically. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 73 | /// all permutations are taken care of automatically. [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:76:5 [INFO] [stdout] | [INFO] [stdout] 76 | /// data type in Rust, but the concept of geometric (or Euclidean) vectors. What I did was to [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 76 | /// data type in Rust, but the concept of geometric (or Euclidean) vectors. What I did was to [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:77:5 [INFO] [stdout] | [INFO] [stdout] 77 | /// iterate through various examples to generalize a formula to calculate the antinodes, which was [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 77 | /// iterate through various examples to generalize a formula to calculate the antinodes, which was [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:78:5 [INFO] [stdout] | [INFO] [stdout] 78 | /// tedious to do on the fly. Instead, I learnt that you could use a Vector to model the [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 78 | /// tedious to do on the fly. Instead, I learnt that you could use a Vector to model the [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:79:5 [INFO] [stdout] | [INFO] [stdout] 79 | /// displacement from antenna A to antenna B (Vector A->B (aka from A to B) = B - A). Then it would [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 79 | /// displacement from antenna A to antenna B (Vector A->B (aka from A to B) = B - A). Then it would [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:80:5 [INFO] [stdout] | [INFO] [stdout] 80 | /// be a matter of applying the vector to the point B (or the negative to point A) to calculate the [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 80 | /// be a matter of applying the vector to the point B (or the negative to point A) to calculate the [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:81:5 [INFO] [stdout] | [INFO] [stdout] 81 | /// antinodes. An even easier method would be to double the Vector from the source antenna A, which [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 81 | /// antinodes. An even easier method would be to double the Vector from the source antenna A, which [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:82:5 [INFO] [stdout] | [INFO] [stdout] 82 | /// would give the antinode further from A. In part 2, we could transform the vector by a linearly [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 82 | /// would give the antinode further from A. In part 2, we could transform the vector by a linearly [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:83:5 [INFO] [stdout] | [INFO] [stdout] 83 | /// increasing scalar and apply it multiple times until we leave the grid to get the series of [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 83 | /// increasing scalar and apply it multiple times until we leave the grid to get the series of [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_08.rs:84:5 [INFO] [stdout] | [INFO] [stdout] 84 | /// antinodes. I think this is a much cleaner way to think about it. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 84 | /// antinodes. I think this is a much cleaner way to think about it. [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/bin/day_08.rs:212:25 [INFO] [stdout] | [INFO] [stdout] 212 | fn solve_part_one(grid: &Vec>) -> u32 { [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] 212 ~ fn solve_part_one(grid: &[Vec]) -> u32 { [INFO] [stdout] 213 ~ let mut explorer = GridExplorer::from(grid.to_owned()); [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/bin/day_08.rs:232:25 [INFO] [stdout] | [INFO] [stdout] 232 | fn solve_part_two(grid: &Vec>) -> u32 { [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] 232 ~ fn solve_part_two(grid: &[Vec]) -> u32 { [INFO] [stdout] 233 ~ let mut explorer = GridExplorer::from(grid.to_owned()); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_07.rs:8:5 [INFO] [stdout] | [INFO] [stdout] 8 | /// Really learning to appreciate the Slice API in Rust. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] = note: `#[warn(clippy::doc_lazy_continuation)]` on by default [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 8 | /// Really learning to appreciate the Slice API in Rust. [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_07.rs:11:5 [INFO] [stdout] | [INFO] [stdout] 11 | /// for a combination check on whether there is any previous result and how to proceed with the [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 11 | /// for a combination check on whether there is any previous result and how to proceed with the [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_07.rs:12:5 [INFO] [stdout] | [INFO] [stdout] 12 | /// operation. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 12 | /// operation. [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_07.rs:15:5 [INFO] [stdout] | [INFO] [stdout] 15 | /// simple but midway I struggled with something more tricky like the length of `results` Vec. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 15 | /// simple but midway I struggled with something more tricky like the length of `results` Vec. [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_07.rs:16:5 [INFO] [stdout] | [INFO] [stdout] 16 | /// I think using a results Vec simplified certain things but threw me off in this way. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 16 | /// I think using a results Vec simplified certain things but threw me off in this way. [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_07.rs:17:5 [INFO] [stdout] | [INFO] [stdout] 17 | /// TODO, I wonder how others modelled this thing. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 17 | /// TODO, I wonder how others modelled this thing. [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: length comparison to zero [INFO] [stdout] --> src/bin/day_07.rs:53:8 [INFO] [stdout] | [INFO] [stdout] 53 | if nums.len() == 0 { [INFO] [stdout] | ^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `nums.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: writing `&Vec` instead of `&[_]` involves a new object where a slice will do [INFO] [stdout] --> src/bin/day_07.rs:79:26 [INFO] [stdout] | [INFO] [stdout] 79 | fn solve_part_one(tasks: &Vec<(i64, Vec)>) -> 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] = note: `#[warn(clippy::ptr_arg)]` on by default [INFO] [stdout] help: change this to [INFO] [stdout] | [INFO] [stdout] 79 - fn solve_part_one(tasks: &Vec<(i64, Vec)>) -> i64 { [INFO] [stdout] 79 + fn solve_part_one(tasks: &[(i64, Vec)]) -> i64 { [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/bin/day_07.rs:91:26 [INFO] [stdout] | [INFO] [stdout] 91 | fn solve_part_two(tasks: &Vec<(i64, Vec)>) -> 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] 91 - fn solve_part_two(tasks: &Vec<(i64, Vec)>) -> i64 { [INFO] [stdout] 91 + fn solve_part_two(tasks: &[(i64, Vec)]) -> i64 { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: empty line after doc comment [INFO] [stdout] --> src/bin/day_07.rs:17:1 [INFO] [stdout] | [INFO] [stdout] 17 | / /// TODO, I wonder how others modelled this thing. [INFO] [stdout] 18 | | [INFO] [stdout] | |_^ [INFO] [stdout] 19 | fn parse_input(input: &str) -> Vec<(i64, Vec)> { [INFO] [stdout] | -------------- the comment documents this function [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#empty_line_after_doc_comments [INFO] [stdout] = note: `#[warn(clippy::empty_line_after_doc_comments)]` on by default [INFO] [stdout] = help: if the empty line is unintentional, remove it [INFO] [stdout] help: if the comment should document the crate use an inner doc comment [INFO] [stdout] | [INFO] [stdout] 1 ~ //! # Commentary [INFO] [stdout] 2 ~ //! [INFO] [stdout] 3 ~ //! Instinctively, I reached for DFS. Luckily, it didn't seem to be over-engineered for a variable [INFO] [stdout] 4 ~ //! number of operators because surely enough, in part 2, they asked to add another operator. [INFO] [stdout] 5 ~ //! [INFO] [stdout] 6 ~ //! # Things I tried and learnt [INFO] [stdout] 7 ~ //! - Using slices is a memory-efficient way of tracking the remaining elements in the array. [INFO] [stdout] 8 ~ //! Really learning to appreciate the Slice API in Rust. [INFO] [stdout] 9 ~ //! [INFO] [stdout] 10 ~ //! - Using a `match` statement is an elegant way to handle the various operations. It also helps [INFO] [stdout] 11 ~ //! for a combination check on whether there is any previous result and how to proceed with the [INFO] [stdout] 12 ~ //! operation. [INFO] [stdout] 13 ~ //! [INFO] [stdout] 14 ~ //! - The terminal condition for DFS should be when there are no more nums to process, it seems [INFO] [stdout] 15 ~ //! simple but midway I struggled with something more tricky like the length of `results` Vec. [INFO] [stdout] 16 ~ //! I think using a results Vec simplified certain things but threw me off in this way. [INFO] [stdout] 17 ~ //! TODO, I wonder how others modelled this thing. [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: constants have by default a `'static` lifetime [INFO] [stdout] --> src/bin/day_07.rs:106:19 [INFO] [stdout] | [INFO] [stdout] 106 | const INPUT: &'static str = include_str!("../input/day_07.txt"); [INFO] [stdout] | -^^^^^^^---- help: consider removing `'static`: `&str` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_static_lifetimes [INFO] [stdout] = note: `#[warn(clippy::redundant_static_lifetimes)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: empty line after doc comment [INFO] [stdout] --> src/bin/day_09.rs:114:1 [INFO] [stdout] | [INFO] [stdout] 114 | / /// much simpler the code is. [INFO] [stdout] 115 | | [INFO] [stdout] | |_^ [INFO] [stdout] 116 | fn parse_input(input: &str) -> Vec> { [INFO] [stdout] | -------------- the comment documents this function [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#empty_line_after_doc_comments [INFO] [stdout] = note: `#[warn(clippy::empty_line_after_doc_comments)]` on by default [INFO] [stdout] = help: if the empty line is unintentional, remove it [INFO] [stdout] help: if the comment should document the crate use an inner doc comment [INFO] [stdout] | [INFO] [stdout] 3 ~ //! # Commentary [INFO] [stdout] 4 ~ //! [INFO] [stdout] 5 ~ //! My first thought was to build a vector representing the blocks, including the empty space. Then, [INFO] [stdout] 6 ~ //! I would use the two pointer technique and process the blocks from front and back, swapping items [INFO] [stdout] 7 ~ //! as needed. The tradeoff is that it is space inefficient, as every "empty" slot would occupy [INFO] [stdout] 8 ~ //! memory that would eventually be redundant. To optimize this, I thought of: [INFO] [stdout] 9 ~ //! 1) maintaining counters to know which items have been processed instead of adding empty slots. [INFO] [stdout] 10 ~ //! (I.e. instead of the data structure representing empty slots for you, you use an abstraction to [INFO] [stdout] 11 ~ //! track it numerically and only append items with ID to the vector). This would be a lot more [INFO] [stdout] 12 ~ //! tedious though, as need variables to compare each block of empty space in the front, to each [INFO] [stdout] 13 ~ //! block of numbers in the back, trying to fit them, calculating the difference where there is a [INFO] [stdout] 14 ~ //! mismatch, and saving the difference for the subsequent set of blocks to be processed. I decided [INFO] [stdout] 15 ~ //! against this eventually. [INFO] [stdout] 16 ~ //! 2) using a different data structure, which would allow me to save memory on empty slots. It [INFO] [stdout] 17 ~ //! crossed my mind to use a doubly-linked list, with certain nodes representing free space as a [INFO] [stdout] 18 ~ //! variable in its data. It would also be faster to build than a vector, since I coulld append any [INFO] [stdout] 19 ~ //! number of elements to the back without triggering memory reallocation (which would be a problem [INFO] [stdout] 20 ~ //! in this case given that I cannot pre-allocate the vector size without knowing concretely the [INFO] [stdout] 21 ~ //! number of items). However, after reading up on the LinkedList that comes with Rust, I was [INFO] [stdout] 22 ~ //! disappointed to find that it not allow me to append or remove nodes easily from the middle of [INFO] [stdout] 23 ~ //! the list, which was exactly what I wanted. Also, there doesn't seem to be a way to iterate from [INFO] [stdout] 24 ~ //! the back of the list? Which means I cannot implement the two-pointer technique. [INFO] [stdout] 25 ~ //! Finally, it seemed like I was back to the initial "naive" solution. [INFO] [stdout] 26 ~ //! [INFO] [stdout] 27 ~ //! # Things I tried and learnt [INFO] [stdout] 28 ~ //! - How to read a single line of text. I was using lines().take(1) in conjunction with .flat_map() [INFO] [stdout] 29 ~ //! to flatten an iterator of lines, with only 1 line, into a single unit and apply .map() to [INFO] [stdout] 30 ~ //! extract the chars from the unit. If this sounds like a mouthful, it truly is, because, to my [INFO] [stdout] 31 ~ //! horror, I realised how silly of me not to directly call .chars() method on the original &str. [INFO] [stdout] 32 ~ //! Urgh! [INFO] [stdout] 33 ~ //! [INFO] [stdout] 34 ~ //! - Iterator operators. In addition to over-engineering the lines() iterator as mentioned, I also [INFO] [stdout] 35 ~ //! experimented with various iterators to compute the checksum. I debated between using .filter(), [INFO] [stdout] 36 ~ //! or its nicer cousin .filter_map() which will automatically unwrap the Option that I have. [INFO] [stdout] 37 ~ //! The downside to both of them though is that they will iterate through the entire Vec, even [INFO] [stdout] 38 ~ //! though we know that after some point all which remain are None (empty slots). So in this case, [INFO] [stdout] 39 ~ //! .take_while() is more efficient because it stops at the first None, ignoring the rest. [INFO] [stdout] 40 ~ //! [INFO] [stdout] 41 ~ //! - Drawbacks of using 'continue' statements in a single loop - part 1. Typically, I'm used to test [INFO] [stdout] 42 ~ //! for a single predicate and 'continue' the loop otherwise, like so: [INFO] [stdout] 43 ~ //! ``` [INFO] [stdout] 44 ~ //! // within the loop [INFO] [stdout] 45 ~ //! if file_blocks[front].is_some() { [INFO] [stdout] 46 ~ //! front += 1; [INFO] [stdout] 47 ~ //! continue; [INFO] [stdout] 48 ~ //! } [INFO] [stdout] 49 ~ //! if file_blocks[back].is_none() { [INFO] [stdout] 50 ~ //! back -= 1; [INFO] [stdout] 51 ~ //! continue; [INFO] [stdout] 52 ~ //! } [INFO] [stdout] 53 ~ //! ``` [INFO] [stdout] 54 ~ //! Thinking about it, however, while this looks more aesthetically pleasing, it is less rigorous [INFO] [stdout] 55 ~ //! when formulating the logic, because there is an implied 'else' clause that isn't explicitly [INFO] [stdout] 56 ~ //! spelt-out, and may lead to missing conditions. Not in this situation. But perhaps in more [INFO] [stdout] 57 ~ //! complicated ones. Worse still, if you forget the `continue` statement, you are just setting [INFO] [stdout] 58 ~ //! yourself up for nasty bugs. So in this day's challenge, I wrote it using an `else-if` statement [INFO] [stdout] 59 ~ //! which makes it 100% clear that these conditions are indeed mutually exclusive and exhaustive. [INFO] [stdout] 60 ~ //! There is no need for the `continue` statement either. Also, it's not as nested as I originally [INFO] [stdout] 61 ~ //! visualised (merely an `else-if` and `else`) so perhaps this style might be growing on me. [INFO] [stdout] 62 ~ //! [INFO] [stdout] 63 ~ //! - Drawbacks of using 'continue' statements - part 2. Part 2 was an even bigger problem in [INFO] [stdout] 64 ~ //! trying to use the style of a single-loop, and the 'continue' statement. For one, it became [INFO] [stdout] 65 ~ //! unavoidable to use a nested-while loop, when we are dealing with multiple pointers (front and [INFO] [stdout] 66 ~ //! back) to represent a block. Let's call the parent left/right pointers 'boundary pointers', they [INFO] [stdout] 67 ~ //! represent the boundary of the processed and unprocessed blocks. However, in part 2, each pointer [INFO] [stdout] 68 ~ //! actually represents a pair of sub-pointers (front and back), that represent the length of a [INFO] [stdout] 69 ~ //! block. The sub-pointers need to be repeatedly incremented or decremented independent of the [INFO] [stdout] 70 ~ //! main pointer, so you have no choice but to write an inner while loop like so. [INFO] [stdout] 71 ~ //! [INFO] [stdout] 72 ~ //! ``` [INFO] [stdout] 73 ~ //! let (mut file_back, mut file_front) = (right, right); [INFO] [stdout] 74 ~ //! while file_front > 0 && blocks[file_front] == blocks[file_front - 1] { [INFO] [stdout] 75 ~ //! file_front -= 1; [INFO] [stdout] 76 ~ //! } [INFO] [stdout] 77 ~ //! ``` [INFO] [stdout] 78 ~ //! Working with sub-pointers becomes even more tricky because you need to ensure that: [INFO] [stdout] 79 ~ //! - Neither of the pointers goes out of bounds (in the main loop, you only check the bounds of [INFO] [stdout] 80 ~ //! parent left and right pointers). [INFO] [stdout] 81 ~ //! - The parent pointers need to be advanced BEYOND the sub-pointers when you are done with a [INFO] [stdout] 82 ~ //! block. Concretely, this means setting it to something like `file_front + 1` while of course [INFO] [stdout] 83 ~ //! checking that it stays within bounds. [INFO] [stdout] 84 ~ //! There must be a better way, and hence my next learning point: [INFO] [stdout] 85 ~ //! [INFO] [stdout] 86 ~ //! - It is MUCH MUCH easier to represent a block using a starting ponter and length. I briefly [INFO] [stdout] 87 ~ //! alluded to this fact when saying that the sub-pointers (front and back) are needed to represent [INFO] [stdout] 88 ~ //! the LENGTH of the block. After referencing the solution of a friend, I realised that I had [INFO] [stdout] 89 ~ //! chosen a cumbersome abstraction. In fact, Rust has already solved this problem and given us a [INFO] [stdout] 90 ~ //! best practice in the form of slices, which are stored under the hood as a starting pointer and [INFO] [stdout] 91 ~ //! a length. This makes it so much easier to: [INFO] [stdout] 92 ~ //! - Compare the length, you literally compare two values, [INFO] [stdout] 93 ~ //! - Iterate over blocks, you literally iterate over starting pointers [INFO] [stdout] 94 ~ //! - Prevent out of bounds, since you never increment pointers that could potentially go out of [INFO] [stdout] 95 ~ //! bounds, you only iterate until the last pointer (which you don't even to do manually). [INFO] [stdout] 96 ~ //! Then I also started to see why I potentially ran into problems using 'while' loops to increment [INFO] [stdout] 97 ~ //! indices as per certain conditions. And this part from the Rust book finally made a lot more sense: [INFO] [stdout] 98 ~ //! [INFO] [stdout] 99 ~ //! "For example, if you changed the definition of the a array to have four elements but forgot to [INFO] [stdout] 100 ~ //! update the condition to while index < 4, the code would panic. It’s also slow, because the [INFO] [stdout] 101 ~ //! compiler adds runtime code to perform the conditional check of whether the index is within the [INFO] [stdout] 102 ~ //! bounds of the array on every iteration through the loop. ... [INFO] [stdout] 103 ~ //! Using the for loop, you wouldn’t need to remember to change any other code if you changed the [INFO] [stdout] 104 ~ //! number of values in the array, as you would with the method used in Listing 3-4. ... [INFO] [stdout] 105 ~ //! The safety and conciseness of for loops make them the most commonly used loop construct in Rust. [INFO] [stdout] 106 ~ //! Even in situations in which you want to run some code a certain number of times, as in the [INFO] [stdout] 107 ~ //! countdown example that used a while loop in Listing 3-3, most Rustaceans would use a for loop." [INFO] [stdout] 108 ~ //! https://doc.rust-lang.org/stable/book/ch03-05-control-flow.html [INFO] [stdout] 109 ~ //! [INFO] [stdout] 110 ~ //! At this risk of sounding cliched, I must say this is quite a paradigm shift. Instead relying too [INFO] [stdout] 111 ~ //! much on the two-pointer technique (which can be easily abused into four-pointers), we should be [INFO] [stdout] 112 ~ //! thinking in terms of iterators, which are less error-prone. [INFO] [stdout] 113 ~ //! To practice this, I solved Part Two once more using this new representation, and you can see how [INFO] [stdout] 114 ~ //! much simpler the code is. [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: constants have by default a `'static` lifetime [INFO] [stdout] --> src/bin/day_09.rs:282:19 [INFO] [stdout] | [INFO] [stdout] 282 | const INPUT: &'static str = include_str!("../input/day_09.txt"); [INFO] [stdout] | -^^^^^^^---- help: consider removing `'static`: `&str` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_static_lifetimes [INFO] [stdout] = note: `#[warn(clippy::redundant_static_lifetimes)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: empty line after doc comment [INFO] [stdout] --> src/bin/day_04.rs:4:1 [INFO] [stdout] | [INFO] [stdout] 4 | / /// crossword word finder. [INFO] [stdout] 5 | | [INFO] [stdout] | |_^ [INFO] [stdout] 6 | fn parse_input(input: &str) -> Vec> { [INFO] [stdout] | -------------- the comment documents this function [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#empty_line_after_doc_comments [INFO] [stdout] = note: `#[warn(clippy::empty_line_after_doc_comments)]` on by default [INFO] [stdout] = help: if the empty line is unintentional, remove it [INFO] [stdout] help: if the comment should document the crate use an inner doc comment [INFO] [stdout] | [INFO] [stdout] 1 ~ //! Commentary [INFO] [stdout] 2 ~ //! [INFO] [stdout] 3 ~ //! This became an excuse for me to practice my DFS. With the result being an over-engineered [INFO] [stdout] 4 ~ //! crossword word finder. [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: constants have by default a `'static` lifetime [INFO] [stdout] --> src/bin/day_04.rs:93:19 [INFO] [stdout] | [INFO] [stdout] 93 | const INPUT: &'static str = include_str!("../input/day_04.txt"); [INFO] [stdout] | -^^^^^^^---- help: consider removing `'static`: `&str` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_static_lifetimes [INFO] [stdout] = note: `#[warn(clippy::redundant_static_lifetimes)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_05.rs:11:5 [INFO] [stdout] | [INFO] [stdout] 11 | /// graph is acyclic). Otherwise the list of rules is invalid and the whole problem falls apart. So [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] = note: `#[warn(clippy::doc_lazy_continuation)]` on by default [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 11 | /// graph is acyclic). Otherwise the list of rules is invalid and the whole problem falls apart. So [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_05.rs:12:5 [INFO] [stdout] | [INFO] [stdout] 12 | /// we can skip this check. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 12 | /// we can skip this check. [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_05.rs:14:5 [INFO] [stdout] | [INFO] [stdout] 14 | /// is an explicit rule for every single preq-to-target relationship. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 14 | /// is an explicit rule for every single preq-to-target relationship. [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_05.rs:15:5 [INFO] [stdout] | [INFO] [stdout] 15 | /// TODO: it seems like the term for this might be a Transitive Closure, to check [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 15 | /// TODO: it seems like the term for this might be a Transitive Closure, to check [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: use of `or_insert` to construct default value [INFO] [stdout] --> src/bin/day_05.rs:30:52 [INFO] [stdout] | [INFO] [stdout] 30 | let entry = dep_adj_list.entry(source).or_insert(Vec::new()); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_or_default [INFO] [stdout] = note: `#[warn(clippy::unwrap_or_default)]` 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/bin/day_05.rs:45:34 [INFO] [stdout] | [INFO] [stdout] 45 | fn is_valid_task_path(task_path: &Vec, dep_adj_list: &HashMap>) -> 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] 45 - fn is_valid_task_path(task_path: &Vec, dep_adj_list: &HashMap>) -> bool { [INFO] [stdout] 45 + fn is_valid_task_path(task_path: &[u32], dep_adj_list: &HashMap>) -> bool { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `contains()` instead of `iter().any()` is more efficient [INFO] [stdout] --> src/bin/day_05.rs:52:17 [INFO] [stdout] | [INFO] [stdout] 52 | if !known_destinations.iter().any(|&t| t == dest) { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `known_destinations.contains(&dest)` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_contains [INFO] [stdout] = note: `#[warn(clippy::manual_contains)]` 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/bin/day_05.rs:63:38 [INFO] [stdout] | [INFO] [stdout] 63 | fn to_reordered_task_path(task_path: &Vec, adj_list: &HashMap>) -> 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] 63 - fn to_reordered_task_path(task_path: &Vec, adj_list: &HashMap>) -> Vec { [INFO] [stdout] 63 + fn to_reordered_task_path(task_path: &[u32], adj_list: &HashMap>) -> Vec { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/bin/day_05.rs:70:36 [INFO] [stdout] | [INFO] [stdout] 70 | let v_dests = adj_list.get(&v); [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: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/bin/day_05.rs:71:36 [INFO] [stdout] | [INFO] [stdout] 71 | let w_dests = adj_list.get(&w); [INFO] [stdout] | ^^ help: change this to: `w` [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: writing `&Vec` instead of `&[_]` involves a new object where a slice will do [INFO] [stdout] --> src/bin/day_05.rs:89:65 [INFO] [stdout] | [INFO] [stdout] 89 | fn solve_part_one(dep_adj_list: &HashMap>, tasks: &Vec>) -> u32 { [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] 89 - fn solve_part_one(dep_adj_list: &HashMap>, tasks: &Vec>) -> u32 { [INFO] [stdout] 89 + fn solve_part_one(dep_adj_list: &HashMap>, tasks: &[Vec]) -> u32 { [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/bin/day_05.rs:97:65 [INFO] [stdout] | [INFO] [stdout] 97 | fn solve_part_two(dep_adj_list: &HashMap>, tasks: &Vec>) -> u32 { [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] 97 - fn solve_part_two(dep_adj_list: &HashMap>, tasks: &Vec>) -> u32 { [INFO] [stdout] 97 + fn solve_part_two(dep_adj_list: &HashMap>, tasks: &[Vec]) -> u32 { [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/bin/day_04.rs:67:25 [INFO] [stdout] | [INFO] [stdout] 67 | fn solve_part_two(grid: &Vec>) -> u32 { [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] 67 - fn solve_part_two(grid: &Vec>) -> u32 { [INFO] [stdout] 67 + fn solve_part_two(grid: &[Vec]) -> u32 { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_07.rs:8:5 [INFO] [stdout] | [INFO] [stdout] 8 | /// Really learning to appreciate the Slice API in Rust. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] = note: `#[warn(clippy::doc_lazy_continuation)]` on by default [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 8 | /// Really learning to appreciate the Slice API in Rust. [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_07.rs:11:5 [INFO] [stdout] | [INFO] [stdout] 11 | /// for a combination check on whether there is any previous result and how to proceed with the [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 11 | /// for a combination check on whether there is any previous result and how to proceed with the [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_07.rs:12:5 [INFO] [stdout] | [INFO] [stdout] 12 | /// operation. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 12 | /// operation. [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_07.rs:15:5 [INFO] [stdout] | [INFO] [stdout] 15 | /// simple but midway I struggled with something more tricky like the length of `results` Vec. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 15 | /// simple but midway I struggled with something more tricky like the length of `results` Vec. [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_07.rs:16:5 [INFO] [stdout] | [INFO] [stdout] 16 | /// I think using a results Vec simplified certain things but threw me off in this way. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 16 | /// I think using a results Vec simplified certain things but threw me off in this way. [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_07.rs:17:5 [INFO] [stdout] | [INFO] [stdout] 17 | /// TODO, I wonder how others modelled this thing. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 17 | /// TODO, I wonder how others modelled this thing. [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: length comparison to zero [INFO] [stdout] --> src/bin/day_07.rs:53:8 [INFO] [stdout] | [INFO] [stdout] 53 | if nums.len() == 0 { [INFO] [stdout] | ^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `nums.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: writing `&Vec` instead of `&[_]` involves a new object where a slice will do [INFO] [stdout] --> src/bin/day_07.rs:79:26 [INFO] [stdout] | [INFO] [stdout] 79 | fn solve_part_one(tasks: &Vec<(i64, Vec)>) -> 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] = note: `#[warn(clippy::ptr_arg)]` on by default [INFO] [stdout] help: change this to [INFO] [stdout] | [INFO] [stdout] 79 - fn solve_part_one(tasks: &Vec<(i64, Vec)>) -> i64 { [INFO] [stdout] 79 + fn solve_part_one(tasks: &[(i64, Vec)]) -> i64 { [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/bin/day_07.rs:91:26 [INFO] [stdout] | [INFO] [stdout] 91 | fn solve_part_two(tasks: &Vec<(i64, Vec)>) -> 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] 91 - fn solve_part_two(tasks: &Vec<(i64, Vec)>) -> i64 { [INFO] [stdout] 91 + fn solve_part_two(tasks: &[(i64, Vec)]) -> i64 { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:10:5 [INFO] [stdout] | [INFO] [stdout] 10 | /// (I.e. instead of the data structure representing empty slots for you, you use an abstraction to [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] = note: `#[warn(clippy::doc_lazy_continuation)]` on by default [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 10 | /// (I.e. instead of the data structure representing empty slots for you, you use an abstraction to [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:11:5 [INFO] [stdout] | [INFO] [stdout] 11 | /// track it numerically and only append items with ID to the vector). This would be a lot more [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 11 | /// track it numerically and only append items with ID to the vector). This would be a lot more [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:12:5 [INFO] [stdout] | [INFO] [stdout] 12 | /// tedious though, as need variables to compare each block of empty space in the front, to each [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 12 | /// tedious though, as need variables to compare each block of empty space in the front, to each [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:13:5 [INFO] [stdout] | [INFO] [stdout] 13 | /// block of numbers in the back, trying to fit them, calculating the difference where there is a [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 13 | /// block of numbers in the back, trying to fit them, calculating the difference where there is a [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:14:5 [INFO] [stdout] | [INFO] [stdout] 14 | /// mismatch, and saving the difference for the subsequent set of blocks to be processed. I decided [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 14 | /// mismatch, and saving the difference for the subsequent set of blocks to be processed. I decided [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:15:5 [INFO] [stdout] | [INFO] [stdout] 15 | /// against this eventually. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 15 | /// against this eventually. [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:17:5 [INFO] [stdout] | [INFO] [stdout] 17 | /// crossed my mind to use a doubly-linked list, with certain nodes representing free space as a [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 17 | /// crossed my mind to use a doubly-linked list, with certain nodes representing free space as a [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:18:5 [INFO] [stdout] | [INFO] [stdout] 18 | /// variable in its data. It would also be faster to build than a vector, since I coulld append any [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 18 | /// variable in its data. It would also be faster to build than a vector, since I coulld append any [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:19:5 [INFO] [stdout] | [INFO] [stdout] 19 | /// number of elements to the back without triggering memory reallocation (which would be a problem [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 19 | /// number of elements to the back without triggering memory reallocation (which would be a problem [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:20:5 [INFO] [stdout] | [INFO] [stdout] 20 | /// in this case given that I cannot pre-allocate the vector size without knowing concretely the [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 20 | /// in this case given that I cannot pre-allocate the vector size without knowing concretely the [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:21:5 [INFO] [stdout] | [INFO] [stdout] 21 | /// number of items). However, after reading up on the LinkedList that comes with Rust, I was [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 21 | /// number of items). However, after reading up on the LinkedList that comes with Rust, I was [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:22:5 [INFO] [stdout] | [INFO] [stdout] 22 | /// disappointed to find that it not allow me to append or remove nodes easily from the middle of [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 22 | /// disappointed to find that it not allow me to append or remove nodes easily from the middle of [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:23:5 [INFO] [stdout] | [INFO] [stdout] 23 | /// the list, which was exactly what I wanted. Also, there doesn't seem to be a way to iterate from [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 23 | /// the list, which was exactly what I wanted. Also, there doesn't seem to be a way to iterate from [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:24:5 [INFO] [stdout] | [INFO] [stdout] 24 | /// the back of the list? Which means I cannot implement the two-pointer technique. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 24 | /// the back of the list? Which means I cannot implement the two-pointer technique. [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:25:5 [INFO] [stdout] | [INFO] [stdout] 25 | /// Finally, it seemed like I was back to the initial "naive" solution. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 25 | /// Finally, it seemed like I was back to the initial "naive" solution. [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:29:5 [INFO] [stdout] | [INFO] [stdout] 29 | /// to flatten an iterator of lines, with only 1 line, into a single unit and apply .map() to [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 29 | /// to flatten an iterator of lines, with only 1 line, into a single unit and apply .map() to [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:30:5 [INFO] [stdout] | [INFO] [stdout] 30 | /// extract the chars from the unit. If this sounds like a mouthful, it truly is, because, to my [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 30 | /// extract the chars from the unit. If this sounds like a mouthful, it truly is, because, to my [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:31:5 [INFO] [stdout] | [INFO] [stdout] 31 | /// horror, I realised how silly of me not to directly call .chars() method on the original &str. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 31 | /// horror, I realised how silly of me not to directly call .chars() method on the original &str. [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:32:5 [INFO] [stdout] | [INFO] [stdout] 32 | /// Urgh! [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 32 | /// Urgh! [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:35:5 [INFO] [stdout] | [INFO] [stdout] 35 | /// experimented with various iterators to compute the checksum. I debated between using .filter(), [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 35 | /// experimented with various iterators to compute the checksum. I debated between using .filter(), [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:36:5 [INFO] [stdout] | [INFO] [stdout] 36 | /// or its nicer cousin .filter_map() which will automatically unwrap the Option that I have. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 36 | /// or its nicer cousin .filter_map() which will automatically unwrap the Option that I have. [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:37:5 [INFO] [stdout] | [INFO] [stdout] 37 | /// The downside to both of them though is that they will iterate through the entire Vec, even [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 37 | /// The downside to both of them though is that they will iterate through the entire Vec, even [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:38:5 [INFO] [stdout] | [INFO] [stdout] 38 | /// though we know that after some point all which remain are None (empty slots). So in this case, [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 38 | /// though we know that after some point all which remain are None (empty slots). So in this case, [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:39:5 [INFO] [stdout] | [INFO] [stdout] 39 | /// .take_while() is more efficient because it stops at the first None, ignoring the rest. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 39 | /// .take_while() is more efficient because it stops at the first None, ignoring the rest. [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:42:5 [INFO] [stdout] | [INFO] [stdout] 42 | /// for a single predicate and 'continue' the loop otherwise, like so: [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 42 | /// for a single predicate and 'continue' the loop otherwise, like so: [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:64:5 [INFO] [stdout] | [INFO] [stdout] 64 | /// trying to use the style of a single-loop, and the 'continue' statement. For one, it became [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 64 | /// trying to use the style of a single-loop, and the 'continue' statement. For one, it became [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:65:5 [INFO] [stdout] | [INFO] [stdout] 65 | /// unavoidable to use a nested-while loop, when we are dealing with multiple pointers (front and [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 65 | /// unavoidable to use a nested-while loop, when we are dealing with multiple pointers (front and [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:66:5 [INFO] [stdout] | [INFO] [stdout] 66 | /// back) to represent a block. Let's call the parent left/right pointers 'boundary pointers', they [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 66 | /// back) to represent a block. Let's call the parent left/right pointers 'boundary pointers', they [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:67:5 [INFO] [stdout] | [INFO] [stdout] 67 | /// represent the boundary of the processed and unprocessed blocks. However, in part 2, each pointer [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 67 | /// represent the boundary of the processed and unprocessed blocks. However, in part 2, each pointer [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:68:5 [INFO] [stdout] | [INFO] [stdout] 68 | /// actually represents a pair of sub-pointers (front and back), that represent the length of a [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 68 | /// actually represents a pair of sub-pointers (front and back), that represent the length of a [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:69:5 [INFO] [stdout] | [INFO] [stdout] 69 | /// block. The sub-pointers need to be repeatedly incremented or decremented independent of the [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 69 | /// block. The sub-pointers need to be repeatedly incremented or decremented independent of the [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:70:5 [INFO] [stdout] | [INFO] [stdout] 70 | /// main pointer, so you have no choice but to write an inner while loop like so. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 70 | /// main pointer, so you have no choice but to write an inner while loop like so. [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:80:5 [INFO] [stdout] | [INFO] [stdout] 80 | /// parent left and right pointers). [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 80 | /// parent left and right pointers). [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:82:5 [INFO] [stdout] | [INFO] [stdout] 82 | /// block. Concretely, this means setting it to something like `file_front + 1` while of course [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 82 | /// block. Concretely, this means setting it to something like `file_front + 1` while of course [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:83:5 [INFO] [stdout] | [INFO] [stdout] 83 | /// checking that it stays within bounds. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 83 | /// checking that it stays within bounds. [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:84:5 [INFO] [stdout] | [INFO] [stdout] 84 | /// There must be a better way, and hence my next learning point: [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 84 | /// There must be a better way, and hence my next learning point: [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:87:5 [INFO] [stdout] | [INFO] [stdout] 87 | /// alluded to this fact when saying that the sub-pointers (front and back) are needed to represent [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 87 | /// alluded to this fact when saying that the sub-pointers (front and back) are needed to represent [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:88:5 [INFO] [stdout] | [INFO] [stdout] 88 | /// the LENGTH of the block. After referencing the solution of a friend, I realised that I had [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 88 | /// the LENGTH of the block. After referencing the solution of a friend, I realised that I had [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:89:5 [INFO] [stdout] | [INFO] [stdout] 89 | /// chosen a cumbersome abstraction. In fact, Rust has already solved this problem and given us a [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 89 | /// chosen a cumbersome abstraction. In fact, Rust has already solved this problem and given us a [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:90:5 [INFO] [stdout] | [INFO] [stdout] 90 | /// best practice in the form of slices, which are stored under the hood as a starting pointer and [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 90 | /// best practice in the form of slices, which are stored under the hood as a starting pointer and [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:91:5 [INFO] [stdout] | [INFO] [stdout] 91 | /// a length. This makes it so much easier to: [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 91 | /// a length. This makes it so much easier to: [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:95:5 [INFO] [stdout] | [INFO] [stdout] 95 | /// bounds, you only iterate until the last pointer (which you don't even to do manually). [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 95 | /// bounds, you only iterate until the last pointer (which you don't even to do manually). [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:96:5 [INFO] [stdout] | [INFO] [stdout] 96 | /// Then I also started to see why I potentially ran into problems using 'while' loops to increment [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 96 | /// Then I also started to see why I potentially ran into problems using 'while' loops to increment [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/bin/day_09.rs:97:5 [INFO] [stdout] | [INFO] [stdout] 97 | /// indices as per certain conditions. And this part from the Rust book finally made a lot more sense: [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 97 | /// indices as per certain conditions. And this part from the Rust book finally made a lot more sense: [INFO] [stdout] | ++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this boolean expression can be simplified [INFO] [stdout] --> src/bin/day_09.rs:195:23 [INFO] [stdout] | [INFO] [stdout] 195 | while !(file_back < file_front) { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(file_back >= file_front)` [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] [stderr] Finished `dev` profile [unoptimized + debuginfo] target(s) in 5.26s [INFO] running `Command { std: "docker" "inspect" "f7432f10d0ad7e8306320e9ec456b8eb24f1bae7566f697bff36d1f9ac0aa86f", kill_on_drop: false }` [INFO] running `Command { std: "docker" "rm" "-f" "f7432f10d0ad7e8306320e9ec456b8eb24f1bae7566f697bff36d1f9ac0aa86f", kill_on_drop: false }` [INFO] [stdout] f7432f10d0ad7e8306320e9ec456b8eb24f1bae7566f697bff36d1f9ac0aa86f