[INFO] cloning repository https://github.com/Killer545537/RUST_DSA [INFO] running `Command { std: "git" "-c" "credential.helper=" "-c" "credential.helper=/workspace/cargo-home/bin/git-credential-null" "clone" "--bare" "https://github.com/Killer545537/RUST_DSA" "/workspace/cache/git-repos/https%3A%2F%2Fgithub.com%2FKiller545537%2FRUST_DSA", kill_on_drop: false }` [INFO] [stderr] Cloning into bare repository '/workspace/cache/git-repos/https%3A%2F%2Fgithub.com%2FKiller545537%2FRUST_DSA'... [INFO] running `Command { std: "git" "rev-parse" "HEAD", kill_on_drop: false }` [INFO] [stdout] ef5e4741be089362ce87cfdd5d8f7621bf6eded6 [INFO] linting Killer545537/RUST_DSA against nightly for clippy-nonminimal_bool-denied [INFO] running `Command { std: "git" "clone" "/workspace/cache/git-repos/https%3A%2F%2Fgithub.com%2FKiller545537%2FRUST_DSA" "/workspace/builds/worker-0-tc1/source", kill_on_drop: false }` [INFO] [stderr] Cloning into '/workspace/builds/worker-0-tc1/source'... [INFO] [stderr] done. [INFO] started tweaking git repo https://github.com/Killer545537/RUST_DSA [INFO] finished tweaking git repo https://github.com/Killer545537/RUST_DSA [INFO] tweaked toml for git repo https://github.com/Killer545537/RUST_DSA written to /workspace/builds/worker-0-tc1/source/Cargo.toml [INFO] validating manifest of git repo https://github.com/Killer545537/RUST_DSA 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/Killer545537/RUST_DSA 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-0-tc1/target:/opt/rustwide/target:rw,Z" "-v" "/var/lib/crater-agent-workspace/builds/worker-0-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] 712e40e9bd3902ef59460667acb9fc7f4edf8470e40c67e862d0b81137163f77 [INFO] running `Command { std: "docker" "start" "-a" "712e40e9bd3902ef59460667acb9fc7f4edf8470e40c67e862d0b81137163f77", kill_on_drop: false }` [INFO] running `Command { std: "docker" "inspect" "712e40e9bd3902ef59460667acb9fc7f4edf8470e40c67e862d0b81137163f77", kill_on_drop: false }` [INFO] running `Command { std: "docker" "rm" "-f" "712e40e9bd3902ef59460667acb9fc7f4edf8470e40c67e862d0b81137163f77", kill_on_drop: false }` [INFO] [stdout] 712e40e9bd3902ef59460667acb9fc7f4edf8470e40c67e862d0b81137163f77 [INFO] running `Command { std: "docker" "create" "-v" "/var/lib/crater-agent-workspace/builds/worker-0-tc1/target:/opt/rustwide/target:rw,Z" "-v" "/var/lib/crater-agent-workspace/builds/worker-0-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] dee7c2df55e94910f37fd1bc534bddfe806a8b8a09987ee6d6b0de56313c16be [INFO] running `Command { std: "docker" "start" "-a" "dee7c2df55e94910f37fd1bc534bddfe806a8b8a09987ee6d6b0de56313c16be", kill_on_drop: false }` [INFO] [stderr] Compiling thiserror v1.0.63 [INFO] [stderr] Checking either v1.13.0 [INFO] [stderr] Compiling syn v2.0.71 [INFO] [stderr] Checking itertools v0.13.0 [INFO] [stderr] Checking rayon v1.10.0 [INFO] [stderr] Compiling thiserror-impl v1.0.63 [INFO] [stderr] Checking Data_Structures_Algorithms v0.1.0 (/opt/rustwide/workdir) [INFO] [stdout] warning: unnecessary `>= y + 1` or `x - 1 >=` [INFO] [stdout] --> src/dynamic_programming.rs:850:27 [INFO] [stdout] | [INFO] [stdout] 850 | let take = if index + 1 <= length { //The length of the rod is index + 1 [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^ help: change it to: `index < length` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#int_plus_one [INFO] [stdout] = note: `#[warn(clippy::int_plus_one)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: empty line after doc comment [INFO] [stdout] --> src/binary_tress.rs:397:1 [INFO] [stdout] | [INFO] [stdout] 397 | / ///Make the tree to follow the property (left + right = value) [INFO] [stdout] 398 | | [INFO] [stdout] | |_^ [INFO] [stdout] 399 | pub fn children_sum_property(node: Option>>) { [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] [INFO] [stdout] [INFO] [stdout] warning: this is a decimal constant [INFO] [stdout] --> src/greedy.rs:377:35 [INFO] [stdout] | [INFO] [stdout] 377 | assert_eq!(platforms(vec![0900, 0940, 0950, 1100, 1500, 1800], vec![0910, 1200, 1120, 1130, 1900, 2000]), 3); [INFO] [stdout] | ^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#zero_prefixed_literal [INFO] [stdout] = note: `#[warn(clippy::zero_prefixed_literal)]` on by default [INFO] [stdout] help: if you mean to use a decimal constant, remove the `0` to avoid confusion [INFO] [stdout] | [INFO] [stdout] 377 - assert_eq!(platforms(vec![0900, 0940, 0950, 1100, 1500, 1800], vec![0910, 1200, 1120, 1130, 1900, 2000]), 3); [INFO] [stdout] 377 + assert_eq!(platforms(vec![900, 0940, 0950, 1100, 1500, 1800], vec![0910, 1200, 1120, 1130, 1900, 2000]), 3); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this is a decimal constant [INFO] [stdout] --> src/greedy.rs:377:41 [INFO] [stdout] | [INFO] [stdout] 377 | assert_eq!(platforms(vec![0900, 0940, 0950, 1100, 1500, 1800], vec![0910, 1200, 1120, 1130, 1900, 2000]), 3); [INFO] [stdout] | ^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#zero_prefixed_literal [INFO] [stdout] help: if you mean to use a decimal constant, remove the `0` to avoid confusion [INFO] [stdout] | [INFO] [stdout] 377 - assert_eq!(platforms(vec![0900, 0940, 0950, 1100, 1500, 1800], vec![0910, 1200, 1120, 1130, 1900, 2000]), 3); [INFO] [stdout] 377 + assert_eq!(platforms(vec![0900, 940, 0950, 1100, 1500, 1800], vec![0910, 1200, 1120, 1130, 1900, 2000]), 3); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this is a decimal constant [INFO] [stdout] --> src/greedy.rs:377:47 [INFO] [stdout] | [INFO] [stdout] 377 | assert_eq!(platforms(vec![0900, 0940, 0950, 1100, 1500, 1800], vec![0910, 1200, 1120, 1130, 1900, 2000]), 3); [INFO] [stdout] | ^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#zero_prefixed_literal [INFO] [stdout] help: if you mean to use a decimal constant, remove the `0` to avoid confusion [INFO] [stdout] | [INFO] [stdout] 377 - assert_eq!(platforms(vec![0900, 0940, 0950, 1100, 1500, 1800], vec![0910, 1200, 1120, 1130, 1900, 2000]), 3); [INFO] [stdout] 377 + assert_eq!(platforms(vec![0900, 0940, 950, 1100, 1500, 1800], vec![0910, 1200, 1120, 1130, 1900, 2000]), 3); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this is a decimal constant [INFO] [stdout] --> src/greedy.rs:377:77 [INFO] [stdout] | [INFO] [stdout] 377 | assert_eq!(platforms(vec![0900, 0940, 0950, 1100, 1500, 1800], vec![0910, 1200, 1120, 1130, 1900, 2000]), 3); [INFO] [stdout] | ^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#zero_prefixed_literal [INFO] [stdout] help: if you mean to use a decimal constant, remove the `0` to avoid confusion [INFO] [stdout] | [INFO] [stdout] 377 - assert_eq!(platforms(vec![0900, 0940, 0950, 1100, 1500, 1800], vec![0910, 1200, 1120, 1130, 1900, 2000]), 3); [INFO] [stdout] 377 + assert_eq!(platforms(vec![0900, 0940, 0950, 1100, 1500, 1800], vec![910, 1200, 1120, 1130, 1900, 2000]), 3); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this is a decimal constant [INFO] [stdout] --> src/greedy.rs:378:35 [INFO] [stdout] | [INFO] [stdout] 378 | assert_eq!(platforms(vec![0900, 1100, 1235], vec![1000, 1200, 1240]), 1); [INFO] [stdout] | ^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#zero_prefixed_literal [INFO] [stdout] help: if you mean to use a decimal constant, remove the `0` to avoid confusion [INFO] [stdout] | [INFO] [stdout] 378 - assert_eq!(platforms(vec![0900, 1100, 1235], vec![1000, 1200, 1240]), 1); [INFO] [stdout] 378 + assert_eq!(platforms(vec![900, 1100, 1235], vec![1000, 1200, 1240]), 1); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unnecessary `>= y + 1` or `x - 1 >=` [INFO] [stdout] --> src/dynamic_programming.rs:850:27 [INFO] [stdout] | [INFO] [stdout] 850 | let take = if index + 1 <= length { //The length of the rod is index + 1 [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^ help: change it to: `index < length` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#int_plus_one [INFO] [stdout] = note: `#[warn(clippy::int_plus_one)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: empty line after doc comment [INFO] [stdout] --> src/binary_tress.rs:397:1 [INFO] [stdout] | [INFO] [stdout] 397 | / ///Make the tree to follow the property (left + right = value) [INFO] [stdout] 398 | | [INFO] [stdout] | |_^ [INFO] [stdout] 399 | pub fn children_sum_property(node: Option>>) { [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] [INFO] [stdout] [INFO] [stdout] warning: unused variable: `coordinates` [INFO] [stdout] --> src/binary_search.rs:562:30 [INFO] [stdout] | [INFO] [stdout] 562 | pub fn minimize_max_distance(coordinates: &[f32], new_stations: i32) { //The new gas stations can be placed between two coordinates... [INFO] [stdout] | ^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_coordinates` [INFO] [stdout] | [INFO] [stdout] = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unused variable: `new_stations` [INFO] [stdout] --> src/binary_search.rs:562:51 [INFO] [stdout] | [INFO] [stdout] 562 | ...oordinates: &[f32], new_stations: i32) { //The new gas stations can be placed between two coordinates such that it is fractional [INFO] [stdout] | ^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_new_stations` [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unused variable: `root` [INFO] [stdout] --> src/binary_tress.rs:269:27 [INFO] [stdout] | [INFO] [stdout] 269 | pub fn vertical_traversal(root: Option>>) -> Vec> { [INFO] [stdout] | ^^^^ help: if this is intentional, prefix it with an underscore: `_root` [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unused variable: `root` [INFO] [stdout] --> src/binary_tress.rs:441:19 [INFO] [stdout] | [INFO] [stdout] 441 | pub fn distance_k(root: Option>>, target: Option>>, k: i32) -> Vec { [INFO] [stdout] | ^^^^ help: if this is intentional, prefix it with an underscore: `_root` [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unused variable: `target` [INFO] [stdout] --> src/binary_tress.rs:441:52 [INFO] [stdout] | [INFO] [stdout] 441 | pub fn distance_k(root: Option>>, target: Option>>, k: i32) -> Vec { [INFO] [stdout] | ^^^^^^ help: if this is intentional, prefix it with an underscore: `_target` [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unused variable: `k` [INFO] [stdout] --> src/binary_tress.rs:441:87 [INFO] [stdout] | [INFO] [stdout] 441 | pub fn distance_k(root: Option>>, target: Option>>, k: i32) -> Vec { [INFO] [stdout] | ^ help: if this is intentional, prefix it with an underscore: `_k` [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: variable `r` is assigned to, but never used [INFO] [stdout] --> src/two_pointer.rs:280:17 [INFO] [stdout] | [INFO] [stdout] 280 | let (mut l, mut r) = (0, 0); [INFO] [stdout] | ^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: consider using `_r` instead [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: value assigned to `r` is never read [INFO] [stdout] --> src/two_pointer.rs:311:9 [INFO] [stdout] | [INFO] [stdout] 311 | r = i; [INFO] [stdout] | ^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: maybe it is overwritten before being read? [INFO] [stdout] = note: `#[warn(unused_assignments)]` (part of `#[warn(unused)]`) on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: variable does not need to be mutable [INFO] [stdout] --> src/graphs.rs:1261:25 [INFO] [stdout] | [INFO] [stdout] 1261 | if let Some(mut weight) = positive_graph[u][v] { [INFO] [stdout] | ----^^^^^^ [INFO] [stdout] | | [INFO] [stdout] | help: remove this `mut` [INFO] [stdout] | [INFO] [stdout] = note: `#[warn(unused_mut)]` (part of `#[warn(unused)]`) on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: type `linked_lists::ListNode` is more private than the item `linked_lists::add_two_numbers` [INFO] [stdout] --> src/linked_lists.rs:160:1 [INFO] [stdout] | [INFO] [stdout] 160 | pub fn add_two_numbers(l1: Option>, l2: Option>) -> Option> { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function `linked_lists::add_two_numbers` is reachable at visibility `pub(crate)` [INFO] [stdout] | [INFO] [stdout] note: but type `linked_lists::ListNode` is only usable at visibility `pub(self)` [INFO] [stdout] --> src/linked_lists.rs:132:1 [INFO] [stdout] | [INFO] [stdout] 132 | struct ListNode { [INFO] [stdout] | ^^^^^^^^^^^^^^^ [INFO] [stdout] = note: `#[warn(private_interfaces)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/arrays.rs:56:5 [INFO] [stdout] | [INFO] [stdout] 56 | return if dip > 1 { false } else { true }; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] = note: `#[warn(clippy::needless_return)]` on by default [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 56 - return if dip > 1 { false } else { true }; [INFO] [stdout] 56 + if dip > 1 { false } else { true } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this if-then-else expression returns a bool literal [INFO] [stdout] --> src/arrays.rs:56:12 [INFO] [stdout] | [INFO] [stdout] 56 | return if dip > 1 { false } else { true }; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `dip <= 1` [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: unneeded `return` statement [INFO] [stdout] --> src/arrays.rs:214:13 [INFO] [stdout] | [INFO] [stdout] 214 | return; [INFO] [stdout] | ^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 213 - arr.reverse(); [INFO] [stdout] 214 - return; [INFO] [stdout] 213 + arr.reverse(); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this boolean expression can be simplified [INFO] [stdout] --> src/arrays.rs:232:25 [INFO] [stdout] | [INFO] [stdout] 232 | .filter(|&&num| !set.get(&(num - 1)).is_some()) //If num - 1 is not in the set, num might be the start of a sequence [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `set.get(&(num - 1)).is_none()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#nonminimal_bool [INFO] [stdout] = note: `#[warn(clippy::nonminimal_bool)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unnecessary use of `get(&(num - 1)).is_some()` [INFO] [stdout] --> src/arrays.rs:232:30 [INFO] [stdout] | [INFO] [stdout] 232 | .filter(|&&num| !set.get(&(num - 1)).is_some()) //If num - 1 is not in the set, num might be the start of a sequence [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `contains(&(num - 1))` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_get_then_check [INFO] [stdout] = note: `#[warn(clippy::unnecessary_get_then_check)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unnecessary use of `get(&(current + 1)).is_some()` [INFO] [stdout] --> src/arrays.rs:237:23 [INFO] [stdout] | [INFO] [stdout] 237 | while set.get(&(current + 1)).is_some() { //Now, num is always the beginning of the sequence [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `contains(&(current + 1))` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_get_then_check [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do [INFO] [stdout] --> src/arrays.rs:269:27 [INFO] [stdout] | [INFO] [stdout] 269 | pub fn set_zeroes(matrix: &mut Vec>) { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg [INFO] [stdout] = note: `#[warn(clippy::ptr_arg)]` on by default [INFO] [stdout] help: change this to [INFO] [stdout] | [INFO] [stdout] 269 - pub fn set_zeroes(matrix: &mut Vec>) { [INFO] [stdout] 269 + pub fn set_zeroes(matrix: &mut [Vec]) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/arrays.rs:289:13 [INFO] [stdout] | [INFO] [stdout] 289 | / if matrix[i][j] != 0 { [INFO] [stdout] 290 | | if matrix[0][j] == 0 || matrix[i][0] == 0 { [INFO] [stdout] 291 | | matrix[i][j] = 0; [INFO] [stdout] 292 | | } [INFO] [stdout] 293 | | } [INFO] [stdout] | |_____________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] = note: `#[warn(clippy::collapsible_if)]` on by default [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 289 ~ if matrix[i][j] != 0 [INFO] [stdout] 290 ~ && (matrix[0][j] == 0 || matrix[i][0] == 0) { [INFO] [stdout] 291 | matrix[i][j] = 0; [INFO] [stdout] 292 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `j` is only used to index `matrix` [INFO] [stdout] --> src/arrays.rs:298:18 [INFO] [stdout] | [INFO] [stdout] 298 | for j in 0..m { [INFO] [stdout] | ^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] = note: `#[warn(clippy::needless_range_loop)]` on by default [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 298 - for j in 0..m { [INFO] [stdout] 298 + for in matrix.iter_mut().take(m) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is only used to index `matrix` [INFO] [stdout] --> src/arrays.rs:303:18 [INFO] [stdout] | [INFO] [stdout] 303 | for i in 0..n { [INFO] [stdout] | ^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 303 - for i in 0..n { [INFO] [stdout] 303 + for in matrix.iter_mut().take(n) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is only used to index `matrix` [INFO] [stdout] --> src/arrays.rs:317:18 [INFO] [stdout] | [INFO] [stdout] 317 | for i in left..=right { [INFO] [stdout] | ^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 317 - for i in left..=right { [INFO] [stdout] 317 + for in matrix.iter().take(right + 1).skip(left) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is only used to index `matrix` [INFO] [stdout] --> src/arrays.rs:322:18 [INFO] [stdout] | [INFO] [stdout] 322 | for i in top..=bottom { [INFO] [stdout] | ^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 322 - for i in top..=bottom { [INFO] [stdout] 322 + for in matrix.iter().take(bottom + 1).skip(top) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is only used to index `matrix` [INFO] [stdout] --> src/arrays.rs:335:22 [INFO] [stdout] | [INFO] [stdout] 335 | for i in top..=bottom { [INFO] [stdout] | ^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 335 - for i in top..=bottom { [INFO] [stdout] 335 + for in matrix.iter().take(bottom + 1).skip(top) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do [INFO] [stdout] --> src/arrays.rs:500:35 [INFO] [stdout] | [INFO] [stdout] 500 | pub fn merge_sorted_arrays(nums1: &mut Vec, m: i32, nums2: &Vec, n: i32) { [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] 500 - pub fn merge_sorted_arrays(nums1: &mut Vec, m: i32, nums2: &Vec, n: i32) { [INFO] [stdout] 500 + pub fn merge_sorted_arrays(nums1: &mut [i32], m: i32, nums2: &Vec, n: i32) { [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/arrays.rs:500:65 [INFO] [stdout] | [INFO] [stdout] 500 | pub fn merge_sorted_arrays(nums1: &mut Vec, m: i32, nums2: &Vec, n: i32) { [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] 500 - pub fn merge_sorted_arrays(nums1: &mut Vec, m: i32, nums2: &Vec, n: i32) { [INFO] [stdout] 500 + pub fn merge_sorted_arrays(nums1: &mut Vec, m: i32, nums2: &[i32], n: i32) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of an assign operation [INFO] [stdout] --> src/bit_manipulation.rs:16:5 [INFO] [stdout] | [INFO] [stdout] 16 | *a = *a ^ *b; // a = a ^ b [INFO] [stdout] | ^^^^^^^^^^^^ help: replace it with: `*a ^= *b` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assign_op_pattern [INFO] [stdout] = note: `#[warn(clippy::assign_op_pattern)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of an assign operation [INFO] [stdout] --> src/bit_manipulation.rs:17:5 [INFO] [stdout] | [INFO] [stdout] 17 | *b = *a ^ *b; // b = (a ^ b) ^ b = a [INFO] [stdout] | ^^^^^^^^^^^^ help: replace it with: `*b ^= *a` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assign_op_pattern [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of an assign operation [INFO] [stdout] --> src/bit_manipulation.rs:18:5 [INFO] [stdout] | [INFO] [stdout] 18 | *a = *a ^ *b; // a = (a ^ b) ^ a = a [INFO] [stdout] | ^^^^^^^^^^^^ help: replace it with: `*a ^= *b` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assign_op_pattern [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/bit_manipulation.rs:28:5 [INFO] [stdout] | [INFO] [stdout] 28 | / return if num & mask == 0 { [INFO] [stdout] 29 | | false [INFO] [stdout] 30 | | } else { [INFO] [stdout] 31 | | true [INFO] [stdout] 32 | | }; [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 28 ~ if num & mask == 0 { [INFO] [stdout] 29 + false [INFO] [stdout] 30 + } else { [INFO] [stdout] 31 + true [INFO] [stdout] 32 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this if-then-else expression returns a bool literal [INFO] [stdout] --> src/bit_manipulation.rs:28:12 [INFO] [stdout] | [INFO] [stdout] 28 | return if num & mask == 0 { [INFO] [stdout] | ____________^ [INFO] [stdout] 29 | | false [INFO] [stdout] 30 | | } else { [INFO] [stdout] 31 | | true [INFO] [stdout] 32 | | }; [INFO] [stdout] | |_____^ help: you can reduce it to: `num & mask != 0` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_bool [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of an assign operation [INFO] [stdout] --> src/bit_manipulation.rs:40:5 [INFO] [stdout] | [INFO] [stdout] 40 | *num = *num | mask; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^ help: replace it with: `*num |= mask` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assign_op_pattern [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of an assign operation [INFO] [stdout] --> src/bit_manipulation.rs:46:5 [INFO] [stdout] | [INFO] [stdout] 46 | *num = *num & mask; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^ help: replace it with: `*num &= mask` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assign_op_pattern [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of an assign operation [INFO] [stdout] --> src/bit_manipulation.rs:53:5 [INFO] [stdout] | [INFO] [stdout] 53 | *num = *num ^ mask; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^ help: replace it with: `*num ^= mask` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assign_op_pattern [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/bit_manipulation.rs:63:5 [INFO] [stdout] | [INFO] [stdout] 63 | / return if num & (num - 1) == 0 { [INFO] [stdout] 64 | | true [INFO] [stdout] 65 | | } else { [INFO] [stdout] 66 | | false [INFO] [stdout] 67 | | }; [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 63 ~ if num & (num - 1) == 0 { [INFO] [stdout] 64 + true [INFO] [stdout] 65 + } else { [INFO] [stdout] 66 + false [INFO] [stdout] 67 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this if-then-else expression returns a bool literal [INFO] [stdout] --> src/bit_manipulation.rs:63:12 [INFO] [stdout] | [INFO] [stdout] 63 | return if num & (num - 1) == 0 { [INFO] [stdout] | ____________^ [INFO] [stdout] 64 | | true [INFO] [stdout] 65 | | } else { [INFO] [stdout] 66 | | false [INFO] [stdout] 67 | | }; [INFO] [stdout] | |_____^ help: you can reduce it to: `num & (num - 1) == 0` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_bool [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is used to index `arr` [INFO] [stdout] --> src/bit_manipulation.rs:107:18 [INFO] [stdout] | [INFO] [stdout] 107 | for i in 0..arr.len() { [INFO] [stdout] | ^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator and enumerate() [INFO] [stdout] | [INFO] [stdout] 107 - for i in 0..arr.len() { [INFO] [stdout] 107 + for (i, ) in arr.iter().enumerate() { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/bit_manipulation.rs:207:5 [INFO] [stdout] | [INFO] [stdout] 207 | / return if sign { [INFO] [stdout] 208 | | quotient [INFO] [stdout] 209 | | } else { [INFO] [stdout] 210 | | -quotient [INFO] [stdout] 211 | | }; [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 207 ~ if sign { [INFO] [stdout] 208 + quotient [INFO] [stdout] 209 + } else { [INFO] [stdout] 210 + -quotient [INFO] [stdout] 211 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` has identical blocks [INFO] [stdout] --> src/bit_manipulation.rs:179:37 [INFO] [stdout] | [INFO] [stdout] 179 | if dividend >= 0 && divisor < 0 { [INFO] [stdout] | _____________________________________^ [INFO] [stdout] 180 | | sign = false; [INFO] [stdout] 181 | | } else if dividend <= 0 && divisor > 0 { [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] note: same as this [INFO] [stdout] --> src/bit_manipulation.rs:181:44 [INFO] [stdout] | [INFO] [stdout] 181 | } else if dividend <= 0 && divisor > 0 { [INFO] [stdout] | ____________________________________________^ [INFO] [stdout] 182 | | sign = false; [INFO] [stdout] 183 | | } [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: unneeded `return` statement [INFO] [stdout] --> src/binary_search.rs:92:5 [INFO] [stdout] | [INFO] [stdout] 92 | / return if let Some(first) = first_occurrence { [INFO] [stdout] 93 | | if arr[first] != target { [INFO] [stdout] 94 | | None [INFO] [stdout] 95 | | } else { [INFO] [stdout] ... | [INFO] [stdout] 99 | | None [INFO] [stdout] 100 | | }; [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 92 ~ if let Some(first) = first_occurrence { [INFO] [stdout] 93 + if arr[first] != target { [INFO] [stdout] 94 + None [INFO] [stdout] 95 + } else { [INFO] [stdout] 96 + Some((first, last_occurrence.unwrap_or(arr.len()) - 1)) //If last_occurrence is None, it means that target is the last element [INFO] [stdout] 97 + } [INFO] [stdout] 98 + } else { [INFO] [stdout] 99 + None [INFO] [stdout] 100 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual saturating arithmetic [INFO] [stdout] --> src/binary_search.rs:154:20 [INFO] [stdout] | [INFO] [stdout] 154 | high = high.checked_sub(1).unwrap_or(0); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `saturating_sub`: `high.saturating_sub(1)` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_saturating_arithmetic [INFO] [stdout] = note: `#[warn(clippy::manual_saturating_arithmetic)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of an assign operation [INFO] [stdout] --> src/binary_search.rs:304:13 [INFO] [stdout] | [INFO] [stdout] 304 | high = high - 1; [INFO] [stdout] | ^^^^^^^^^^^^^^^ help: replace it with: `high -= 1` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assign_op_pattern [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/binary_search.rs:475:9 [INFO] [stdout] | [INFO] [stdout] 475 | / return if number_cows >= cows { [INFO] [stdout] 476 | | true [INFO] [stdout] 477 | | } else { [INFO] [stdout] 478 | | false [INFO] [stdout] 479 | | }; [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 475 ~ if number_cows >= cows { [INFO] [stdout] 476 + true [INFO] [stdout] 477 + } else { [INFO] [stdout] 478 + false [INFO] [stdout] 479 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this if-then-else expression returns a bool literal [INFO] [stdout] --> src/binary_search.rs:475:16 [INFO] [stdout] | [INFO] [stdout] 475 | return if number_cows >= cows { [INFO] [stdout] | ________________^ [INFO] [stdout] 476 | | true [INFO] [stdout] 477 | | } else { [INFO] [stdout] 478 | | false [INFO] [stdout] 479 | | }; [INFO] [stdout] | |_________^ help: you can reduce it to: `number_cows >= cows` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_bool [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manually reimplementing `div_ceil` [INFO] [stdout] --> src/binary_search.rs:574:16 [INFO] [stdout] | [INFO] [stdout] 574 | let left = (n + 1) / 2; //Number of elements to the left of the median [INFO] [stdout] | ^^^^^^^^^^^ help: consider using `.div_ceil()`: `n.div_ceil(2)` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_div_ceil [INFO] [stdout] = note: `#[warn(clippy::manual_div_ceil)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manually reimplementing `div_ceil` [INFO] [stdout] --> src/binary_search.rs:610:16 [INFO] [stdout] | [INFO] [stdout] 610 | let left = (n + 1) / 2; //Number of elements to the left of the median [INFO] [stdout] | ^^^^^^^^^^^ help: consider using `.div_ceil()`: `n.div_ceil(2)` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_div_ceil [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do [INFO] [stdout] --> src/binary_search.rs:644:32 [INFO] [stdout] | [INFO] [stdout] 644 | pub fn row_with_max_1s(matrix: &Vec>) -> Option { //Here, we are given a matrix of 0s and 1s, with each row being s... [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] 644 - pub fn row_with_max_1s(matrix: &Vec>) -> Option { //Here, we are given a matrix of 0s and 1s, with each row being sorted [INFO] [stdout] 644 + pub fn row_with_max_1s(matrix: &[Vec]) -> Option { //Here, we are given a matrix of 0s and 1s, with each row being sorted [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/binary_search.rs:660:30 [INFO] [stdout] | [INFO] [stdout] 660 | pub fn search_matrix(matrix: &Vec>, target: i32) -> Option<(usize, usize)> { [INFO] [stdout] | ^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg [INFO] [stdout] help: change this to [INFO] [stdout] | [INFO] [stdout] 660 - pub fn search_matrix(matrix: &Vec>, target: i32) -> Option<(usize, usize)> { [INFO] [stdout] 660 + pub fn search_matrix(matrix: &[Vec], target: i32) -> Option<(usize, usize)> { [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/binary_search.rs:684:36 [INFO] [stdout] | [INFO] [stdout] 684 | pub fn search_matrix_again(matrix: &Vec>, target: i32) -> Option<(usize, usize)> { [INFO] [stdout] | ^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg [INFO] [stdout] help: change this to [INFO] [stdout] | [INFO] [stdout] 684 - pub fn search_matrix_again(matrix: &Vec>, target: i32) -> Option<(usize, usize)> { [INFO] [stdout] 684 + pub fn search_matrix_again(matrix: &[Vec], target: i32) -> Option<(usize, usize)> { [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/binary_search.rs:701:31 [INFO] [stdout] | [INFO] [stdout] 701 | pub fn find_peak_grid(matrix: &Vec>) -> Option<(usize, usize)> { [INFO] [stdout] | ^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg [INFO] [stdout] help: change this to [INFO] [stdout] | [INFO] [stdout] 701 - pub fn find_peak_grid(matrix: &Vec>) -> Option<(usize, usize)> { [INFO] [stdout] 701 + pub fn find_peak_grid(matrix: &[Vec]) -> Option<(usize, usize)> { [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/binary_search.rs:725:35 [INFO] [stdout] | [INFO] [stdout] 725 | pub fn find_peak_grid_row(matrix: &Vec>) -> Option<(usize, usize)> { //Gives TLE [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] 725 - pub fn find_peak_grid_row(matrix: &Vec>) -> Option<(usize, usize)> { //Gives TLE [INFO] [stdout] 725 + pub fn find_peak_grid_row(matrix: &[Vec]) -> Option<(usize, usize)> { //Gives TLE [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/binary_search.rs:747:37 [INFO] [stdout] | [INFO] [stdout] 747 | pub fn median_sorted_matrix(matrix: &Vec>) -> i32 { //We are given that the matrix: n ⨉ m, n and m are both odd [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] 747 - pub fn median_sorted_matrix(matrix: &Vec>) -> i32 { //We are given that the matrix: n ⨉ m, n and m are both odd [INFO] [stdout] 747 + pub fn median_sorted_matrix(matrix: &[Vec]) -> i32 { //We are given that the matrix: n ⨉ m, n and m are both odd [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/doubly_linked_list.rs:61:69 [INFO] [stdout] | [INFO] [stdout] 61 | old_head.borrow_mut().prev = Some(Rc::downgrade(&h)); [INFO] [stdout] | ^^ help: change this to: `h` [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/doubly_linked_list.rs:76:48 [INFO] [stdout] | [INFO] [stdout] 76 | node.prev = Some(Rc::downgrade(&old_tail)); [INFO] [stdout] | ^^^^^^^^^ help: change this to: `old_tail` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/doubly_linked_list.rs:142:60 [INFO] [stdout] | [INFO] [stdout] 142 | current_borrowed.prev = Some(Rc::downgrade(&next)); [INFO] [stdout] | ^^^^^ help: change this to: `next` [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` statement can be collapsed [INFO] [stdout] --> src/recursion.rs:79:9 [INFO] [stdout] | [INFO] [stdout] 79 | / if close > 0 { [INFO] [stdout] 80 | | if open < close { //If the number of open in the string is more, we must use a closing bracket [INFO] [stdout] 81 | | s.push(')'); [INFO] [stdout] 82 | | generate(ans, s, open, close - 1); [INFO] [stdout] ... | [INFO] [stdout] 85 | | } [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 79 ~ if close > 0 [INFO] [stdout] 80 ~ && open < close { //If the number of open in the string is more, we must use a closing bracket [INFO] [stdout] 81 | s.push(')'); [INFO] [stdout] 82 | generate(ans, s, open, close - 1); [INFO] [stdout] 83 | s.pop(); [INFO] [stdout] 84 ~ } [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/recursion.rs:117:42 [INFO] [stdout] | [INFO] [stdout] 117 | pub fn combination_sum_again(candidates: &Vec, target: i32) -> 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] 117 ~ pub fn combination_sum_again(candidates: &[i32], target: i32) -> Vec> { [INFO] [stdout] 118 ~ let mut candidates = candidates.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/recursion.rs:271:61 [INFO] [stdout] | [INFO] [stdout] 271 | fn is_safe(n: usize, row: usize, col: usize, board: &Vec>) -> bool { [INFO] [stdout] | ^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg [INFO] [stdout] help: change this to [INFO] [stdout] | [INFO] [stdout] 271 - fn is_safe(n: usize, row: usize, col: usize, board: &Vec>) -> bool { [INFO] [stdout] 271 + fn is_safe(n: usize, row: usize, col: usize, board: &[Vec]) -> bool { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is only used to index `board` [INFO] [stdout] --> src/recursion.rs:273:22 [INFO] [stdout] | [INFO] [stdout] 273 | for i in 0..col { [INFO] [stdout] | ^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 273 - for i in 0..col { [INFO] [stdout] 273 + for in board.iter().take(col) { [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/recursion.rs:321:28 [INFO] [stdout] | [INFO] [stdout] 321 | pub fn is_valid(board: &Vec>, row: usize, col: usize, c: char) -> bool { [INFO] [stdout] | ^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg [INFO] [stdout] help: change this to [INFO] [stdout] | [INFO] [stdout] 321 - pub fn is_valid(board: &Vec>, row: usize, col: usize, c: char) -> bool { [INFO] [stdout] 321 + pub fn is_valid(board: &[Vec], row: usize, col: usize, c: char) -> bool { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do [INFO] [stdout] --> src/recursion.rs:362:36 [INFO] [stdout] | [INFO] [stdout] 362 | fn is_safe(node: usize, color: &Vec, adj_matrix: &Vec>, crayon: i32) -> bool { [INFO] [stdout] | ^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg [INFO] [stdout] help: change this to [INFO] [stdout] | [INFO] [stdout] 362 - fn is_safe(node: usize, color: &Vec, adj_matrix: &Vec>, crayon: i32) -> bool { [INFO] [stdout] 362 + fn is_safe(node: usize, color: &[i32], adj_matrix: &Vec>, crayon: i32) -> bool { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do [INFO] [stdout] --> src/recursion.rs:362:59 [INFO] [stdout] | [INFO] [stdout] 362 | fn is_safe(node: usize, color: &Vec, adj_matrix: &Vec>, crayon: i32) -> bool { [INFO] [stdout] | ^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg [INFO] [stdout] help: change this to [INFO] [stdout] | [INFO] [stdout] 362 - fn is_safe(node: usize, color: &Vec, adj_matrix: &Vec>, crayon: i32) -> bool { [INFO] [stdout] 362 + fn is_safe(node: usize, color: &Vec, adj_matrix: &[Vec], crayon: i32) -> bool { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: length comparison to zero [INFO] [stdout] --> src/recursion.rs:429:12 [INFO] [stdout] | [INFO] [stdout] 429 | if arr.len() == 0 { [INFO] [stdout] | ^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `arr.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: this `if` can be collapsed into the outer `match` [INFO] [stdout] --> src/greedy.rs:29:17 [INFO] [stdout] | [INFO] [stdout] 29 | / if five > 0 { [INFO] [stdout] 30 | | five -= 1; [INFO] [stdout] 31 | | ten += 1; [INFO] [stdout] 32 | | } else { [INFO] [stdout] 33 | | return false; [INFO] [stdout] 34 | | } [INFO] [stdout] | |_________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_match [INFO] [stdout] = note: `#[warn(clippy::collapsible_match)]` on by default [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 28 ~ 10 [INFO] [stdout] 29 ~ if five > 0 => { [INFO] [stdout] 30 | five -= 1; [INFO] [stdout] 31 | ten += 1; [INFO] [stdout] 32 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: consider using `sort_by_key` [INFO] [stdout] --> src/greedy.rs:96:5 [INFO] [stdout] | [INFO] [stdout] 96 | jobs.sort_by(|a, b| b.profit.cmp(&a.profit)); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_sort_by [INFO] [stdout] = note: `#[warn(clippy::unnecessary_sort_by)]` on by default [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 96 - jobs.sort_by(|a, b| b.profit.cmp(&a.profit)); [INFO] [stdout] 96 + jobs.sort_by_key(|b| std::cmp::Reverse(b.profit)); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: consider using `sort_by_key` [INFO] [stdout] --> src/greedy.rs:136:5 [INFO] [stdout] | [INFO] [stdout] 136 | intervals.sort_by(|&a, &b| a.1.cmp(&b.1)); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_sort_by [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 136 - intervals.sort_by(|&a, &b| a.1.cmp(&b.1)); [INFO] [stdout] 136 + intervals.sort_by_key(|&a| a.1); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of an assign operation [INFO] [stdout] --> src/greedy.rs:232:13 [INFO] [stdout] | [INFO] [stdout] 232 | sum = sum + 1; [INFO] [stdout] | ^^^^^^^^^^^^^ help: replace it with: `sum += 1` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assign_op_pattern [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/math.rs:28:5 [INFO] [stdout] | [INFO] [stdout] 28 | / return if a > b { [INFO] [stdout] 29 | | gcd(a % b, b) [INFO] [stdout] 30 | | } else { [INFO] [stdout] 31 | | gcd(b % a, a) [INFO] [stdout] 32 | | } [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 28 ~ if a > b { [INFO] [stdout] 29 + gcd(a % b, b) [INFO] [stdout] 30 + } else { [INFO] [stdout] 31 + gcd(b % a, a) [INFO] [stdout] 32 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/dynamic_programming.rs:71:5 [INFO] [stdout] | [INFO] [stdout] 71 | return std::cmp::min(one, two); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 71 - return std::cmp::min(one, two); [INFO] [stdout] 71 + std::cmp::min(one, two) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/dynamic_programming.rs:94:9 [INFO] [stdout] | [INFO] [stdout] 94 | return dp[n - 1]; [INFO] [stdout] | ^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 94 - return dp[n - 1]; [INFO] [stdout] 94 + dp[n - 1] [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `day` is only used to index `points` [INFO] [stdout] --> src/dynamic_programming.rs:202:16 [INFO] [stdout] | [INFO] [stdout] 202 | for day in 1..points.len() { [INFO] [stdout] | ^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 202 - for day in 1..points.len() { [INFO] [stdout] 202 + for in points.iter().skip(1) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `prev_task` is used to index `dp` [INFO] [stdout] --> src/dynamic_programming.rs:205:30 [INFO] [stdout] | [INFO] [stdout] 205 | for prev_task in 0..3 { [INFO] [stdout] | ^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator and enumerate() [INFO] [stdout] | [INFO] [stdout] 205 - for prev_task in 0..3 { [INFO] [stdout] 205 + for (prev_task, ) in dp.iter().enumerate().take(3) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/dynamic_programming.rs:226:5 [INFO] [stdout] | [INFO] [stdout] 226 | return unique_paths_recursive(m - 1, n) + unique_paths_recursive(m, n - 1); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 226 - return unique_paths_recursive(m - 1, n) + unique_paths_recursive(m, n - 1); [INFO] [stdout] 226 + unique_paths_recursive(m - 1, n) + unique_paths_recursive(m, n - 1) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is only used to index `obstacle_grid` [INFO] [stdout] --> src/dynamic_programming.rs:295:14 [INFO] [stdout] | [INFO] [stdout] 295 | for i in 0..m { [INFO] [stdout] | ^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 295 - for i in 0..m { [INFO] [stdout] 295 + for in obstacle_grid.iter().take(m) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/dynamic_programming.rs:326:9 [INFO] [stdout] | [INFO] [stdout] 326 | return grid[m][n] + std::cmp::min(helper(grid, m - 1, n), helper(grid, m, n - 1)); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 326 - return grid[m][n] + std::cmp::min(helper(grid, m - 1, n), helper(grid, m, n - 1)); [INFO] [stdout] 326 + grid[m][n] + std::cmp::min(helper(grid, m - 1, n), helper(grid, m, n - 1)) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is used to index `grid` [INFO] [stdout] --> src/dynamic_programming.rs:360:14 [INFO] [stdout] | [INFO] [stdout] 360 | for i in 0..m { [INFO] [stdout] | ^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator and enumerate() [INFO] [stdout] | [INFO] [stdout] 360 - for i in 0..m { [INFO] [stdout] 360 + for (i, ) in grid.iter().enumerate().take(m) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is only used to index `matrix` [INFO] [stdout] --> src/dynamic_programming.rs:435:14 [INFO] [stdout] | [INFO] [stdout] 435 | for i in 1..rows { [INFO] [stdout] | ^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 435 - for i in 1..rows { [INFO] [stdout] 435 + for in matrix.iter().take(rows).skip(1) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `.filter_map(..)` can be written more simply using `.map(..)` [INFO] [stdout] --> src/dynamic_programming.rs:518:22 [INFO] [stdout] | [INFO] [stdout] 518 | .filter_map(|(&delta_alice, &delta_bob)| { [INFO] [stdout] | ______________________^ [INFO] [stdout] 519 | | let alice_next = (alice as isize + delta_alice).clamp(0, (cols - 1) as isize) as usize; [INFO] [stdout] 520 | | let bob_next = (bob as isize + delta_bob).clamp(0, (cols - 1) as isize) as usize; [INFO] [stdout] 521 | | let val = if alice == bob { [INFO] [stdout] ... | [INFO] [stdout] 526 | | Some(val + dp[row + 1][alice_next][bob_next]) [INFO] [stdout] 527 | | }) [INFO] [stdout] | |______________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_filter_map [INFO] [stdout] = note: `#[warn(clippy::unnecessary_filter_map)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is only used to index `dp` [INFO] [stdout] --> src/dynamic_programming.rs:563:14 [INFO] [stdout] | [INFO] [stdout] 563 | for i in 0..arr.len() { [INFO] [stdout] | ^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 563 - for i in 0..arr.len() { [INFO] [stdout] 563 + for in dp.iter_mut().take(arr.len()) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is only used to index `dp` [INFO] [stdout] --> src/dynamic_programming.rs:604:14 [INFO] [stdout] | [INFO] [stdout] 604 | for i in 0..nums.len() { [INFO] [stdout] | ^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 604 - for i in 0..nums.len() { [INFO] [stdout] 604 + for in dp.iter_mut().take(nums.len()) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is used to index `dp` [INFO] [stdout] --> src/dynamic_programming.rs:622:14 [INFO] [stdout] | [INFO] [stdout] 622 | for i in 0..=total_sum / 2 { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator and enumerate() [INFO] [stdout] | [INFO] [stdout] 622 - for i in 0..=total_sum / 2 { [INFO] [stdout] 622 + for (i, ) in dp.iter().enumerate().take(total_sum / 2 + 1) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is only used to index `dp` [INFO] [stdout] --> src/dynamic_programming.rs:636:14 [INFO] [stdout] | [INFO] [stdout] 636 | for i in 0..arr.len() { [INFO] [stdout] | ^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 636 - for i in 0..arr.len() { [INFO] [stdout] 636 + for in dp.iter_mut().take(arr.len()) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/dynamic_programming.rs:689:9 [INFO] [stdout] | [INFO] [stdout] 689 | return dp[index][sum as usize]; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 689 - return dp[index][sum as usize]; [INFO] [stdout] 689 + dp[index][sum as usize] [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `weight` is only used to index `dp` [INFO] [stdout] --> src/dynamic_programming.rs:709:19 [INFO] [stdout] | [INFO] [stdout] 709 | for weight in items[0].0..=capacity { //Base Case [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 709 - for weight in items[0].0..=capacity { //Base Case [INFO] [stdout] 709 + for in dp.iter_mut().take(capacity + 1).skip(items[0].0) { //Base Case [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `weight` is only used to index `dp` [INFO] [stdout] --> src/dynamic_programming.rs:734:19 [INFO] [stdout] | [INFO] [stdout] 734 | for weight in items[0].0..=capacity { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 734 - for weight in items[0].0..=capacity { [INFO] [stdout] 734 + for in dp.iter_mut().take(capacity + 1).skip(items[0].0) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `sum` is used to index `prev` [INFO] [stdout] --> src/dynamic_programming.rs:758:16 [INFO] [stdout] | [INFO] [stdout] 758 | for sum in 0..=amount_usize { [INFO] [stdout] | ^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator and enumerate() [INFO] [stdout] | [INFO] [stdout] 758 - for sum in 0..=amount_usize { [INFO] [stdout] 758 + for (sum, ) in prev.iter_mut().enumerate().take(amount_usize + 1) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `sum` is used to index `prev` [INFO] [stdout] --> src/dynamic_programming.rs:814:16 [INFO] [stdout] | [INFO] [stdout] 814 | for sum in 0..=amount_usize { [INFO] [stdout] | ^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator and enumerate() [INFO] [stdout] | [INFO] [stdout] 814 - for sum in 0..=amount_usize { [INFO] [stdout] 814 + for (sum, ) in prev.iter_mut().enumerate().take(amount_usize + 1) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `length` is used to index `dp` [INFO] [stdout] --> src/dynamic_programming.rs:843:19 [INFO] [stdout] | [INFO] [stdout] 843 | for length in 0..=rod_length { [INFO] [stdout] | ^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator and enumerate() [INFO] [stdout] | [INFO] [stdout] 843 - for length in 0..=rod_length { [INFO] [stdout] 843 + for (length, ) in dp.iter_mut().enumerate().take(rod_length + 1) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is only used to index `dp` [INFO] [stdout] --> src/dynamic_programming.rs:869:14 [INFO] [stdout] | [INFO] [stdout] 869 | for i in 0..=n { [INFO] [stdout] | ^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 869 - for i in 0..=n { [INFO] [stdout] 869 + for in dp.iter_mut().take(n + 1) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `j` is only used to index `dp` [INFO] [stdout] --> src/dynamic_programming.rs:872:14 [INFO] [stdout] | [INFO] [stdout] 872 | for j in 0..=m { [INFO] [stdout] | ^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 872 - for j in 0..=m { [INFO] [stdout] 872 + for in dp.iter_mut().take(m + 1) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is only used to index `dp` [INFO] [stdout] --> src/dynamic_programming.rs:897:14 [INFO] [stdout] | [INFO] [stdout] 897 | for i in 0..=n { [INFO] [stdout] | ^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 897 - for i in 0..=n { [INFO] [stdout] 897 + for in dp.iter_mut().take(n + 1) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `j` is only used to index `dp` [INFO] [stdout] --> src/dynamic_programming.rs:900:14 [INFO] [stdout] | [INFO] [stdout] 900 | for j in 0..=m { [INFO] [stdout] | ^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 900 - for j in 0..=m { [INFO] [stdout] 900 + for in dp.iter_mut().take(m + 1) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is only used to index `dp` [INFO] [stdout] --> src/dynamic_programming.rs:923:14 [INFO] [stdout] | [INFO] [stdout] 923 | for i in 0..=n { [INFO] [stdout] | ^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 923 - for i in 0..=n { [INFO] [stdout] 923 + for in dp.iter_mut().take(n + 1) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `j` is only used to index `dp` [INFO] [stdout] --> src/dynamic_programming.rs:926:14 [INFO] [stdout] | [INFO] [stdout] 926 | for j in 0..=m { [INFO] [stdout] | ^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 926 - for j in 0..=m { [INFO] [stdout] 926 + for in dp.iter_mut().take(m + 1) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `j` is used to index `prev` [INFO] [stdout] --> src/dynamic_programming.rs:1002:14 [INFO] [stdout] | [INFO] [stdout] 1002 | for j in 0..=m { //Base Case [INFO] [stdout] | ^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator and enumerate() [INFO] [stdout] | [INFO] [stdout] 1002 - for j in 0..=m { //Base Case [INFO] [stdout] 1002 + for (j, ) in prev.iter_mut().enumerate().take(m + 1) { //Base Case [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `can_buy` is used to index `curr` [INFO] [stdout] --> src/dynamic_programming.rs:1062:24 [INFO] [stdout] | [INFO] [stdout] 1062 | for can_buy in 0..=1 { [INFO] [stdout] | ^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator and enumerate() [INFO] [stdout] | [INFO] [stdout] 1062 - for can_buy in 0..=1 { [INFO] [stdout] 1062 + for (can_buy, ) in curr.iter_mut().enumerate().take(1 + 1) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `can_buy` is used to index `curr` [INFO] [stdout] --> src/dynamic_programming.rs:1095:24 [INFO] [stdout] | [INFO] [stdout] 1095 | for can_buy in 0..=1 { [INFO] [stdout] | ^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator and enumerate() [INFO] [stdout] | [INFO] [stdout] 1095 - for can_buy in 0..=1 { [INFO] [stdout] 1095 + for (can_buy, ) in curr.iter_mut().enumerate().take(1 + 1) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: consider using `sort_unstable_by_key` [INFO] [stdout] --> src/dynamic_programming.rs:1234:5 [INFO] [stdout] | [INFO] [stdout] 1234 | words.sort_unstable_by(|a, b| a.len().cmp(&b.len())); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_sort_by [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 1234 - words.sort_unstable_by(|a, b| a.len().cmp(&b.len())); [INFO] [stdout] 1234 + words.sort_unstable_by_key(|a| a.len()); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: consider using `sort_unstable_by_key` [INFO] [stdout] --> src/dynamic_programming.rs:1272:5 [INFO] [stdout] | [INFO] [stdout] 1272 | words.sort_unstable_by(|a, b| a.len().cmp(&b.len())); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_sort_by [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 1272 - words.sort_unstable_by(|a, b| a.len().cmp(&b.len())); [INFO] [stdout] 1272 + words.sort_unstable_by_key(|a| a.len()); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is used to index `dp` [INFO] [stdout] --> src/dynamic_programming.rs:1397:14 [INFO] [stdout] | [INFO] [stdout] 1397 | for i in 1..matrices.len() { //Base Case [INFO] [stdout] | ^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator and enumerate() [INFO] [stdout] | [INFO] [stdout] 1397 - for i in 1..matrices.len() { //Base Case [INFO] [stdout] 1397 + for (i, ) in dp.iter_mut().enumerate().take(matrices.len()).skip(1) { //Base Case [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true [INFO] [stdout] --> src/binary_tress.rs:36:1 [INFO] [stdout] | [INFO] [stdout] 36 | impl Into>>> for Node { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: `impl From for Foreign` is allowed by the orphan rules, for more information see [INFO] [stdout] https://doc.rust-lang.org/reference/items/implementations.html#trait-implementation-coherence [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#from_over_into [INFO] [stdout] = note: `#[warn(clippy::from_over_into)]` on by default [INFO] [stdout] help: replace the `Into` implementation with `From` [INFO] [stdout] | [INFO] [stdout] 36 ~ impl From for Option>> { [INFO] [stdout] 37 ~ fn from(val: Node) -> Self { [INFO] [stdout] 38 ~ Some(Rc::new(RefCell::new(val))) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `map_or` can be simplified [INFO] [stdout] --> src/binary_tress.rs:179:5 [INFO] [stdout] | [INFO] [stdout] 179 | / root.map_or(false, |node| { [INFO] [stdout] 180 | | let left_height = max_depth(node.borrow().left.clone()); [INFO] [stdout] 181 | | let right_height = max_depth(node.borrow().right.clone()); [INFO] [stdout] ... | [INFO] [stdout] 184 | | }) [INFO] [stdout] | |______^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or [INFO] [stdout] = note: `#[warn(clippy::unnecessary_map_or)]` on by default [INFO] [stdout] help: use `is_some_and` instead [INFO] [stdout] | [INFO] [stdout] 179 - root.map_or(false, |node| { [INFO] [stdout] 179 + root.is_some_and(|node| { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `map_or` can be simplified [INFO] [stdout] --> src/binary_tress.rs:286:5 [INFO] [stdout] | [INFO] [stdout] 286 | root.map_or(true, |node| helper(node.borrow().left.clone(), node.borrow().right.clone())) [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or [INFO] [stdout] help: use `is_none_or` instead [INFO] [stdout] | [INFO] [stdout] 286 - root.map_or(true, |node| helper(node.borrow().left.clone(), node.borrow().right.clone())) [INFO] [stdout] 286 + root.is_none_or(|node| helper(node.borrow().left.clone(), node.borrow().right.clone())) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `map_or` can be simplified [INFO] [stdout] --> src/binary_tress.rs:292:9 [INFO] [stdout] | [INFO] [stdout] 292 | / root.map_or(false, |nde| { [INFO] [stdout] 293 | | path.push(nde.borrow().value); [INFO] [stdout] 294 | | [INFO] [stdout] 295 | | if nde.borrow().value == node { [INFO] [stdout] ... | [INFO] [stdout] 305 | | false [INFO] [stdout] 306 | | }) [INFO] [stdout] | |__________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or [INFO] [stdout] help: use `is_some_and` instead [INFO] [stdout] | [INFO] [stdout] 292 - root.map_or(false, |nde| { [INFO] [stdout] 292 + root.is_some_and(|nde| { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is used to index `s` [INFO] [stdout] --> src/two_pointer.rs:126:14 [INFO] [stdout] | [INFO] [stdout] 126 | for i in 0..s.len() { [INFO] [stdout] | ^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator and enumerate() [INFO] [stdout] | [INFO] [stdout] 126 - for i in 0..s.len() { [INFO] [stdout] 126 + for (i, ) in s.iter().enumerate() { [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/two_pointer.rs:175:21 [INFO] [stdout] | [INFO] [stdout] 175 | fn helper(nums: &Vec, goal: i32) -> usize { [INFO] [stdout] | ^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg [INFO] [stdout] help: change this to [INFO] [stdout] | [INFO] [stdout] 175 - fn helper(nums: &Vec, goal: i32) -> usize { [INFO] [stdout] 175 + fn helper(nums: &[i32], goal: i32) -> usize { [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/two_pointer.rs:212:21 [INFO] [stdout] | [INFO] [stdout] 212 | fn helper(nums: &Vec, goal: i32) -> i32 { [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] 212 - fn helper(nums: &Vec, goal: i32) -> i32 { [INFO] [stdout] 212 + fn helper(nums: &[i32], goal: i32) -> i32 { [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/two_pointer.rs:239:21 [INFO] [stdout] | [INFO] [stdout] 239 | fn helper(nums: &Vec, k: usize) -> i32 { [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] 239 - fn helper(nums: &Vec, k: usize) -> i32 { [INFO] [stdout] 239 + fn helper(nums: &[i32], k: usize) -> i32 { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` [INFO] [stdout] --> src/two_pointer.rs:283:9 [INFO] [stdout] | [INFO] [stdout] 283 | / match freq_map.get_mut(&c) { [INFO] [stdout] 284 | | Some(val) => { [INFO] [stdout] 285 | | if *val > 0 { [INFO] [stdout] 286 | | count += 1; [INFO] [stdout] ... | [INFO] [stdout] 290 | | None => {} [INFO] [stdout] 291 | | } [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match [INFO] [stdout] = note: `#[warn(clippy::single_match)]` on by default [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 283 ~ if let Some(val) = freq_map.get_mut(&c) { [INFO] [stdout] 284 + if *val > 0 { [INFO] [stdout] 285 + count += 1; [INFO] [stdout] 286 + } [INFO] [stdout] 287 + *val -= 1; [INFO] [stdout] 288 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` [INFO] [stdout] --> src/two_pointer.rs:299:13 [INFO] [stdout] | [INFO] [stdout] 299 | / match freq_map.get_mut(&s[l]) { [INFO] [stdout] 300 | | Some(val) => { [INFO] [stdout] 301 | | if *val == 0 { [INFO] [stdout] 302 | | count -= 1; [INFO] [stdout] ... | [INFO] [stdout] 306 | | None => {} [INFO] [stdout] 307 | | } [INFO] [stdout] | |_____________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 299 ~ if let Some(val) = freq_map.get_mut(&s[l]) { [INFO] [stdout] 300 + if *val == 0 { [INFO] [stdout] 301 + count -= 1; [INFO] [stdout] 302 + } [INFO] [stdout] 303 + *val += 1; [INFO] [stdout] 304 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unused variable: `coordinates` [INFO] [stdout] --> src/binary_search.rs:562:30 [INFO] [stdout] | [INFO] [stdout] 562 | pub fn minimize_max_distance(coordinates: &[f32], new_stations: i32) { //The new gas stations can be placed between two coordinates... [INFO] [stdout] | ^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_coordinates` [INFO] [stdout] | [INFO] [stdout] = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unused variable: `new_stations` [INFO] [stdout] --> src/binary_search.rs:562:51 [INFO] [stdout] | [INFO] [stdout] 562 | ...oordinates: &[f32], new_stations: i32) { //The new gas stations can be placed between two coordinates such that it is fractional [INFO] [stdout] | ^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_new_stations` [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do [INFO] [stdout] --> src/graphs.rs:187:33 [INFO] [stdout] | [INFO] [stdout] 187 | fn helper(node: usize, vis: &mut Vec, adj_list: &Vec>) -> bool { [INFO] [stdout] | ^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg [INFO] [stdout] help: change this to [INFO] [stdout] | [INFO] [stdout] 187 - fn helper(node: usize, vis: &mut Vec, adj_list: &Vec>) -> bool { [INFO] [stdout] 187 + fn helper(node: usize, vis: &mut [bool], adj_list: &Vec>) -> bool { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do [INFO] [stdout] --> src/graphs.rs:187:59 [INFO] [stdout] | [INFO] [stdout] 187 | fn helper(node: usize, vis: &mut Vec, adj_list: &Vec>) -> bool { [INFO] [stdout] | ^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg [INFO] [stdout] help: change this to [INFO] [stdout] | [INFO] [stdout] 187 - fn helper(node: usize, vis: &mut Vec, adj_list: &Vec>) -> bool { [INFO] [stdout] 187 + fn helper(node: usize, vis: &mut Vec, adj_list: &[Vec]) -> bool { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/graphs.rs:208:9 [INFO] [stdout] | [INFO] [stdout] 208 | / if !vis[i] { [INFO] [stdout] 209 | | if helper(i, &mut vis, &adj_list) { [INFO] [stdout] 210 | | return true; [INFO] [stdout] 211 | | }; [INFO] [stdout] 212 | | } [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 208 ~ if !vis[i] [INFO] [stdout] 209 ~ && helper(i, &mut vis, &adj_list) { [INFO] [stdout] 210 | return true; [INFO] [stdout] 211 ~ }; [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/graphs.rs:237:9 [INFO] [stdout] | [INFO] [stdout] 237 | / if !vis[i] { [INFO] [stdout] 238 | | if helper(i, None, &mut vis, &adj_list) { [INFO] [stdout] 239 | | return true; [INFO] [stdout] 240 | | } [INFO] [stdout] 241 | | } [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 237 ~ if !vis[i] [INFO] [stdout] 238 ~ && helper(i, None, &mut vis, &adj_list) { [INFO] [stdout] 239 | return true; [INFO] [stdout] 240 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/graphs.rs:330:13 [INFO] [stdout] | [INFO] [stdout] 330 | / if row == 0 || col == 0 || row == grid.len() - 1 || col == grid[0].len() - 1 { [INFO] [stdout] 331 | | if grid[row][col] == 1 { [INFO] [stdout] 332 | | vis[row][col] = true; [INFO] [stdout] 333 | | queue.push_back((row, col)); [INFO] [stdout] 334 | | } [INFO] [stdout] 335 | | } [INFO] [stdout] | |_____________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 330 ~ if (row == 0 || col == 0 || row == grid.len() - 1 || col == grid[0].len() - 1) { [INFO] [stdout] 331 ~ && grid[row][col] == 1 { [INFO] [stdout] 332 | vis[row][col] = true; [INFO] [stdout] 333 | queue.push_back((row, col)); [INFO] [stdout] 334 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/graphs.rs:412:9 [INFO] [stdout] | [INFO] [stdout] 412 | / if color[i].is_none() { [INFO] [stdout] 413 | | if !helper(i, false, &mut color, &grid) { [INFO] [stdout] 414 | | return false; [INFO] [stdout] 415 | | }; [INFO] [stdout] 416 | | } [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 412 ~ if color[i].is_none() [INFO] [stdout] 413 ~ && !helper(i, false, &mut color, &grid) { [INFO] [stdout] 414 | return false; [INFO] [stdout] 415 ~ }; [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/graphs.rs:444:9 [INFO] [stdout] | [INFO] [stdout] 444 | / if !vis[i] { [INFO] [stdout] 445 | | if helper(i, &adj_list, &mut vis, &mut path_vis) { [INFO] [stdout] 446 | | return true; [INFO] [stdout] 447 | | } [INFO] [stdout] 448 | | } [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 444 ~ if !vis[i] [INFO] [stdout] 445 ~ && helper(i, &adj_list, &mut vis, &mut path_vis) { [INFO] [stdout] 446 | return true; [INFO] [stdout] 447 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is used to index `check` [INFO] [stdout] --> src/graphs.rs:487:14 [INFO] [stdout] | [INFO] [stdout] 487 | for i in 0..graph.len() { [INFO] [stdout] | ^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator and enumerate() [INFO] [stdout] | [INFO] [stdout] 487 - for i in 0..graph.len() { [INFO] [stdout] 487 + for (i, ) in check.iter().enumerate().take(graph.len()) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `node` is only used to index `adj_list` [INFO] [stdout] --> src/graphs.rs:526:17 [INFO] [stdout] | [INFO] [stdout] 526 | for node in 0..adj_list.len() { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 526 - for node in 0..adj_list.len() { [INFO] [stdout] 526 + for in &adj_list { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `node` is used to index `indegree` [INFO] [stdout] --> src/graphs.rs:532:17 [INFO] [stdout] | [INFO] [stdout] 532 | for node in 0..adj_list.len() { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator and enumerate() [INFO] [stdout] | [INFO] [stdout] 532 - for node in 0..adj_list.len() { [INFO] [stdout] 532 + for (node, ) in indegree.iter().enumerate().take(adj_list.len()) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `node` is only used to index `adj_list` [INFO] [stdout] --> src/graphs.rs:557:17 [INFO] [stdout] | [INFO] [stdout] 557 | for node in 0..adj_list.len() { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 557 - for node in 0..adj_list.len() { [INFO] [stdout] 557 + for in &adj_list { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `node` is used to index `indegree` [INFO] [stdout] --> src/graphs.rs:563:17 [INFO] [stdout] | [INFO] [stdout] 563 | for node in 0..adj_list.len() { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator and enumerate() [INFO] [stdout] | [INFO] [stdout] 563 - for node in 0..adj_list.len() { [INFO] [stdout] 563 + for (node, ) in indegree.iter().enumerate().take(adj_list.len()) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `node` is only used to index `graph` [INFO] [stdout] --> src/graphs.rs:593:17 [INFO] [stdout] | [INFO] [stdout] 593 | for node in 0..num_courses { [INFO] [stdout] | ^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 593 - for node in 0..num_courses { [INFO] [stdout] 593 + for in graph.iter().take(num_courses) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `node` is used to index `indegree` [INFO] [stdout] --> src/graphs.rs:598:17 [INFO] [stdout] | [INFO] [stdout] 598 | for node in 0..num_courses { [INFO] [stdout] | ^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator and enumerate() [INFO] [stdout] | [INFO] [stdout] 598 - for node in 0..num_courses { [INFO] [stdout] 598 + for (node, ) in indegree.iter().enumerate().take(num_courses) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `node` is used to index `indegree` [INFO] [stdout] --> src/graphs.rs:630:17 [INFO] [stdout] | [INFO] [stdout] 630 | for node in 0..graph.len() { [INFO] [stdout] | ^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator and enumerate() [INFO] [stdout] | [INFO] [stdout] 630 - for node in 0..graph.len() { [INFO] [stdout] 630 + for (node, ) in indegree.iter().enumerate().take(graph.len()) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/graphs.rs:695:27 [INFO] [stdout] | [INFO] [stdout] 695 | helper(i, &adj_list, &mut vis, &mut stack); [INFO] [stdout] | ^^^^^^^^^ help: change this to: `adj_list` [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/graphs.rs:788:31 [INFO] [stdout] | [INFO] [stdout] 788 | if ans.len() == 0 { [INFO] [stdout] | _______________________________^ [INFO] [stdout] 789 | | ans.push(path.clone()); [INFO] [stdout] 790 | | } else if ans[0].len() == path.len() { [INFO] [stdout] | |_____________^ [INFO] [stdout] | [INFO] [stdout] note: same as this [INFO] [stdout] --> src/graphs.rs:790:50 [INFO] [stdout] | [INFO] [stdout] 790 | } else if ans[0].len() == path.len() { [INFO] [stdout] | __________________________________________________^ [INFO] [stdout] 791 | | ans.push(path.clone()); [INFO] [stdout] 792 | | } [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: length comparison to zero [INFO] [stdout] --> src/graphs.rs:788:16 [INFO] [stdout] | [INFO] [stdout] 788 | if ans.len() == 0 { [INFO] [stdout] | ^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `ans.is_empty()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this block may be rewritten with the `?` operator [INFO] [stdout] --> src/graphs.rs:936:5 [INFO] [stdout] | [INFO] [stdout] 936 | / if distances[adj_list.len() - 1].is_none() { [INFO] [stdout] 937 | | return None; [INFO] [stdout] 938 | | } [INFO] [stdout] | |_____^ help: replace it with: `distances[adj_list.len() - 1]?;` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#question_mark [INFO] [stdout] = note: `#[warn(clippy::question_mark)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/graphs.rs:1040:5 [INFO] [stdout] | [INFO] [stdout] 1040 | / return if distances[dst] == i32::MAX { [INFO] [stdout] 1041 | | None [INFO] [stdout] 1042 | | } else { [INFO] [stdout] 1043 | | Some(distances[dst]) [INFO] [stdout] 1044 | | }; [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 1040 ~ if distances[dst] == i32::MAX { [INFO] [stdout] 1041 + None [INFO] [stdout] 1042 + } else { [INFO] [stdout] 1043 + Some(distances[dst]) [INFO] [stdout] 1044 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of `Option::map` [INFO] [stdout] --> src/graphs.rs:1078:65 [INFO] [stdout] | [INFO] [stdout] 1078 | times.into_iter().skip(1).try_fold(i32::MIN, |max_val, val| match val { [INFO] [stdout] | _________________________________________________________________^ [INFO] [stdout] 1079 | | None => None, [INFO] [stdout] 1080 | | Some(num) => Some(max_val.max(num)) [INFO] [stdout] 1081 | | }).unwrap_or(-1) [INFO] [stdout] | |_____^ help: try: `val.map(|num| max_val.max(num))` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_map [INFO] [stdout] = note: `#[warn(clippy::manual_map)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is used to index `distances` [INFO] [stdout] --> src/graphs.rs:1190:14 [INFO] [stdout] | [INFO] [stdout] 1190 | for i in 0..v { [INFO] [stdout] | ^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator and enumerate() [INFO] [stdout] | [INFO] [stdout] 1190 - for i in 0..v { [INFO] [stdout] 1190 + for (i, ) in distances.iter_mut().enumerate().take(v) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `j` is used to index `distances` [INFO] [stdout] --> src/graphs.rs:1191:18 [INFO] [stdout] | [INFO] [stdout] 1191 | for j in 0..v { [INFO] [stdout] | ^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator and enumerate() [INFO] [stdout] | [INFO] [stdout] 1191 - for j in 0..v { [INFO] [stdout] 1191 + for (j, ) in distances.iter_mut().enumerate().take(v) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: called `iter().cloned().collect()` on a slice to create a `Vec`. Calling `to_vec()` is both faster and more readable [INFO] [stdout] --> src/graphs.rs:1257:49 [INFO] [stdout] | [INFO] [stdout] 1257 | positive_graph.push(row[..row.len() - 1].iter().cloned().collect()); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `.to_vec()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#iter_cloned_collect [INFO] [stdout] = note: `#[warn(clippy::iter_cloned_collect)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is used to index `distances` [INFO] [stdout] --> src/graphs.rs:1280:14 [INFO] [stdout] | [INFO] [stdout] 1280 | for i in 0..cities { [INFO] [stdout] | ^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator and enumerate() [INFO] [stdout] | [INFO] [stdout] 1280 - for i in 0..cities { [INFO] [stdout] 1280 + for (i, ) in distances.iter_mut().enumerate().take(cities) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `vertex` is used to index `adj_list` [INFO] [stdout] --> src/graphs.rs:1414:19 [INFO] [stdout] | [INFO] [stdout] 1414 | for vertex in 0..adj_list.len() { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator and enumerate() [INFO] [stdout] | [INFO] [stdout] 1414 - for vertex in 0..adj_list.len() { [INFO] [stdout] 1414 + for (vertex, ) in adj_list.iter().enumerate() { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `j` is used to index `adj_matrix` [INFO] [stdout] --> src/graphs.rs:1442:18 [INFO] [stdout] | [INFO] [stdout] 1442 | for j in 0..adj_matrix.len() { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator and enumerate() [INFO] [stdout] | [INFO] [stdout] 1442 - for j in 0..adj_matrix.len() { [INFO] [stdout] 1442 + for (j, ) in adj_matrix.iter().enumerate() { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this pattern takes a reference on something that is being dereferenced [INFO] [stdout] --> src/graphs.rs:1481:17 [INFO] [stdout] | [INFO] [stdout] 1481 | for (index, &ref account) in accounts.iter().enumerate() { [INFO] [stdout] | ^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrowed_reference [INFO] [stdout] = note: `#[warn(clippy::needless_borrowed_reference)]` on by default [INFO] [stdout] help: try removing the `&ref` part [INFO] [stdout] | [INFO] [stdout] 1481 - for (index, &ref account) in accounts.iter().enumerate() { [INFO] [stdout] 1481 + for (index, account) in accounts.iter().enumerate() { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this function has too many arguments (8/7) [INFO] [stdout] --> src/graphs.rs:1714:5 [INFO] [stdout] | [INFO] [stdout] 1714 | fn helper(node: usize, parent: Option, adj_list: &Vec>, vis: &mut Vec, mut timer: i32, insertion_time: &mut Vec, lowest_visit_time: &mut Vec, bridges: &mut Vec<(usize, usize)>) { ... [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments [INFO] [stdout] = note: `#[warn(clippy::too_many_arguments)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this function has too many arguments (8/7) [INFO] [stdout] --> src/graphs.rs:1749:5 [INFO] [stdout] | [INFO] [stdout] 1749 | fn helper(node: usize, parent: Option, adj_list: &Vec>, vis: &mut Vec, mut timer: i32, insertion_time: &mut Vec, lowest_visit_time: &mut Vec, points: &mut Vec) { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/stack_queues.rs:208:9 [INFO] [stdout] | [INFO] [stdout] 208 | / return if !self.stack_output.is_empty() { [INFO] [stdout] 209 | | self.stack_output.pop_back().unwrap() [INFO] [stdout] 210 | | } else { [INFO] [stdout] 211 | | while !self.stack_input.is_empty() { [INFO] [stdout] ... | [INFO] [stdout] 214 | | self.stack_output.pop_back().unwrap() [INFO] [stdout] 215 | | }; [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 208 ~ if !self.stack_output.is_empty() { [INFO] [stdout] 209 + self.stack_output.pop_back().unwrap() [INFO] [stdout] 210 + } else { [INFO] [stdout] 211 + while !self.stack_input.is_empty() { [INFO] [stdout] 212 + self.stack_output.push_back(self.stack_input.pop_back().unwrap()); [INFO] [stdout] 213 + } [INFO] [stdout] 214 + self.stack_output.pop_back().unwrap() [INFO] [stdout] 215 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/stack_queues.rs:219:9 [INFO] [stdout] | [INFO] [stdout] 219 | / return if !self.stack_output.is_empty() { [INFO] [stdout] 220 | | *self.stack_output.back().unwrap() [INFO] [stdout] 221 | | } else { [INFO] [stdout] 222 | | while !self.stack_input.is_empty() { [INFO] [stdout] ... | [INFO] [stdout] 225 | | *self.stack_output.back().unwrap() [INFO] [stdout] 226 | | }; [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 219 ~ if !self.stack_output.is_empty() { [INFO] [stdout] 220 + *self.stack_output.back().unwrap() [INFO] [stdout] 221 + } else { [INFO] [stdout] 222 + while !self.stack_input.is_empty() { [INFO] [stdout] 223 + self.stack_output.push_back(self.stack_input.pop_back().unwrap()); [INFO] [stdout] 224 + } [INFO] [stdout] 225 + *self.stack_output.back().unwrap() [INFO] [stdout] 226 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `map_or` can be simplified [INFO] [stdout] --> src/stack_queues.rs:346:15 [INFO] [stdout] | [INFO] [stdout] 346 | while stack.back().map_or(false, |&i| heights[i] >= ele) { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or [INFO] [stdout] help: use `is_some_and` instead [INFO] [stdout] | [INFO] [stdout] 346 - while stack.back().map_or(false, |&i| heights[i] >= ele) { [INFO] [stdout] 346 + while stack.back().is_some_and(|&i| heights[i] >= ele) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `map_or` can be simplified [INFO] [stdout] --> src/stack_queues.rs:357:15 [INFO] [stdout] | [INFO] [stdout] 357 | while stack.back().map_or(false, |&i| heights[i] >= ele) { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or [INFO] [stdout] help: use `is_some_and` instead [INFO] [stdout] | [INFO] [stdout] 357 - while stack.back().map_or(false, |&i| heights[i] >= ele) { [INFO] [stdout] 357 + while stack.back().is_some_and(|&i| heights[i] >= ele) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: explicit call to `.into_iter()` in function argument accepting `IntoIterator` [INFO] [stdout] --> src/stack_queues.rs:366:14 [INFO] [stdout] | [INFO] [stdout] 366 | .zip(right_smaller_index.into_iter()) [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()` [INFO] [stdout] --> /rustc/3645249d79dfb136b5d8de3ce153d19d6698d92d/library/core/src/iter/traits/iterator.rs:629:11 [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion [INFO] [stdout] = note: `#[warn(clippy::useless_conversion)]` on by default [INFO] [stdout] help: consider removing the `.into_iter()` [INFO] [stdout] | [INFO] [stdout] 366 - .zip(right_smaller_index.into_iter()) [INFO] [stdout] 366 + .zip(right_smaller_index) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: explicit call to `.into_iter()` in function argument accepting `IntoIterator` [INFO] [stdout] --> src/stack_queues.rs:367:14 [INFO] [stdout] | [INFO] [stdout] 367 | .zip(heights.into_iter()) [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()` [INFO] [stdout] --> /rustc/3645249d79dfb136b5d8de3ce153d19d6698d92d/library/core/src/iter/traits/iterator.rs:629:11 [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion [INFO] [stdout] help: consider removing the `.into_iter()` [INFO] [stdout] | [INFO] [stdout] 367 - .zip(heights.into_iter()) [INFO] [stdout] 367 + .zip(heights) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `map_or` can be simplified [INFO] [stdout] --> src/stack_queues.rs:400:15 [INFO] [stdout] | [INFO] [stdout] 400 | while dequeue.front().map_or(false, |&f| Some(f) == ind.checked_sub(ind)) { //Check for out of bounds [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or [INFO] [stdout] help: use `is_some_and` instead [INFO] [stdout] | [INFO] [stdout] 400 - while dequeue.front().map_or(false, |&f| Some(f) == ind.checked_sub(ind)) { //Check for out of bounds [INFO] [stdout] 400 + while dequeue.front().is_some_and(|&f| Some(f) == ind.checked_sub(ind)) { //Check for out of bounds [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `map_or` can be simplified [INFO] [stdout] --> src/stack_queues.rs:404:15 [INFO] [stdout] | [INFO] [stdout] 404 | while dequeue.back().map_or(false, |&b| nums[b] < ele) { //Remove all elements smaller than current [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or [INFO] [stdout] help: use `is_some_and` instead [INFO] [stdout] | [INFO] [stdout] 404 - while dequeue.back().map_or(false, |&b| nums[b] < ele) { //Remove all elements smaller than current [INFO] [stdout] 404 + while dequeue.back().is_some_and(|&b| nums[b] < ele) { //Remove all elements smaller than current [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: all variants have the same prefix: `Invalid` [INFO] [stdout] --> src/expression_conversion.rs:13:1 [INFO] [stdout] | [INFO] [stdout] 13 | / pub enum ExpressionError { [INFO] [stdout] 14 | | #[error("Invalid Operator")] [INFO] [stdout] 15 | | InvalidOperator, [INFO] [stdout] ... | [INFO] [stdout] 21 | | InvalidExpressionConversion, [INFO] [stdout] 22 | | } [INFO] [stdout] | |_^ [INFO] [stdout] | [INFO] [stdout] = help: remove the prefixes and use full paths to the variants instead of glob imports [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#enum_variant_names [INFO] [stdout] = note: `#[warn(clippy::enum_variant_names)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: non-canonical implementation of `partial_cmp` on an `Ord` type [INFO] [stdout] --> src/expression_conversion.rs:41:1 [INFO] [stdout] | [INFO] [stdout] 41 | / impl PartialOrd for Operator { [INFO] [stdout] 42 | | fn partial_cmp(&self, other: &Self) -> Option { [INFO] [stdout] 43 | | self.precedence().partial_cmp(&other.precedence()) [INFO] [stdout] 44 | | } [INFO] [stdout] 45 | | } [INFO] [stdout] | |_^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#non_canonical_partial_ord_impl [INFO] [stdout] = note: `#[warn(clippy::non_canonical_partial_ord_impl)]` on by default [INFO] [stdout] help: change this to [INFO] [stdout] | [INFO] [stdout] 42 - fn partial_cmp(&self, other: &Self) -> Option { [INFO] [stdout] 43 - self.precedence().partial_cmp(&other.precedence()) [INFO] [stdout] 44 - } [INFO] [stdout] 42 + fn partial_cmp(&self, other: &Self) -> Option { Some(self.cmp(other)) } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `map_or` can be simplified [INFO] [stdout] --> src/expression_conversion.rs:109:27 [INFO] [stdout] | [INFO] [stdout] 109 | while stack.back().map_or(false, |top| { [INFO] [stdout] | ___________________________^ [INFO] [stdout] 110 | | if let ExpressionElement::Operator(top_op) = top { [INFO] [stdout] 111 | | top_op >= op [INFO] [stdout] 112 | | } else { [INFO] [stdout] ... | [INFO] [stdout] 115 | | }) { [INFO] [stdout] | |______________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or [INFO] [stdout] help: use `is_some_and` instead [INFO] [stdout] | [INFO] [stdout] 109 - while stack.back().map_or(false, |top| { [INFO] [stdout] 109 + while stack.back().is_some_and(|top| { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unused variable: `root` [INFO] [stdout] --> src/binary_tress.rs:269:27 [INFO] [stdout] | [INFO] [stdout] 269 | pub fn vertical_traversal(root: Option>>) -> Vec> { [INFO] [stdout] | ^^^^ help: if this is intentional, prefix it with an underscore: `_root` [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unused variable: `root` [INFO] [stdout] --> src/binary_tress.rs:441:19 [INFO] [stdout] | [INFO] [stdout] 441 | pub fn distance_k(root: Option>>, target: Option>>, k: i32) -> Vec { [INFO] [stdout] | ^^^^ help: if this is intentional, prefix it with an underscore: `_root` [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unused variable: `target` [INFO] [stdout] --> src/binary_tress.rs:441:52 [INFO] [stdout] | [INFO] [stdout] 441 | pub fn distance_k(root: Option>>, target: Option>>, k: i32) -> Vec { [INFO] [stdout] | ^^^^^^ help: if this is intentional, prefix it with an underscore: `_target` [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unused variable: `k` [INFO] [stdout] --> src/binary_tress.rs:441:87 [INFO] [stdout] | [INFO] [stdout] 441 | pub fn distance_k(root: Option>>, target: Option>>, k: i32) -> Vec { [INFO] [stdout] | ^ help: if this is intentional, prefix it with an underscore: `_k` [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: variable `r` is assigned to, but never used [INFO] [stdout] --> src/two_pointer.rs:280:17 [INFO] [stdout] | [INFO] [stdout] 280 | let (mut l, mut r) = (0, 0); [INFO] [stdout] | ^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: consider using `_r` instead [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: value assigned to `r` is never read [INFO] [stdout] --> src/two_pointer.rs:311:9 [INFO] [stdout] | [INFO] [stdout] 311 | r = i; [INFO] [stdout] | ^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: maybe it is overwritten before being read? [INFO] [stdout] = note: `#[warn(unused_assignments)]` (part of `#[warn(unused)]`) on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: variable does not need to be mutable [INFO] [stdout] --> src/graphs.rs:1261:25 [INFO] [stdout] | [INFO] [stdout] 1261 | if let Some(mut weight) = positive_graph[u][v] { [INFO] [stdout] | ----^^^^^^ [INFO] [stdout] | | [INFO] [stdout] | help: remove this `mut` [INFO] [stdout] | [INFO] [stdout] = note: `#[warn(unused_mut)]` (part of `#[warn(unused)]`) on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: type `linked_lists::ListNode` is more private than the item `linked_lists::add_two_numbers` [INFO] [stdout] --> src/linked_lists.rs:160:1 [INFO] [stdout] | [INFO] [stdout] 160 | pub fn add_two_numbers(l1: Option>, l2: Option>) -> Option> { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function `linked_lists::add_two_numbers` is reachable at visibility `pub(crate)` [INFO] [stdout] | [INFO] [stdout] note: but type `linked_lists::ListNode` is only usable at visibility `pub(self)` [INFO] [stdout] --> src/linked_lists.rs:132:1 [INFO] [stdout] | [INFO] [stdout] 132 | struct ListNode { [INFO] [stdout] | ^^^^^^^^^^^^^^^ [INFO] [stdout] = note: `#[warn(private_interfaces)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/arrays.rs:56:5 [INFO] [stdout] | [INFO] [stdout] 56 | return if dip > 1 { false } else { true }; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] = note: `#[warn(clippy::needless_return)]` on by default [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 56 - return if dip > 1 { false } else { true }; [INFO] [stdout] 56 + if dip > 1 { false } else { true } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this if-then-else expression returns a bool literal [INFO] [stdout] --> src/arrays.rs:56:12 [INFO] [stdout] | [INFO] [stdout] 56 | return if dip > 1 { false } else { true }; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can reduce it to: `dip <= 1` [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: unneeded `return` statement [INFO] [stdout] --> src/arrays.rs:214:13 [INFO] [stdout] | [INFO] [stdout] 214 | return; [INFO] [stdout] | ^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 213 - arr.reverse(); [INFO] [stdout] 214 - return; [INFO] [stdout] 213 + arr.reverse(); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this boolean expression can be simplified [INFO] [stdout] --> src/arrays.rs:232:25 [INFO] [stdout] | [INFO] [stdout] 232 | .filter(|&&num| !set.get(&(num - 1)).is_some()) //If num - 1 is not in the set, num might be the start of a sequence [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `set.get(&(num - 1)).is_none()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#nonminimal_bool [INFO] [stdout] = note: `#[warn(clippy::nonminimal_bool)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unnecessary use of `get(&(num - 1)).is_some()` [INFO] [stdout] --> src/arrays.rs:232:30 [INFO] [stdout] | [INFO] [stdout] 232 | .filter(|&&num| !set.get(&(num - 1)).is_some()) //If num - 1 is not in the set, num might be the start of a sequence [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `contains(&(num - 1))` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_get_then_check [INFO] [stdout] = note: `#[warn(clippy::unnecessary_get_then_check)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unnecessary use of `get(&(current + 1)).is_some()` [INFO] [stdout] --> src/arrays.rs:237:23 [INFO] [stdout] | [INFO] [stdout] 237 | while set.get(&(current + 1)).is_some() { //Now, num is always the beginning of the sequence [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `contains(&(current + 1))` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_get_then_check [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do [INFO] [stdout] --> src/arrays.rs:269:27 [INFO] [stdout] | [INFO] [stdout] 269 | pub fn set_zeroes(matrix: &mut Vec>) { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg [INFO] [stdout] = note: `#[warn(clippy::ptr_arg)]` on by default [INFO] [stdout] help: change this to [INFO] [stdout] | [INFO] [stdout] 269 - pub fn set_zeroes(matrix: &mut Vec>) { [INFO] [stdout] 269 + pub fn set_zeroes(matrix: &mut [Vec]) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/arrays.rs:289:13 [INFO] [stdout] | [INFO] [stdout] 289 | / if matrix[i][j] != 0 { [INFO] [stdout] 290 | | if matrix[0][j] == 0 || matrix[i][0] == 0 { [INFO] [stdout] 291 | | matrix[i][j] = 0; [INFO] [stdout] 292 | | } [INFO] [stdout] 293 | | } [INFO] [stdout] | |_____________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] = note: `#[warn(clippy::collapsible_if)]` on by default [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 289 ~ if matrix[i][j] != 0 [INFO] [stdout] 290 ~ && (matrix[0][j] == 0 || matrix[i][0] == 0) { [INFO] [stdout] 291 | matrix[i][j] = 0; [INFO] [stdout] 292 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `j` is only used to index `matrix` [INFO] [stdout] --> src/arrays.rs:298:18 [INFO] [stdout] | [INFO] [stdout] 298 | for j in 0..m { [INFO] [stdout] | ^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] = note: `#[warn(clippy::needless_range_loop)]` on by default [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 298 - for j in 0..m { [INFO] [stdout] 298 + for in matrix.iter_mut().take(m) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is only used to index `matrix` [INFO] [stdout] --> src/arrays.rs:303:18 [INFO] [stdout] | [INFO] [stdout] 303 | for i in 0..n { [INFO] [stdout] | ^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 303 - for i in 0..n { [INFO] [stdout] 303 + for in matrix.iter_mut().take(n) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is only used to index `matrix` [INFO] [stdout] --> src/arrays.rs:317:18 [INFO] [stdout] | [INFO] [stdout] 317 | for i in left..=right { [INFO] [stdout] | ^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 317 - for i in left..=right { [INFO] [stdout] 317 + for in matrix.iter().take(right + 1).skip(left) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is only used to index `matrix` [INFO] [stdout] --> src/arrays.rs:322:18 [INFO] [stdout] | [INFO] [stdout] 322 | for i in top..=bottom { [INFO] [stdout] | ^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 322 - for i in top..=bottom { [INFO] [stdout] 322 + for in matrix.iter().take(bottom + 1).skip(top) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is only used to index `matrix` [INFO] [stdout] --> src/arrays.rs:335:22 [INFO] [stdout] | [INFO] [stdout] 335 | for i in top..=bottom { [INFO] [stdout] | ^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 335 - for i in top..=bottom { [INFO] [stdout] 335 + for in matrix.iter().take(bottom + 1).skip(top) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do [INFO] [stdout] --> src/arrays.rs:500:35 [INFO] [stdout] | [INFO] [stdout] 500 | pub fn merge_sorted_arrays(nums1: &mut Vec, m: i32, nums2: &Vec, n: i32) { [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] 500 - pub fn merge_sorted_arrays(nums1: &mut Vec, m: i32, nums2: &Vec, n: i32) { [INFO] [stdout] 500 + pub fn merge_sorted_arrays(nums1: &mut [i32], m: i32, nums2: &Vec, n: i32) { [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/arrays.rs:500:65 [INFO] [stdout] | [INFO] [stdout] 500 | pub fn merge_sorted_arrays(nums1: &mut Vec, m: i32, nums2: &Vec, n: i32) { [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] 500 - pub fn merge_sorted_arrays(nums1: &mut Vec, m: i32, nums2: &Vec, n: i32) { [INFO] [stdout] 500 + pub fn merge_sorted_arrays(nums1: &mut Vec, m: i32, nums2: &[i32], n: i32) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/arrays.rs:592:9 [INFO] [stdout] | [INFO] [stdout] 592 | assert_eq!(check(vec![3, 4, 5, 1, 2]), true); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparison [INFO] [stdout] = note: `#[warn(clippy::bool_assert_comparison)]` on by default [INFO] [stdout] help: replace it with `assert!(..)` [INFO] [stdout] | [INFO] [stdout] 592 - assert_eq!(check(vec![3, 4, 5, 1, 2]), true); [INFO] [stdout] 592 + assert!(check(vec![3, 4, 5, 1, 2])); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/arrays.rs:593:9 [INFO] [stdout] | [INFO] [stdout] 593 | assert_eq!(check(vec![2, 1, 3, 4]), false); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparison [INFO] [stdout] help: replace it with `assert!(..)` [INFO] [stdout] | [INFO] [stdout] 593 - assert_eq!(check(vec![2, 1, 3, 4]), false); [INFO] [stdout] 593 + assert!(!check(vec![2, 1, 3, 4])); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/arrays.rs:594:9 [INFO] [stdout] | [INFO] [stdout] 594 | assert_eq!(check(vec![1, 2, 3]), true); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparison [INFO] [stdout] help: replace it with `assert!(..)` [INFO] [stdout] | [INFO] [stdout] 594 - assert_eq!(check(vec![1, 2, 3]), true); [INFO] [stdout] 594 + assert!(check(vec![1, 2, 3])); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of an assign operation [INFO] [stdout] --> src/bit_manipulation.rs:16:5 [INFO] [stdout] | [INFO] [stdout] 16 | *a = *a ^ *b; // a = a ^ b [INFO] [stdout] | ^^^^^^^^^^^^ help: replace it with: `*a ^= *b` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assign_op_pattern [INFO] [stdout] = note: `#[warn(clippy::assign_op_pattern)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of an assign operation [INFO] [stdout] --> src/bit_manipulation.rs:17:5 [INFO] [stdout] | [INFO] [stdout] 17 | *b = *a ^ *b; // b = (a ^ b) ^ b = a [INFO] [stdout] | ^^^^^^^^^^^^ help: replace it with: `*b ^= *a` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assign_op_pattern [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of an assign operation [INFO] [stdout] --> src/bit_manipulation.rs:18:5 [INFO] [stdout] | [INFO] [stdout] 18 | *a = *a ^ *b; // a = (a ^ b) ^ a = a [INFO] [stdout] | ^^^^^^^^^^^^ help: replace it with: `*a ^= *b` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assign_op_pattern [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/bit_manipulation.rs:28:5 [INFO] [stdout] | [INFO] [stdout] 28 | / return if num & mask == 0 { [INFO] [stdout] 29 | | false [INFO] [stdout] 30 | | } else { [INFO] [stdout] 31 | | true [INFO] [stdout] 32 | | }; [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 28 ~ if num & mask == 0 { [INFO] [stdout] 29 + false [INFO] [stdout] 30 + } else { [INFO] [stdout] 31 + true [INFO] [stdout] 32 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this if-then-else expression returns a bool literal [INFO] [stdout] --> src/bit_manipulation.rs:28:12 [INFO] [stdout] | [INFO] [stdout] 28 | return if num & mask == 0 { [INFO] [stdout] | ____________^ [INFO] [stdout] 29 | | false [INFO] [stdout] 30 | | } else { [INFO] [stdout] 31 | | true [INFO] [stdout] 32 | | }; [INFO] [stdout] | |_____^ help: you can reduce it to: `num & mask != 0` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_bool [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of an assign operation [INFO] [stdout] --> src/bit_manipulation.rs:40:5 [INFO] [stdout] | [INFO] [stdout] 40 | *num = *num | mask; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^ help: replace it with: `*num |= mask` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assign_op_pattern [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of an assign operation [INFO] [stdout] --> src/bit_manipulation.rs:46:5 [INFO] [stdout] | [INFO] [stdout] 46 | *num = *num & mask; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^ help: replace it with: `*num &= mask` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assign_op_pattern [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of an assign operation [INFO] [stdout] --> src/bit_manipulation.rs:53:5 [INFO] [stdout] | [INFO] [stdout] 53 | *num = *num ^ mask; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^ help: replace it with: `*num ^= mask` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assign_op_pattern [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/bit_manipulation.rs:63:5 [INFO] [stdout] | [INFO] [stdout] 63 | / return if num & (num - 1) == 0 { [INFO] [stdout] 64 | | true [INFO] [stdout] 65 | | } else { [INFO] [stdout] 66 | | false [INFO] [stdout] 67 | | }; [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 63 ~ if num & (num - 1) == 0 { [INFO] [stdout] 64 + true [INFO] [stdout] 65 + } else { [INFO] [stdout] 66 + false [INFO] [stdout] 67 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this if-then-else expression returns a bool literal [INFO] [stdout] --> src/bit_manipulation.rs:63:12 [INFO] [stdout] | [INFO] [stdout] 63 | return if num & (num - 1) == 0 { [INFO] [stdout] | ____________^ [INFO] [stdout] 64 | | true [INFO] [stdout] 65 | | } else { [INFO] [stdout] 66 | | false [INFO] [stdout] 67 | | }; [INFO] [stdout] | |_____^ help: you can reduce it to: `num & (num - 1) == 0` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_bool [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is used to index `arr` [INFO] [stdout] --> src/bit_manipulation.rs:107:18 [INFO] [stdout] | [INFO] [stdout] 107 | for i in 0..arr.len() { [INFO] [stdout] | ^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator and enumerate() [INFO] [stdout] | [INFO] [stdout] 107 - for i in 0..arr.len() { [INFO] [stdout] 107 + for (i, ) in arr.iter().enumerate() { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/bit_manipulation.rs:207:5 [INFO] [stdout] | [INFO] [stdout] 207 | / return if sign { [INFO] [stdout] 208 | | quotient [INFO] [stdout] 209 | | } else { [INFO] [stdout] 210 | | -quotient [INFO] [stdout] 211 | | }; [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 207 ~ if sign { [INFO] [stdout] 208 + quotient [INFO] [stdout] 209 + } else { [INFO] [stdout] 210 + -quotient [INFO] [stdout] 211 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` has identical blocks [INFO] [stdout] --> src/bit_manipulation.rs:179:37 [INFO] [stdout] | [INFO] [stdout] 179 | if dividend >= 0 && divisor < 0 { [INFO] [stdout] | _____________________________________^ [INFO] [stdout] 180 | | sign = false; [INFO] [stdout] 181 | | } else if dividend <= 0 && divisor > 0 { [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] note: same as this [INFO] [stdout] --> src/bit_manipulation.rs:181:44 [INFO] [stdout] | [INFO] [stdout] 181 | } else if dividend <= 0 && divisor > 0 { [INFO] [stdout] | ____________________________________________^ [INFO] [stdout] 182 | | sign = false; [INFO] [stdout] 183 | | } [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: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/bit_manipulation.rs:237:9 [INFO] [stdout] | [INFO] [stdout] 237 | assert_eq!(check_kth_bit(0b10101, 0), true); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparison [INFO] [stdout] help: replace it with `assert!(..)` [INFO] [stdout] | [INFO] [stdout] 237 - assert_eq!(check_kth_bit(0b10101, 0), true); [INFO] [stdout] 237 + assert!(check_kth_bit(0b10101, 0)); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/bit_manipulation.rs:238:9 [INFO] [stdout] | [INFO] [stdout] 238 | assert_eq!(check_kth_bit(0b10101, 1), false); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparison [INFO] [stdout] help: replace it with `assert!(..)` [INFO] [stdout] | [INFO] [stdout] 238 - assert_eq!(check_kth_bit(0b10101, 1), false); [INFO] [stdout] 238 + assert!(!check_kth_bit(0b10101, 1)); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/bit_manipulation.rs:281:9 [INFO] [stdout] | [INFO] [stdout] 281 | assert_eq!(is_power_of_2(16), true); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparison [INFO] [stdout] help: replace it with `assert!(..)` [INFO] [stdout] | [INFO] [stdout] 281 - assert_eq!(is_power_of_2(16), true); [INFO] [stdout] 281 + assert!(is_power_of_2(16)); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/bit_manipulation.rs:282:9 [INFO] [stdout] | [INFO] [stdout] 282 | assert_eq!(is_power_of_2(1), true); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparison [INFO] [stdout] help: replace it with `assert!(..)` [INFO] [stdout] | [INFO] [stdout] 282 - assert_eq!(is_power_of_2(1), true); [INFO] [stdout] 282 + assert!(is_power_of_2(1)); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/binary_search.rs:92:5 [INFO] [stdout] | [INFO] [stdout] 92 | / return if let Some(first) = first_occurrence { [INFO] [stdout] 93 | | if arr[first] != target { [INFO] [stdout] 94 | | None [INFO] [stdout] 95 | | } else { [INFO] [stdout] ... | [INFO] [stdout] 99 | | None [INFO] [stdout] 100 | | }; [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 92 ~ if let Some(first) = first_occurrence { [INFO] [stdout] 93 + if arr[first] != target { [INFO] [stdout] 94 + None [INFO] [stdout] 95 + } else { [INFO] [stdout] 96 + Some((first, last_occurrence.unwrap_or(arr.len()) - 1)) //If last_occurrence is None, it means that target is the last element [INFO] [stdout] 97 + } [INFO] [stdout] 98 + } else { [INFO] [stdout] 99 + None [INFO] [stdout] 100 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual saturating arithmetic [INFO] [stdout] --> src/binary_search.rs:154:20 [INFO] [stdout] | [INFO] [stdout] 154 | high = high.checked_sub(1).unwrap_or(0); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `saturating_sub`: `high.saturating_sub(1)` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_saturating_arithmetic [INFO] [stdout] = note: `#[warn(clippy::manual_saturating_arithmetic)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of an assign operation [INFO] [stdout] --> src/binary_search.rs:304:13 [INFO] [stdout] | [INFO] [stdout] 304 | high = high - 1; [INFO] [stdout] | ^^^^^^^^^^^^^^^ help: replace it with: `high -= 1` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assign_op_pattern [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/binary_search.rs:475:9 [INFO] [stdout] | [INFO] [stdout] 475 | / return if number_cows >= cows { [INFO] [stdout] 476 | | true [INFO] [stdout] 477 | | } else { [INFO] [stdout] 478 | | false [INFO] [stdout] 479 | | }; [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 475 ~ if number_cows >= cows { [INFO] [stdout] 476 + true [INFO] [stdout] 477 + } else { [INFO] [stdout] 478 + false [INFO] [stdout] 479 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this if-then-else expression returns a bool literal [INFO] [stdout] --> src/binary_search.rs:475:16 [INFO] [stdout] | [INFO] [stdout] 475 | return if number_cows >= cows { [INFO] [stdout] | ________________^ [INFO] [stdout] 476 | | true [INFO] [stdout] 477 | | } else { [INFO] [stdout] 478 | | false [INFO] [stdout] 479 | | }; [INFO] [stdout] | |_________^ help: you can reduce it to: `number_cows >= cows` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_bool [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manually reimplementing `div_ceil` [INFO] [stdout] --> src/binary_search.rs:574:16 [INFO] [stdout] | [INFO] [stdout] 574 | let left = (n + 1) / 2; //Number of elements to the left of the median [INFO] [stdout] | ^^^^^^^^^^^ help: consider using `.div_ceil()`: `n.div_ceil(2)` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_div_ceil [INFO] [stdout] = note: `#[warn(clippy::manual_div_ceil)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manually reimplementing `div_ceil` [INFO] [stdout] --> src/binary_search.rs:610:16 [INFO] [stdout] | [INFO] [stdout] 610 | let left = (n + 1) / 2; //Number of elements to the left of the median [INFO] [stdout] | ^^^^^^^^^^^ help: consider using `.div_ceil()`: `n.div_ceil(2)` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_div_ceil [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do [INFO] [stdout] --> src/binary_search.rs:644:32 [INFO] [stdout] | [INFO] [stdout] 644 | pub fn row_with_max_1s(matrix: &Vec>) -> Option { //Here, we are given a matrix of 0s and 1s, with each row being s... [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] 644 - pub fn row_with_max_1s(matrix: &Vec>) -> Option { //Here, we are given a matrix of 0s and 1s, with each row being sorted [INFO] [stdout] 644 + pub fn row_with_max_1s(matrix: &[Vec]) -> Option { //Here, we are given a matrix of 0s and 1s, with each row being sorted [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/binary_search.rs:660:30 [INFO] [stdout] | [INFO] [stdout] 660 | pub fn search_matrix(matrix: &Vec>, target: i32) -> Option<(usize, usize)> { [INFO] [stdout] | ^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg [INFO] [stdout] help: change this to [INFO] [stdout] | [INFO] [stdout] 660 - pub fn search_matrix(matrix: &Vec>, target: i32) -> Option<(usize, usize)> { [INFO] [stdout] 660 + pub fn search_matrix(matrix: &[Vec], target: i32) -> Option<(usize, usize)> { [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/binary_search.rs:684:36 [INFO] [stdout] | [INFO] [stdout] 684 | pub fn search_matrix_again(matrix: &Vec>, target: i32) -> Option<(usize, usize)> { [INFO] [stdout] | ^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg [INFO] [stdout] help: change this to [INFO] [stdout] | [INFO] [stdout] 684 - pub fn search_matrix_again(matrix: &Vec>, target: i32) -> Option<(usize, usize)> { [INFO] [stdout] 684 + pub fn search_matrix_again(matrix: &[Vec], target: i32) -> Option<(usize, usize)> { [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/binary_search.rs:701:31 [INFO] [stdout] | [INFO] [stdout] 701 | pub fn find_peak_grid(matrix: &Vec>) -> Option<(usize, usize)> { [INFO] [stdout] | ^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg [INFO] [stdout] help: change this to [INFO] [stdout] | [INFO] [stdout] 701 - pub fn find_peak_grid(matrix: &Vec>) -> Option<(usize, usize)> { [INFO] [stdout] 701 + pub fn find_peak_grid(matrix: &[Vec]) -> Option<(usize, usize)> { [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/binary_search.rs:725:35 [INFO] [stdout] | [INFO] [stdout] 725 | pub fn find_peak_grid_row(matrix: &Vec>) -> Option<(usize, usize)> { //Gives TLE [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] 725 - pub fn find_peak_grid_row(matrix: &Vec>) -> Option<(usize, usize)> { //Gives TLE [INFO] [stdout] 725 + pub fn find_peak_grid_row(matrix: &[Vec]) -> Option<(usize, usize)> { //Gives TLE [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/binary_search.rs:747:37 [INFO] [stdout] | [INFO] [stdout] 747 | pub fn median_sorted_matrix(matrix: &Vec>) -> i32 { //We are given that the matrix: n ⨉ m, n and m are both odd [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] 747 - pub fn median_sorted_matrix(matrix: &Vec>) -> i32 { //We are given that the matrix: n ⨉ m, n and m are both odd [INFO] [stdout] 747 + pub fn median_sorted_matrix(matrix: &[Vec]) -> i32 { //We are given that the matrix: n ⨉ m, n and m are both odd [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/binary_search.rs:821:9 [INFO] [stdout] | [INFO] [stdout] 821 | assert_eq!(search_sorted(&[2, 5, 6, 0, 0, 1, 2], 3), false); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparison [INFO] [stdout] help: replace it with `assert!(..)` [INFO] [stdout] | [INFO] [stdout] 821 - assert_eq!(search_sorted(&[2, 5, 6, 0, 0, 1, 2], 3), false); [INFO] [stdout] 821 + assert!(!search_sorted(&[2, 5, 6, 0, 0, 1, 2], 3)); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/doubly_linked_list.rs:61:69 [INFO] [stdout] | [INFO] [stdout] 61 | old_head.borrow_mut().prev = Some(Rc::downgrade(&h)); [INFO] [stdout] | ^^ help: change this to: `h` [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/doubly_linked_list.rs:76:48 [INFO] [stdout] | [INFO] [stdout] 76 | node.prev = Some(Rc::downgrade(&old_tail)); [INFO] [stdout] | ^^^^^^^^^ help: change this to: `old_tail` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/doubly_linked_list.rs:142:60 [INFO] [stdout] | [INFO] [stdout] 142 | current_borrowed.prev = Some(Rc::downgrade(&next)); [INFO] [stdout] | ^^^^^ help: change this to: `next` [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` statement can be collapsed [INFO] [stdout] --> src/recursion.rs:79:9 [INFO] [stdout] | [INFO] [stdout] 79 | / if close > 0 { [INFO] [stdout] 80 | | if open < close { //If the number of open in the string is more, we must use a closing bracket [INFO] [stdout] 81 | | s.push(')'); [INFO] [stdout] 82 | | generate(ans, s, open, close - 1); [INFO] [stdout] ... | [INFO] [stdout] 85 | | } [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 79 ~ if close > 0 [INFO] [stdout] 80 ~ && open < close { //If the number of open in the string is more, we must use a closing bracket [INFO] [stdout] 81 | s.push(')'); [INFO] [stdout] 82 | generate(ans, s, open, close - 1); [INFO] [stdout] 83 | s.pop(); [INFO] [stdout] 84 ~ } [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/recursion.rs:117:42 [INFO] [stdout] | [INFO] [stdout] 117 | pub fn combination_sum_again(candidates: &Vec, target: i32) -> 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] 117 ~ pub fn combination_sum_again(candidates: &[i32], target: i32) -> Vec> { [INFO] [stdout] 118 ~ let mut candidates = candidates.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/recursion.rs:271:61 [INFO] [stdout] | [INFO] [stdout] 271 | fn is_safe(n: usize, row: usize, col: usize, board: &Vec>) -> bool { [INFO] [stdout] | ^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg [INFO] [stdout] help: change this to [INFO] [stdout] | [INFO] [stdout] 271 - fn is_safe(n: usize, row: usize, col: usize, board: &Vec>) -> bool { [INFO] [stdout] 271 + fn is_safe(n: usize, row: usize, col: usize, board: &[Vec]) -> bool { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is only used to index `board` [INFO] [stdout] --> src/recursion.rs:273:22 [INFO] [stdout] | [INFO] [stdout] 273 | for i in 0..col { [INFO] [stdout] | ^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 273 - for i in 0..col { [INFO] [stdout] 273 + for in board.iter().take(col) { [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/recursion.rs:321:28 [INFO] [stdout] | [INFO] [stdout] 321 | pub fn is_valid(board: &Vec>, row: usize, col: usize, c: char) -> bool { [INFO] [stdout] | ^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg [INFO] [stdout] help: change this to [INFO] [stdout] | [INFO] [stdout] 321 - pub fn is_valid(board: &Vec>, row: usize, col: usize, c: char) -> bool { [INFO] [stdout] 321 + pub fn is_valid(board: &[Vec], row: usize, col: usize, c: char) -> bool { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do [INFO] [stdout] --> src/recursion.rs:362:36 [INFO] [stdout] | [INFO] [stdout] 362 | fn is_safe(node: usize, color: &Vec, adj_matrix: &Vec>, crayon: i32) -> bool { [INFO] [stdout] | ^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg [INFO] [stdout] help: change this to [INFO] [stdout] | [INFO] [stdout] 362 - fn is_safe(node: usize, color: &Vec, adj_matrix: &Vec>, crayon: i32) -> bool { [INFO] [stdout] 362 + fn is_safe(node: usize, color: &[i32], adj_matrix: &Vec>, crayon: i32) -> bool { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do [INFO] [stdout] --> src/recursion.rs:362:59 [INFO] [stdout] | [INFO] [stdout] 362 | fn is_safe(node: usize, color: &Vec, adj_matrix: &Vec>, crayon: i32) -> bool { [INFO] [stdout] | ^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg [INFO] [stdout] help: change this to [INFO] [stdout] | [INFO] [stdout] 362 - fn is_safe(node: usize, color: &Vec, adj_matrix: &Vec>, crayon: i32) -> bool { [INFO] [stdout] 362 + fn is_safe(node: usize, color: &Vec, adj_matrix: &[Vec], crayon: i32) -> bool { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: length comparison to zero [INFO] [stdout] --> src/recursion.rs:429:12 [INFO] [stdout] | [INFO] [stdout] 429 | if arr.len() == 0 { [INFO] [stdout] | ^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `arr.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: this `if` can be collapsed into the outer `match` [INFO] [stdout] --> src/greedy.rs:29:17 [INFO] [stdout] | [INFO] [stdout] 29 | / if five > 0 { [INFO] [stdout] 30 | | five -= 1; [INFO] [stdout] 31 | | ten += 1; [INFO] [stdout] 32 | | } else { [INFO] [stdout] 33 | | return false; [INFO] [stdout] 34 | | } [INFO] [stdout] | |_________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_match [INFO] [stdout] = note: `#[warn(clippy::collapsible_match)]` on by default [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 28 ~ 10 [INFO] [stdout] 29 ~ if five > 0 => { [INFO] [stdout] 30 | five -= 1; [INFO] [stdout] 31 | ten += 1; [INFO] [stdout] 32 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: consider using `sort_by_key` [INFO] [stdout] --> src/greedy.rs:96:5 [INFO] [stdout] | [INFO] [stdout] 96 | jobs.sort_by(|a, b| b.profit.cmp(&a.profit)); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_sort_by [INFO] [stdout] = note: `#[warn(clippy::unnecessary_sort_by)]` on by default [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 96 - jobs.sort_by(|a, b| b.profit.cmp(&a.profit)); [INFO] [stdout] 96 + jobs.sort_by_key(|b| std::cmp::Reverse(b.profit)); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: consider using `sort_by_key` [INFO] [stdout] --> src/greedy.rs:136:5 [INFO] [stdout] | [INFO] [stdout] 136 | intervals.sort_by(|&a, &b| a.1.cmp(&b.1)); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_sort_by [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 136 - intervals.sort_by(|&a, &b| a.1.cmp(&b.1)); [INFO] [stdout] 136 + intervals.sort_by_key(|&a| a.1); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of an assign operation [INFO] [stdout] --> src/greedy.rs:232:13 [INFO] [stdout] | [INFO] [stdout] 232 | sum = sum + 1; [INFO] [stdout] | ^^^^^^^^^^^^^ help: replace it with: `sum += 1` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assign_op_pattern [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/greedy.rs:321:9 [INFO] [stdout] | [INFO] [stdout] 321 | assert_eq!(lemonade_change(vec![5, 5, 5, 10, 20]), true); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparison [INFO] [stdout] help: replace it with `assert!(..)` [INFO] [stdout] | [INFO] [stdout] 321 - assert_eq!(lemonade_change(vec![5, 5, 5, 10, 20]), true); [INFO] [stdout] 321 + assert!(lemonade_change(vec![5, 5, 5, 10, 20])); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/greedy.rs:322:9 [INFO] [stdout] | [INFO] [stdout] 322 | assert_eq!(lemonade_change(vec![5, 5, 10, 10, 20]), false); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparison [INFO] [stdout] help: replace it with `assert!(..)` [INFO] [stdout] | [INFO] [stdout] 322 - assert_eq!(lemonade_change(vec![5, 5, 10, 10, 20]), false); [INFO] [stdout] 322 + assert!(!lemonade_change(vec![5, 5, 10, 10, 20])); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/greedy.rs:327:9 [INFO] [stdout] | [INFO] [stdout] 327 | assert_eq!(can_jump(vec![2, 3, 1, 1, 4]), true); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparison [INFO] [stdout] help: replace it with `assert!(..)` [INFO] [stdout] | [INFO] [stdout] 327 - assert_eq!(can_jump(vec![2, 3, 1, 1, 4]), true); [INFO] [stdout] 327 + assert!(can_jump(vec![2, 3, 1, 1, 4])); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/greedy.rs:328:9 [INFO] [stdout] | [INFO] [stdout] 328 | assert_eq!(can_jump(vec![3, 2, 1, 0, 4]), false); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparison [INFO] [stdout] help: replace it with `assert!(..)` [INFO] [stdout] | [INFO] [stdout] 328 - assert_eq!(can_jump(vec![3, 2, 1, 0, 4]), false); [INFO] [stdout] 328 + assert!(!can_jump(vec![3, 2, 1, 0, 4])); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/math.rs:28:5 [INFO] [stdout] | [INFO] [stdout] 28 | / return if a > b { [INFO] [stdout] 29 | | gcd(a % b, b) [INFO] [stdout] 30 | | } else { [INFO] [stdout] 31 | | gcd(b % a, a) [INFO] [stdout] 32 | | } [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 28 ~ if a > b { [INFO] [stdout] 29 + gcd(a % b, b) [INFO] [stdout] 30 + } else { [INFO] [stdout] 31 + gcd(b % a, a) [INFO] [stdout] 32 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/dynamic_programming.rs:71:5 [INFO] [stdout] | [INFO] [stdout] 71 | return std::cmp::min(one, two); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 71 - return std::cmp::min(one, two); [INFO] [stdout] 71 + std::cmp::min(one, two) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/dynamic_programming.rs:94:9 [INFO] [stdout] | [INFO] [stdout] 94 | return dp[n - 1]; [INFO] [stdout] | ^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 94 - return dp[n - 1]; [INFO] [stdout] 94 + dp[n - 1] [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `day` is only used to index `points` [INFO] [stdout] --> src/dynamic_programming.rs:202:16 [INFO] [stdout] | [INFO] [stdout] 202 | for day in 1..points.len() { [INFO] [stdout] | ^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 202 - for day in 1..points.len() { [INFO] [stdout] 202 + for in points.iter().skip(1) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `prev_task` is used to index `dp` [INFO] [stdout] --> src/dynamic_programming.rs:205:30 [INFO] [stdout] | [INFO] [stdout] 205 | for prev_task in 0..3 { [INFO] [stdout] | ^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator and enumerate() [INFO] [stdout] | [INFO] [stdout] 205 - for prev_task in 0..3 { [INFO] [stdout] 205 + for (prev_task, ) in dp.iter().enumerate().take(3) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/dynamic_programming.rs:226:5 [INFO] [stdout] | [INFO] [stdout] 226 | return unique_paths_recursive(m - 1, n) + unique_paths_recursive(m, n - 1); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 226 - return unique_paths_recursive(m - 1, n) + unique_paths_recursive(m, n - 1); [INFO] [stdout] 226 + unique_paths_recursive(m - 1, n) + unique_paths_recursive(m, n - 1) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is only used to index `obstacle_grid` [INFO] [stdout] --> src/dynamic_programming.rs:295:14 [INFO] [stdout] | [INFO] [stdout] 295 | for i in 0..m { [INFO] [stdout] | ^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 295 - for i in 0..m { [INFO] [stdout] 295 + for in obstacle_grid.iter().take(m) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/dynamic_programming.rs:326:9 [INFO] [stdout] | [INFO] [stdout] 326 | return grid[m][n] + std::cmp::min(helper(grid, m - 1, n), helper(grid, m, n - 1)); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 326 - return grid[m][n] + std::cmp::min(helper(grid, m - 1, n), helper(grid, m, n - 1)); [INFO] [stdout] 326 + grid[m][n] + std::cmp::min(helper(grid, m - 1, n), helper(grid, m, n - 1)) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is used to index `grid` [INFO] [stdout] --> src/dynamic_programming.rs:360:14 [INFO] [stdout] | [INFO] [stdout] 360 | for i in 0..m { [INFO] [stdout] | ^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator and enumerate() [INFO] [stdout] | [INFO] [stdout] 360 - for i in 0..m { [INFO] [stdout] 360 + for (i, ) in grid.iter().enumerate().take(m) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is only used to index `matrix` [INFO] [stdout] --> src/dynamic_programming.rs:435:14 [INFO] [stdout] | [INFO] [stdout] 435 | for i in 1..rows { [INFO] [stdout] | ^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 435 - for i in 1..rows { [INFO] [stdout] 435 + for in matrix.iter().take(rows).skip(1) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `.filter_map(..)` can be written more simply using `.map(..)` [INFO] [stdout] --> src/dynamic_programming.rs:518:22 [INFO] [stdout] | [INFO] [stdout] 518 | .filter_map(|(&delta_alice, &delta_bob)| { [INFO] [stdout] | ______________________^ [INFO] [stdout] 519 | | let alice_next = (alice as isize + delta_alice).clamp(0, (cols - 1) as isize) as usize; [INFO] [stdout] 520 | | let bob_next = (bob as isize + delta_bob).clamp(0, (cols - 1) as isize) as usize; [INFO] [stdout] 521 | | let val = if alice == bob { [INFO] [stdout] ... | [INFO] [stdout] 526 | | Some(val + dp[row + 1][alice_next][bob_next]) [INFO] [stdout] 527 | | }) [INFO] [stdout] | |______________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_filter_map [INFO] [stdout] = note: `#[warn(clippy::unnecessary_filter_map)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is only used to index `dp` [INFO] [stdout] --> src/dynamic_programming.rs:563:14 [INFO] [stdout] | [INFO] [stdout] 563 | for i in 0..arr.len() { [INFO] [stdout] | ^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 563 - for i in 0..arr.len() { [INFO] [stdout] 563 + for in dp.iter_mut().take(arr.len()) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is only used to index `dp` [INFO] [stdout] --> src/dynamic_programming.rs:604:14 [INFO] [stdout] | [INFO] [stdout] 604 | for i in 0..nums.len() { [INFO] [stdout] | ^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 604 - for i in 0..nums.len() { [INFO] [stdout] 604 + for in dp.iter_mut().take(nums.len()) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is used to index `dp` [INFO] [stdout] --> src/dynamic_programming.rs:622:14 [INFO] [stdout] | [INFO] [stdout] 622 | for i in 0..=total_sum / 2 { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator and enumerate() [INFO] [stdout] | [INFO] [stdout] 622 - for i in 0..=total_sum / 2 { [INFO] [stdout] 622 + for (i, ) in dp.iter().enumerate().take(total_sum / 2 + 1) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is only used to index `dp` [INFO] [stdout] --> src/dynamic_programming.rs:636:14 [INFO] [stdout] | [INFO] [stdout] 636 | for i in 0..arr.len() { [INFO] [stdout] | ^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 636 - for i in 0..arr.len() { [INFO] [stdout] 636 + for in dp.iter_mut().take(arr.len()) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/dynamic_programming.rs:689:9 [INFO] [stdout] | [INFO] [stdout] 689 | return dp[index][sum as usize]; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 689 - return dp[index][sum as usize]; [INFO] [stdout] 689 + dp[index][sum as usize] [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `weight` is only used to index `dp` [INFO] [stdout] --> src/dynamic_programming.rs:709:19 [INFO] [stdout] | [INFO] [stdout] 709 | for weight in items[0].0..=capacity { //Base Case [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 709 - for weight in items[0].0..=capacity { //Base Case [INFO] [stdout] 709 + for in dp.iter_mut().take(capacity + 1).skip(items[0].0) { //Base Case [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `weight` is only used to index `dp` [INFO] [stdout] --> src/dynamic_programming.rs:734:19 [INFO] [stdout] | [INFO] [stdout] 734 | for weight in items[0].0..=capacity { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 734 - for weight in items[0].0..=capacity { [INFO] [stdout] 734 + for in dp.iter_mut().take(capacity + 1).skip(items[0].0) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `sum` is used to index `prev` [INFO] [stdout] --> src/dynamic_programming.rs:758:16 [INFO] [stdout] | [INFO] [stdout] 758 | for sum in 0..=amount_usize { [INFO] [stdout] | ^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator and enumerate() [INFO] [stdout] | [INFO] [stdout] 758 - for sum in 0..=amount_usize { [INFO] [stdout] 758 + for (sum, ) in prev.iter_mut().enumerate().take(amount_usize + 1) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `sum` is used to index `prev` [INFO] [stdout] --> src/dynamic_programming.rs:814:16 [INFO] [stdout] | [INFO] [stdout] 814 | for sum in 0..=amount_usize { [INFO] [stdout] | ^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator and enumerate() [INFO] [stdout] | [INFO] [stdout] 814 - for sum in 0..=amount_usize { [INFO] [stdout] 814 + for (sum, ) in prev.iter_mut().enumerate().take(amount_usize + 1) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `length` is used to index `dp` [INFO] [stdout] --> src/dynamic_programming.rs:843:19 [INFO] [stdout] | [INFO] [stdout] 843 | for length in 0..=rod_length { [INFO] [stdout] | ^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator and enumerate() [INFO] [stdout] | [INFO] [stdout] 843 - for length in 0..=rod_length { [INFO] [stdout] 843 + for (length, ) in dp.iter_mut().enumerate().take(rod_length + 1) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is only used to index `dp` [INFO] [stdout] --> src/dynamic_programming.rs:869:14 [INFO] [stdout] | [INFO] [stdout] 869 | for i in 0..=n { [INFO] [stdout] | ^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 869 - for i in 0..=n { [INFO] [stdout] 869 + for in dp.iter_mut().take(n + 1) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `j` is only used to index `dp` [INFO] [stdout] --> src/dynamic_programming.rs:872:14 [INFO] [stdout] | [INFO] [stdout] 872 | for j in 0..=m { [INFO] [stdout] | ^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 872 - for j in 0..=m { [INFO] [stdout] 872 + for in dp.iter_mut().take(m + 1) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is only used to index `dp` [INFO] [stdout] --> src/dynamic_programming.rs:897:14 [INFO] [stdout] | [INFO] [stdout] 897 | for i in 0..=n { [INFO] [stdout] | ^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 897 - for i in 0..=n { [INFO] [stdout] 897 + for in dp.iter_mut().take(n + 1) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `j` is only used to index `dp` [INFO] [stdout] --> src/dynamic_programming.rs:900:14 [INFO] [stdout] | [INFO] [stdout] 900 | for j in 0..=m { [INFO] [stdout] | ^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 900 - for j in 0..=m { [INFO] [stdout] 900 + for in dp.iter_mut().take(m + 1) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is only used to index `dp` [INFO] [stdout] --> src/dynamic_programming.rs:923:14 [INFO] [stdout] | [INFO] [stdout] 923 | for i in 0..=n { [INFO] [stdout] | ^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 923 - for i in 0..=n { [INFO] [stdout] 923 + for in dp.iter_mut().take(n + 1) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `j` is only used to index `dp` [INFO] [stdout] --> src/dynamic_programming.rs:926:14 [INFO] [stdout] | [INFO] [stdout] 926 | for j in 0..=m { [INFO] [stdout] | ^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 926 - for j in 0..=m { [INFO] [stdout] 926 + for in dp.iter_mut().take(m + 1) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `j` is used to index `prev` [INFO] [stdout] --> src/dynamic_programming.rs:1002:14 [INFO] [stdout] | [INFO] [stdout] 1002 | for j in 0..=m { //Base Case [INFO] [stdout] | ^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator and enumerate() [INFO] [stdout] | [INFO] [stdout] 1002 - for j in 0..=m { //Base Case [INFO] [stdout] 1002 + for (j, ) in prev.iter_mut().enumerate().take(m + 1) { //Base Case [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `can_buy` is used to index `curr` [INFO] [stdout] --> src/dynamic_programming.rs:1062:24 [INFO] [stdout] | [INFO] [stdout] 1062 | for can_buy in 0..=1 { [INFO] [stdout] | ^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator and enumerate() [INFO] [stdout] | [INFO] [stdout] 1062 - for can_buy in 0..=1 { [INFO] [stdout] 1062 + for (can_buy, ) in curr.iter_mut().enumerate().take(1 + 1) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `can_buy` is used to index `curr` [INFO] [stdout] --> src/dynamic_programming.rs:1095:24 [INFO] [stdout] | [INFO] [stdout] 1095 | for can_buy in 0..=1 { [INFO] [stdout] | ^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator and enumerate() [INFO] [stdout] | [INFO] [stdout] 1095 - for can_buy in 0..=1 { [INFO] [stdout] 1095 + for (can_buy, ) in curr.iter_mut().enumerate().take(1 + 1) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: consider using `sort_unstable_by_key` [INFO] [stdout] --> src/dynamic_programming.rs:1234:5 [INFO] [stdout] | [INFO] [stdout] 1234 | words.sort_unstable_by(|a, b| a.len().cmp(&b.len())); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_sort_by [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 1234 - words.sort_unstable_by(|a, b| a.len().cmp(&b.len())); [INFO] [stdout] 1234 + words.sort_unstable_by_key(|a| a.len()); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: consider using `sort_unstable_by_key` [INFO] [stdout] --> src/dynamic_programming.rs:1272:5 [INFO] [stdout] | [INFO] [stdout] 1272 | words.sort_unstable_by(|a, b| a.len().cmp(&b.len())); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_sort_by [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 1272 - words.sort_unstable_by(|a, b| a.len().cmp(&b.len())); [INFO] [stdout] 1272 + words.sort_unstable_by_key(|a| a.len()); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is used to index `dp` [INFO] [stdout] --> src/dynamic_programming.rs:1397:14 [INFO] [stdout] | [INFO] [stdout] 1397 | for i in 1..matrices.len() { //Base Case [INFO] [stdout] | ^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator and enumerate() [INFO] [stdout] | [INFO] [stdout] 1397 - for i in 1..matrices.len() { //Base Case [INFO] [stdout] 1397 + for (i, ) in dp.iter_mut().enumerate().take(matrices.len()).skip(1) { //Base Case [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/dynamic_programming.rs:1794:9 [INFO] [stdout] | [INFO] [stdout] 1794 | assert_eq!(subset_sum_recursive(arr.clone(), target1), true); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparison [INFO] [stdout] help: replace it with `assert!(..)` [INFO] [stdout] | [INFO] [stdout] 1794 - assert_eq!(subset_sum_recursive(arr.clone(), target1), true); [INFO] [stdout] 1794 + assert!(subset_sum_recursive(arr.clone(), target1)); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/dynamic_programming.rs:1795:9 [INFO] [stdout] | [INFO] [stdout] 1795 | assert_eq!(subset_sum_recursive(arr.clone(), target2), false); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparison [INFO] [stdout] help: replace it with `assert!(..)` [INFO] [stdout] | [INFO] [stdout] 1795 - assert_eq!(subset_sum_recursive(arr.clone(), target2), false); [INFO] [stdout] 1795 + assert!(!subset_sum_recursive(arr.clone(), target2)); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/dynamic_programming.rs:1797:9 [INFO] [stdout] | [INFO] [stdout] 1797 | assert_eq!(subset_sum_tabulation(arr.clone(), target1), true); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparison [INFO] [stdout] help: replace it with `assert!(..)` [INFO] [stdout] | [INFO] [stdout] 1797 - assert_eq!(subset_sum_tabulation(arr.clone(), target1), true); [INFO] [stdout] 1797 + assert!(subset_sum_tabulation(arr.clone(), target1)); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/dynamic_programming.rs:1798:9 [INFO] [stdout] | [INFO] [stdout] 1798 | assert_eq!(subset_sum_tabulation(arr.clone(), target2), false); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparison [INFO] [stdout] help: replace it with `assert!(..)` [INFO] [stdout] | [INFO] [stdout] 1798 - assert_eq!(subset_sum_tabulation(arr.clone(), target2), false); [INFO] [stdout] 1798 + assert!(!subset_sum_tabulation(arr.clone(), target2)); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/dynamic_programming.rs:1803:9 [INFO] [stdout] | [INFO] [stdout] 1803 | assert_eq!(can_partition(vec![1, 5, 11, 5]), true); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparison [INFO] [stdout] help: replace it with `assert!(..)` [INFO] [stdout] | [INFO] [stdout] 1803 - assert_eq!(can_partition(vec![1, 5, 11, 5]), true); [INFO] [stdout] 1803 + assert!(can_partition(vec![1, 5, 11, 5])); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/dynamic_programming.rs:1804:9 [INFO] [stdout] | [INFO] [stdout] 1804 | assert_eq!(can_partition(vec![1, 2, 3, 5]), false); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparison [INFO] [stdout] help: replace it with `assert!(..)` [INFO] [stdout] | [INFO] [stdout] 1804 - assert_eq!(can_partition(vec![1, 2, 3, 5]), false); [INFO] [stdout] 1804 + assert!(!can_partition(vec![1, 2, 3, 5])); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/dynamic_programming.rs:1895:9 [INFO] [stdout] | [INFO] [stdout] 1895 | assert_eq!(is_match("aa", "a"), false); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparison [INFO] [stdout] help: replace it with `assert!(..)` [INFO] [stdout] | [INFO] [stdout] 1895 - assert_eq!(is_match("aa", "a"), false); [INFO] [stdout] 1895 + assert!(!is_match("aa", "a")); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/dynamic_programming.rs:1896:9 [INFO] [stdout] | [INFO] [stdout] 1896 | assert_eq!(is_match("aa", "*"), true); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparison [INFO] [stdout] help: replace it with `assert!(..)` [INFO] [stdout] | [INFO] [stdout] 1896 - assert_eq!(is_match("aa", "*"), true); [INFO] [stdout] 1896 + assert!(is_match("aa", "*")); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/dynamic_programming.rs:1897:9 [INFO] [stdout] | [INFO] [stdout] 1897 | assert_eq!(is_match("cb", "?a"), false); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparison [INFO] [stdout] help: replace it with `assert!(..)` [INFO] [stdout] | [INFO] [stdout] 1897 - assert_eq!(is_match("cb", "?a"), false); [INFO] [stdout] 1897 + assert!(!is_match("cb", "?a")); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true [INFO] [stdout] --> src/binary_tress.rs:36:1 [INFO] [stdout] | [INFO] [stdout] 36 | impl Into>>> for Node { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: `impl From for Foreign` is allowed by the orphan rules, for more information see [INFO] [stdout] https://doc.rust-lang.org/reference/items/implementations.html#trait-implementation-coherence [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#from_over_into [INFO] [stdout] = note: `#[warn(clippy::from_over_into)]` on by default [INFO] [stdout] help: replace the `Into` implementation with `From` [INFO] [stdout] | [INFO] [stdout] 36 ~ impl From for Option>> { [INFO] [stdout] 37 ~ fn from(val: Node) -> Self { [INFO] [stdout] 38 ~ Some(Rc::new(RefCell::new(val))) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `map_or` can be simplified [INFO] [stdout] --> src/binary_tress.rs:179:5 [INFO] [stdout] | [INFO] [stdout] 179 | / root.map_or(false, |node| { [INFO] [stdout] 180 | | let left_height = max_depth(node.borrow().left.clone()); [INFO] [stdout] 181 | | let right_height = max_depth(node.borrow().right.clone()); [INFO] [stdout] ... | [INFO] [stdout] 184 | | }) [INFO] [stdout] | |______^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or [INFO] [stdout] = note: `#[warn(clippy::unnecessary_map_or)]` on by default [INFO] [stdout] help: use `is_some_and` instead [INFO] [stdout] | [INFO] [stdout] 179 - root.map_or(false, |node| { [INFO] [stdout] 179 + root.is_some_and(|node| { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `map_or` can be simplified [INFO] [stdout] --> src/binary_tress.rs:286:5 [INFO] [stdout] | [INFO] [stdout] 286 | root.map_or(true, |node| helper(node.borrow().left.clone(), node.borrow().right.clone())) [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or [INFO] [stdout] help: use `is_none_or` instead [INFO] [stdout] | [INFO] [stdout] 286 - root.map_or(true, |node| helper(node.borrow().left.clone(), node.borrow().right.clone())) [INFO] [stdout] 286 + root.is_none_or(|node| helper(node.borrow().left.clone(), node.borrow().right.clone())) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `map_or` can be simplified [INFO] [stdout] --> src/binary_tress.rs:292:9 [INFO] [stdout] | [INFO] [stdout] 292 | / root.map_or(false, |nde| { [INFO] [stdout] 293 | | path.push(nde.borrow().value); [INFO] [stdout] 294 | | [INFO] [stdout] 295 | | if nde.borrow().value == node { [INFO] [stdout] ... | [INFO] [stdout] 305 | | false [INFO] [stdout] 306 | | }) [INFO] [stdout] | |__________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or [INFO] [stdout] help: use `is_some_and` instead [INFO] [stdout] | [INFO] [stdout] 292 - root.map_or(false, |nde| { [INFO] [stdout] 292 + root.is_some_and(|nde| { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is used to index `s` [INFO] [stdout] --> src/two_pointer.rs:126:14 [INFO] [stdout] | [INFO] [stdout] 126 | for i in 0..s.len() { [INFO] [stdout] | ^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator and enumerate() [INFO] [stdout] | [INFO] [stdout] 126 - for i in 0..s.len() { [INFO] [stdout] 126 + for (i, ) in s.iter().enumerate() { [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/two_pointer.rs:175:21 [INFO] [stdout] | [INFO] [stdout] 175 | fn helper(nums: &Vec, goal: i32) -> usize { [INFO] [stdout] | ^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg [INFO] [stdout] help: change this to [INFO] [stdout] | [INFO] [stdout] 175 - fn helper(nums: &Vec, goal: i32) -> usize { [INFO] [stdout] 175 + fn helper(nums: &[i32], goal: i32) -> usize { [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/two_pointer.rs:212:21 [INFO] [stdout] | [INFO] [stdout] 212 | fn helper(nums: &Vec, goal: i32) -> i32 { [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] 212 - fn helper(nums: &Vec, goal: i32) -> i32 { [INFO] [stdout] 212 + fn helper(nums: &[i32], goal: i32) -> i32 { [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/two_pointer.rs:239:21 [INFO] [stdout] | [INFO] [stdout] 239 | fn helper(nums: &Vec, k: usize) -> i32 { [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] 239 - fn helper(nums: &Vec, k: usize) -> i32 { [INFO] [stdout] 239 + fn helper(nums: &[i32], k: usize) -> i32 { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` [INFO] [stdout] --> src/two_pointer.rs:283:9 [INFO] [stdout] | [INFO] [stdout] 283 | / match freq_map.get_mut(&c) { [INFO] [stdout] 284 | | Some(val) => { [INFO] [stdout] 285 | | if *val > 0 { [INFO] [stdout] 286 | | count += 1; [INFO] [stdout] ... | [INFO] [stdout] 290 | | None => {} [INFO] [stdout] 291 | | } [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match [INFO] [stdout] = note: `#[warn(clippy::single_match)]` on by default [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 283 ~ if let Some(val) = freq_map.get_mut(&c) { [INFO] [stdout] 284 + if *val > 0 { [INFO] [stdout] 285 + count += 1; [INFO] [stdout] 286 + } [INFO] [stdout] 287 + *val -= 1; [INFO] [stdout] 288 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` [INFO] [stdout] --> src/two_pointer.rs:299:13 [INFO] [stdout] | [INFO] [stdout] 299 | / match freq_map.get_mut(&s[l]) { [INFO] [stdout] 300 | | Some(val) => { [INFO] [stdout] 301 | | if *val == 0 { [INFO] [stdout] 302 | | count -= 1; [INFO] [stdout] ... | [INFO] [stdout] 306 | | None => {} [INFO] [stdout] 307 | | } [INFO] [stdout] | |_____________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 299 ~ if let Some(val) = freq_map.get_mut(&s[l]) { [INFO] [stdout] 300 + if *val == 0 { [INFO] [stdout] 301 + count -= 1; [INFO] [stdout] 302 + } [INFO] [stdout] 303 + *val += 1; [INFO] [stdout] 304 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do [INFO] [stdout] --> src/graphs.rs:187:33 [INFO] [stdout] | [INFO] [stdout] 187 | fn helper(node: usize, vis: &mut Vec, adj_list: &Vec>) -> bool { [INFO] [stdout] | ^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg [INFO] [stdout] help: change this to [INFO] [stdout] | [INFO] [stdout] 187 - fn helper(node: usize, vis: &mut Vec, adj_list: &Vec>) -> bool { [INFO] [stdout] 187 + fn helper(node: usize, vis: &mut [bool], adj_list: &Vec>) -> bool { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do [INFO] [stdout] --> src/graphs.rs:187:59 [INFO] [stdout] | [INFO] [stdout] 187 | fn helper(node: usize, vis: &mut Vec, adj_list: &Vec>) -> bool { [INFO] [stdout] | ^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg [INFO] [stdout] help: change this to [INFO] [stdout] | [INFO] [stdout] 187 - fn helper(node: usize, vis: &mut Vec, adj_list: &Vec>) -> bool { [INFO] [stdout] 187 + fn helper(node: usize, vis: &mut Vec, adj_list: &[Vec]) -> bool { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/graphs.rs:208:9 [INFO] [stdout] | [INFO] [stdout] 208 | / if !vis[i] { [INFO] [stdout] 209 | | if helper(i, &mut vis, &adj_list) { [INFO] [stdout] 210 | | return true; [INFO] [stdout] 211 | | }; [INFO] [stdout] 212 | | } [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 208 ~ if !vis[i] [INFO] [stdout] 209 ~ && helper(i, &mut vis, &adj_list) { [INFO] [stdout] 210 | return true; [INFO] [stdout] 211 ~ }; [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/graphs.rs:237:9 [INFO] [stdout] | [INFO] [stdout] 237 | / if !vis[i] { [INFO] [stdout] 238 | | if helper(i, None, &mut vis, &adj_list) { [INFO] [stdout] 239 | | return true; [INFO] [stdout] 240 | | } [INFO] [stdout] 241 | | } [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 237 ~ if !vis[i] [INFO] [stdout] 238 ~ && helper(i, None, &mut vis, &adj_list) { [INFO] [stdout] 239 | return true; [INFO] [stdout] 240 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/graphs.rs:330:13 [INFO] [stdout] | [INFO] [stdout] 330 | / if row == 0 || col == 0 || row == grid.len() - 1 || col == grid[0].len() - 1 { [INFO] [stdout] 331 | | if grid[row][col] == 1 { [INFO] [stdout] 332 | | vis[row][col] = true; [INFO] [stdout] 333 | | queue.push_back((row, col)); [INFO] [stdout] 334 | | } [INFO] [stdout] 335 | | } [INFO] [stdout] | |_____________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 330 ~ if (row == 0 || col == 0 || row == grid.len() - 1 || col == grid[0].len() - 1) { [INFO] [stdout] 331 ~ && grid[row][col] == 1 { [INFO] [stdout] 332 | vis[row][col] = true; [INFO] [stdout] 333 | queue.push_back((row, col)); [INFO] [stdout] 334 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/graphs.rs:412:9 [INFO] [stdout] | [INFO] [stdout] 412 | / if color[i].is_none() { [INFO] [stdout] 413 | | if !helper(i, false, &mut color, &grid) { [INFO] [stdout] 414 | | return false; [INFO] [stdout] 415 | | }; [INFO] [stdout] 416 | | } [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 412 ~ if color[i].is_none() [INFO] [stdout] 413 ~ && !helper(i, false, &mut color, &grid) { [INFO] [stdout] 414 | return false; [INFO] [stdout] 415 ~ }; [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/graphs.rs:444:9 [INFO] [stdout] | [INFO] [stdout] 444 | / if !vis[i] { [INFO] [stdout] 445 | | if helper(i, &adj_list, &mut vis, &mut path_vis) { [INFO] [stdout] 446 | | return true; [INFO] [stdout] 447 | | } [INFO] [stdout] 448 | | } [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 444 ~ if !vis[i] [INFO] [stdout] 445 ~ && helper(i, &adj_list, &mut vis, &mut path_vis) { [INFO] [stdout] 446 | return true; [INFO] [stdout] 447 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is used to index `check` [INFO] [stdout] --> src/graphs.rs:487:14 [INFO] [stdout] | [INFO] [stdout] 487 | for i in 0..graph.len() { [INFO] [stdout] | ^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator and enumerate() [INFO] [stdout] | [INFO] [stdout] 487 - for i in 0..graph.len() { [INFO] [stdout] 487 + for (i, ) in check.iter().enumerate().take(graph.len()) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `node` is only used to index `adj_list` [INFO] [stdout] --> src/graphs.rs:526:17 [INFO] [stdout] | [INFO] [stdout] 526 | for node in 0..adj_list.len() { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 526 - for node in 0..adj_list.len() { [INFO] [stdout] 526 + for in &adj_list { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `node` is used to index `indegree` [INFO] [stdout] --> src/graphs.rs:532:17 [INFO] [stdout] | [INFO] [stdout] 532 | for node in 0..adj_list.len() { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator and enumerate() [INFO] [stdout] | [INFO] [stdout] 532 - for node in 0..adj_list.len() { [INFO] [stdout] 532 + for (node, ) in indegree.iter().enumerate().take(adj_list.len()) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `node` is only used to index `adj_list` [INFO] [stdout] --> src/graphs.rs:557:17 [INFO] [stdout] | [INFO] [stdout] 557 | for node in 0..adj_list.len() { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 557 - for node in 0..adj_list.len() { [INFO] [stdout] 557 + for in &adj_list { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `node` is used to index `indegree` [INFO] [stdout] --> src/graphs.rs:563:17 [INFO] [stdout] | [INFO] [stdout] 563 | for node in 0..adj_list.len() { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator and enumerate() [INFO] [stdout] | [INFO] [stdout] 563 - for node in 0..adj_list.len() { [INFO] [stdout] 563 + for (node, ) in indegree.iter().enumerate().take(adj_list.len()) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `node` is only used to index `graph` [INFO] [stdout] --> src/graphs.rs:593:17 [INFO] [stdout] | [INFO] [stdout] 593 | for node in 0..num_courses { [INFO] [stdout] | ^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 593 - for node in 0..num_courses { [INFO] [stdout] 593 + for in graph.iter().take(num_courses) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `node` is used to index `indegree` [INFO] [stdout] --> src/graphs.rs:598:17 [INFO] [stdout] | [INFO] [stdout] 598 | for node in 0..num_courses { [INFO] [stdout] | ^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator and enumerate() [INFO] [stdout] | [INFO] [stdout] 598 - for node in 0..num_courses { [INFO] [stdout] 598 + for (node, ) in indegree.iter().enumerate().take(num_courses) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `node` is used to index `indegree` [INFO] [stdout] --> src/graphs.rs:630:17 [INFO] [stdout] | [INFO] [stdout] 630 | for node in 0..graph.len() { [INFO] [stdout] | ^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator and enumerate() [INFO] [stdout] | [INFO] [stdout] 630 - for node in 0..graph.len() { [INFO] [stdout] 630 + for (node, ) in indegree.iter().enumerate().take(graph.len()) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/graphs.rs:695:27 [INFO] [stdout] | [INFO] [stdout] 695 | helper(i, &adj_list, &mut vis, &mut stack); [INFO] [stdout] | ^^^^^^^^^ help: change this to: `adj_list` [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/graphs.rs:788:31 [INFO] [stdout] | [INFO] [stdout] 788 | if ans.len() == 0 { [INFO] [stdout] | _______________________________^ [INFO] [stdout] 789 | | ans.push(path.clone()); [INFO] [stdout] 790 | | } else if ans[0].len() == path.len() { [INFO] [stdout] | |_____________^ [INFO] [stdout] | [INFO] [stdout] note: same as this [INFO] [stdout] --> src/graphs.rs:790:50 [INFO] [stdout] | [INFO] [stdout] 790 | } else if ans[0].len() == path.len() { [INFO] [stdout] | __________________________________________________^ [INFO] [stdout] 791 | | ans.push(path.clone()); [INFO] [stdout] 792 | | } [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: length comparison to zero [INFO] [stdout] --> src/graphs.rs:788:16 [INFO] [stdout] | [INFO] [stdout] 788 | if ans.len() == 0 { [INFO] [stdout] | ^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `ans.is_empty()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this block may be rewritten with the `?` operator [INFO] [stdout] --> src/graphs.rs:936:5 [INFO] [stdout] | [INFO] [stdout] 936 | / if distances[adj_list.len() - 1].is_none() { [INFO] [stdout] 937 | | return None; [INFO] [stdout] 938 | | } [INFO] [stdout] | |_____^ help: replace it with: `distances[adj_list.len() - 1]?;` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#question_mark [INFO] [stdout] = note: `#[warn(clippy::question_mark)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/graphs.rs:1040:5 [INFO] [stdout] | [INFO] [stdout] 1040 | / return if distances[dst] == i32::MAX { [INFO] [stdout] 1041 | | None [INFO] [stdout] 1042 | | } else { [INFO] [stdout] 1043 | | Some(distances[dst]) [INFO] [stdout] 1044 | | }; [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 1040 ~ if distances[dst] == i32::MAX { [INFO] [stdout] 1041 + None [INFO] [stdout] 1042 + } else { [INFO] [stdout] 1043 + Some(distances[dst]) [INFO] [stdout] 1044 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of `Option::map` [INFO] [stdout] --> src/graphs.rs:1078:65 [INFO] [stdout] | [INFO] [stdout] 1078 | times.into_iter().skip(1).try_fold(i32::MIN, |max_val, val| match val { [INFO] [stdout] | _________________________________________________________________^ [INFO] [stdout] 1079 | | None => None, [INFO] [stdout] 1080 | | Some(num) => Some(max_val.max(num)) [INFO] [stdout] 1081 | | }).unwrap_or(-1) [INFO] [stdout] | |_____^ help: try: `val.map(|num| max_val.max(num))` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_map [INFO] [stdout] = note: `#[warn(clippy::manual_map)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is used to index `distances` [INFO] [stdout] --> src/graphs.rs:1190:14 [INFO] [stdout] | [INFO] [stdout] 1190 | for i in 0..v { [INFO] [stdout] | ^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator and enumerate() [INFO] [stdout] | [INFO] [stdout] 1190 - for i in 0..v { [INFO] [stdout] 1190 + for (i, ) in distances.iter_mut().enumerate().take(v) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `j` is used to index `distances` [INFO] [stdout] --> src/graphs.rs:1191:18 [INFO] [stdout] | [INFO] [stdout] 1191 | for j in 0..v { [INFO] [stdout] | ^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator and enumerate() [INFO] [stdout] | [INFO] [stdout] 1191 - for j in 0..v { [INFO] [stdout] 1191 + for (j, ) in distances.iter_mut().enumerate().take(v) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: called `iter().cloned().collect()` on a slice to create a `Vec`. Calling `to_vec()` is both faster and more readable [INFO] [stdout] --> src/graphs.rs:1257:49 [INFO] [stdout] | [INFO] [stdout] 1257 | positive_graph.push(row[..row.len() - 1].iter().cloned().collect()); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `.to_vec()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#iter_cloned_collect [INFO] [stdout] = note: `#[warn(clippy::iter_cloned_collect)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is used to index `distances` [INFO] [stdout] --> src/graphs.rs:1280:14 [INFO] [stdout] | [INFO] [stdout] 1280 | for i in 0..cities { [INFO] [stdout] | ^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator and enumerate() [INFO] [stdout] | [INFO] [stdout] 1280 - for i in 0..cities { [INFO] [stdout] 1280 + for (i, ) in distances.iter_mut().enumerate().take(cities) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `vertex` is used to index `adj_list` [INFO] [stdout] --> src/graphs.rs:1414:19 [INFO] [stdout] | [INFO] [stdout] 1414 | for vertex in 0..adj_list.len() { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator and enumerate() [INFO] [stdout] | [INFO] [stdout] 1414 - for vertex in 0..adj_list.len() { [INFO] [stdout] 1414 + for (vertex, ) in adj_list.iter().enumerate() { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `j` is used to index `adj_matrix` [INFO] [stdout] --> src/graphs.rs:1442:18 [INFO] [stdout] | [INFO] [stdout] 1442 | for j in 0..adj_matrix.len() { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator and enumerate() [INFO] [stdout] | [INFO] [stdout] 1442 - for j in 0..adj_matrix.len() { [INFO] [stdout] 1442 + for (j, ) in adj_matrix.iter().enumerate() { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this pattern takes a reference on something that is being dereferenced [INFO] [stdout] --> src/graphs.rs:1481:17 [INFO] [stdout] | [INFO] [stdout] 1481 | for (index, &ref account) in accounts.iter().enumerate() { [INFO] [stdout] | ^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrowed_reference [INFO] [stdout] = note: `#[warn(clippy::needless_borrowed_reference)]` on by default [INFO] [stdout] help: try removing the `&ref` part [INFO] [stdout] | [INFO] [stdout] 1481 - for (index, &ref account) in accounts.iter().enumerate() { [INFO] [stdout] 1481 + for (index, account) in accounts.iter().enumerate() { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this function has too many arguments (8/7) [INFO] [stdout] --> src/graphs.rs:1714:5 [INFO] [stdout] | [INFO] [stdout] 1714 | fn helper(node: usize, parent: Option, adj_list: &Vec>, vis: &mut Vec, mut timer: i32, insertion_time: &mut Vec, lowest_visit_time: &mut Vec, bridges: &mut Vec<(usize, usize)>) { ... [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments [INFO] [stdout] = note: `#[warn(clippy::too_many_arguments)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this function has too many arguments (8/7) [INFO] [stdout] --> src/graphs.rs:1749:5 [INFO] [stdout] | [INFO] [stdout] 1749 | fn helper(node: usize, parent: Option, adj_list: &Vec>, vis: &mut Vec, mut timer: i32, insertion_time: &mut Vec, lowest_visit_time: &mut Vec, points: &mut Vec) { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/graphs.rs:1877:9 [INFO] [stdout] | [INFO] [stdout] 1877 | assert_eq!(cycle_detection_bfs(graph.clone()), true); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparison [INFO] [stdout] help: replace it with `assert!(..)` [INFO] [stdout] | [INFO] [stdout] 1877 - assert_eq!(cycle_detection_bfs(graph.clone()), true); [INFO] [stdout] 1877 + assert!(cycle_detection_bfs(graph.clone())); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/graphs.rs:1878:9 [INFO] [stdout] | [INFO] [stdout] 1878 | assert_eq!(cycle_detection_dfs(graph), true); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparison [INFO] [stdout] help: replace it with `assert!(..)` [INFO] [stdout] | [INFO] [stdout] 1878 - assert_eq!(cycle_detection_dfs(graph), true); [INFO] [stdout] 1878 + assert!(cycle_detection_dfs(graph)); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/graphs.rs:1886:9 [INFO] [stdout] | [INFO] [stdout] 1886 | assert_eq!(cycle_detection_bfs(graph.clone()), false); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparison [INFO] [stdout] help: replace it with `assert!(..)` [INFO] [stdout] | [INFO] [stdout] 1886 - assert_eq!(cycle_detection_bfs(graph.clone()), false); [INFO] [stdout] 1886 + assert!(!cycle_detection_bfs(graph.clone())); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/graphs.rs:1887:9 [INFO] [stdout] | [INFO] [stdout] 1887 | assert_eq!(cycle_detection_dfs(graph), false); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparison [INFO] [stdout] help: replace it with `assert!(..)` [INFO] [stdout] | [INFO] [stdout] 1887 - assert_eq!(cycle_detection_dfs(graph), false); [INFO] [stdout] 1887 + assert!(!cycle_detection_dfs(graph)); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/graphs.rs:1947:9 [INFO] [stdout] | [INFO] [stdout] 1947 | / assert_eq!(is_bipartite_bfs(vec![ [INFO] [stdout] 1948 | | vec![1, 2, 3], [INFO] [stdout] 1949 | | vec![0, 2], [INFO] [stdout] 1950 | | vec![0, 1, 3], [INFO] [stdout] 1951 | | vec![0, 2], [INFO] [stdout] 1952 | | ]), false); [INFO] [stdout] | |__________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparison [INFO] [stdout] help: replace it with `assert!(..)` [INFO] [stdout] | [INFO] [stdout] 1947 ~ assert!(!is_bipartite_bfs(vec![ [INFO] [stdout] 1948 | vec![1, 2, 3], [INFO] [stdout] ... [INFO] [stdout] 1951 | vec![0, 2], [INFO] [stdout] 1952 ~ ])); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/graphs.rs:1953:9 [INFO] [stdout] | [INFO] [stdout] 1953 | / assert_eq!(is_bipartite_dfs(vec![ [INFO] [stdout] 1954 | | vec![1, 2, 3], [INFO] [stdout] 1955 | | vec![0, 2], [INFO] [stdout] 1956 | | vec![0, 1, 3], [INFO] [stdout] 1957 | | vec![0, 2], [INFO] [stdout] 1958 | | ]), false); [INFO] [stdout] | |__________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparison [INFO] [stdout] help: replace it with `assert!(..)` [INFO] [stdout] | [INFO] [stdout] 1953 ~ assert!(!is_bipartite_dfs(vec![ [INFO] [stdout] 1954 | vec![1, 2, 3], [INFO] [stdout] ... [INFO] [stdout] 1957 | vec![0, 2], [INFO] [stdout] 1958 ~ ])); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/graphs.rs:1959:9 [INFO] [stdout] | [INFO] [stdout] 1959 | / assert_eq!(is_bipartite_bfs(vec![ [INFO] [stdout] 1960 | | vec![1, 3], [INFO] [stdout] 1961 | | vec![0, 2], [INFO] [stdout] 1962 | | vec![1, 3], [INFO] [stdout] 1963 | | vec![0, 2], [INFO] [stdout] 1964 | | ]), true); [INFO] [stdout] | |_________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparison [INFO] [stdout] help: replace it with `assert!(..)` [INFO] [stdout] | [INFO] [stdout] 1959 ~ assert!(is_bipartite_bfs(vec![ [INFO] [stdout] 1960 | vec![1, 3], [INFO] [stdout] ... [INFO] [stdout] 1963 | vec![0, 2], [INFO] [stdout] 1964 ~ ])); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/graphs.rs:1965:9 [INFO] [stdout] | [INFO] [stdout] 1965 | / assert_eq!(is_bipartite_dfs(vec![ [INFO] [stdout] 1966 | | vec![1, 3], [INFO] [stdout] 1967 | | vec![0, 2], [INFO] [stdout] 1968 | | vec![1, 3], [INFO] [stdout] 1969 | | vec![0, 2], [INFO] [stdout] 1970 | | ]), true); [INFO] [stdout] | |_________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparison [INFO] [stdout] help: replace it with `assert!(..)` [INFO] [stdout] | [INFO] [stdout] 1965 ~ assert!(is_bipartite_dfs(vec![ [INFO] [stdout] 1966 | vec![1, 3], [INFO] [stdout] ... [INFO] [stdout] 1969 | vec![0, 2], [INFO] [stdout] 1970 ~ ])); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/graphs.rs:2026:9 [INFO] [stdout] | [INFO] [stdout] 2026 | assert_eq!(cycle_directed_topological(graph), false); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparison [INFO] [stdout] help: replace it with `assert!(..)` [INFO] [stdout] | [INFO] [stdout] 2026 - assert_eq!(cycle_directed_topological(graph), false); [INFO] [stdout] 2026 + assert!(!cycle_directed_topological(graph)); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/graphs.rs:2035:9 [INFO] [stdout] | [INFO] [stdout] 2035 | assert_eq!(cycle_directed_topological(graph), true); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparison [INFO] [stdout] help: replace it with `assert!(..)` [INFO] [stdout] | [INFO] [stdout] 2035 - assert_eq!(cycle_directed_topological(graph), true); [INFO] [stdout] 2035 + assert!(cycle_directed_topological(graph)); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/graphs.rs:2040:9 [INFO] [stdout] | [INFO] [stdout] 2040 | assert_eq!(can_finish(2, vec![(1, 0)]), true); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparison [INFO] [stdout] help: replace it with `assert!(..)` [INFO] [stdout] | [INFO] [stdout] 2040 - assert_eq!(can_finish(2, vec![(1, 0)]), true); [INFO] [stdout] 2040 + assert!(can_finish(2, vec![(1, 0)])); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/graphs.rs:2041:9 [INFO] [stdout] | [INFO] [stdout] 2041 | assert_eq!(can_finish(2, vec![(1, 0), (0, 1)]), false); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparison [INFO] [stdout] help: replace it with `assert!(..)` [INFO] [stdout] | [INFO] [stdout] 2041 - assert_eq!(can_finish(2, vec![(1, 0), (0, 1)]), false); [INFO] [stdout] 2041 + assert!(!can_finish(2, vec![(1, 0), (0, 1)])); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/stack_queues.rs:208:9 [INFO] [stdout] | [INFO] [stdout] 208 | / return if !self.stack_output.is_empty() { [INFO] [stdout] 209 | | self.stack_output.pop_back().unwrap() [INFO] [stdout] 210 | | } else { [INFO] [stdout] 211 | | while !self.stack_input.is_empty() { [INFO] [stdout] ... | [INFO] [stdout] 214 | | self.stack_output.pop_back().unwrap() [INFO] [stdout] 215 | | }; [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 208 ~ if !self.stack_output.is_empty() { [INFO] [stdout] 209 + self.stack_output.pop_back().unwrap() [INFO] [stdout] 210 + } else { [INFO] [stdout] 211 + while !self.stack_input.is_empty() { [INFO] [stdout] 212 + self.stack_output.push_back(self.stack_input.pop_back().unwrap()); [INFO] [stdout] 213 + } [INFO] [stdout] 214 + self.stack_output.pop_back().unwrap() [INFO] [stdout] 215 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/stack_queues.rs:219:9 [INFO] [stdout] | [INFO] [stdout] 219 | / return if !self.stack_output.is_empty() { [INFO] [stdout] 220 | | *self.stack_output.back().unwrap() [INFO] [stdout] 221 | | } else { [INFO] [stdout] 222 | | while !self.stack_input.is_empty() { [INFO] [stdout] ... | [INFO] [stdout] 225 | | *self.stack_output.back().unwrap() [INFO] [stdout] 226 | | }; [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 219 ~ if !self.stack_output.is_empty() { [INFO] [stdout] 220 + *self.stack_output.back().unwrap() [INFO] [stdout] 221 + } else { [INFO] [stdout] 222 + while !self.stack_input.is_empty() { [INFO] [stdout] 223 + self.stack_output.push_back(self.stack_input.pop_back().unwrap()); [INFO] [stdout] 224 + } [INFO] [stdout] 225 + *self.stack_output.back().unwrap() [INFO] [stdout] 226 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `map_or` can be simplified [INFO] [stdout] --> src/stack_queues.rs:346:15 [INFO] [stdout] | [INFO] [stdout] 346 | while stack.back().map_or(false, |&i| heights[i] >= ele) { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or [INFO] [stdout] help: use `is_some_and` instead [INFO] [stdout] | [INFO] [stdout] 346 - while stack.back().map_or(false, |&i| heights[i] >= ele) { [INFO] [stdout] 346 + while stack.back().is_some_and(|&i| heights[i] >= ele) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `map_or` can be simplified [INFO] [stdout] --> src/stack_queues.rs:357:15 [INFO] [stdout] | [INFO] [stdout] 357 | while stack.back().map_or(false, |&i| heights[i] >= ele) { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or [INFO] [stdout] help: use `is_some_and` instead [INFO] [stdout] | [INFO] [stdout] 357 - while stack.back().map_or(false, |&i| heights[i] >= ele) { [INFO] [stdout] 357 + while stack.back().is_some_and(|&i| heights[i] >= ele) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: explicit call to `.into_iter()` in function argument accepting `IntoIterator` [INFO] [stdout] --> src/stack_queues.rs:366:14 [INFO] [stdout] | [INFO] [stdout] 366 | .zip(right_smaller_index.into_iter()) [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()` [INFO] [stdout] --> /rustc/3645249d79dfb136b5d8de3ce153d19d6698d92d/library/core/src/iter/traits/iterator.rs:629:11 [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion [INFO] [stdout] = note: `#[warn(clippy::useless_conversion)]` on by default [INFO] [stdout] help: consider removing the `.into_iter()` [INFO] [stdout] | [INFO] [stdout] 366 - .zip(right_smaller_index.into_iter()) [INFO] [stdout] 366 + .zip(right_smaller_index) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: explicit call to `.into_iter()` in function argument accepting `IntoIterator` [INFO] [stdout] --> src/stack_queues.rs:367:14 [INFO] [stdout] | [INFO] [stdout] 367 | .zip(heights.into_iter()) [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()` [INFO] [stdout] --> /rustc/3645249d79dfb136b5d8de3ce153d19d6698d92d/library/core/src/iter/traits/iterator.rs:629:11 [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion [INFO] [stdout] help: consider removing the `.into_iter()` [INFO] [stdout] | [INFO] [stdout] 367 - .zip(heights.into_iter()) [INFO] [stdout] 367 + .zip(heights) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `map_or` can be simplified [INFO] [stdout] --> src/stack_queues.rs:400:15 [INFO] [stdout] | [INFO] [stdout] 400 | while dequeue.front().map_or(false, |&f| Some(f) == ind.checked_sub(ind)) { //Check for out of bounds [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or [INFO] [stdout] help: use `is_some_and` instead [INFO] [stdout] | [INFO] [stdout] 400 - while dequeue.front().map_or(false, |&f| Some(f) == ind.checked_sub(ind)) { //Check for out of bounds [INFO] [stdout] 400 + while dequeue.front().is_some_and(|&f| Some(f) == ind.checked_sub(ind)) { //Check for out of bounds [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `map_or` can be simplified [INFO] [stdout] --> src/stack_queues.rs:404:15 [INFO] [stdout] | [INFO] [stdout] 404 | while dequeue.back().map_or(false, |&b| nums[b] < ele) { //Remove all elements smaller than current [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or [INFO] [stdout] help: use `is_some_and` instead [INFO] [stdout] | [INFO] [stdout] 404 - while dequeue.back().map_or(false, |&b| nums[b] < ele) { //Remove all elements smaller than current [INFO] [stdout] 404 + while dequeue.back().is_some_and(|&b| nums[b] < ele) { //Remove all elements smaller than current [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/stack_queues.rs:529:9 [INFO] [stdout] | [INFO] [stdout] 529 | assert_eq!(is_valid("()".to_string()), true); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparison [INFO] [stdout] help: replace it with `assert!(..)` [INFO] [stdout] | [INFO] [stdout] 529 - assert_eq!(is_valid("()".to_string()), true); [INFO] [stdout] 529 + assert!(is_valid("()".to_string())); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/stack_queues.rs:530:9 [INFO] [stdout] | [INFO] [stdout] 530 | assert_eq!(is_valid("()[]{}".to_string()), true); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparison [INFO] [stdout] help: replace it with `assert!(..)` [INFO] [stdout] | [INFO] [stdout] 530 - assert_eq!(is_valid("()[]{}".to_string()), true); [INFO] [stdout] 530 + assert!(is_valid("()[]{}".to_string())); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/stack_queues.rs:531:9 [INFO] [stdout] | [INFO] [stdout] 531 | assert_eq!(is_valid("(]".to_string()), false); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparison [INFO] [stdout] help: replace it with `assert!(..)` [INFO] [stdout] | [INFO] [stdout] 531 - assert_eq!(is_valid("(]".to_string()), false); [INFO] [stdout] 531 + assert!(!is_valid("(]".to_string())); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/stack_queues.rs:573:9 [INFO] [stdout] | [INFO] [stdout] 573 | assert_eq!(parse_bool_expr(String::from("&(|(f))")), false); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparison [INFO] [stdout] help: replace it with `assert!(..)` [INFO] [stdout] | [INFO] [stdout] 573 - assert_eq!(parse_bool_expr(String::from("&(|(f))")), false); [INFO] [stdout] 573 + assert!(!parse_bool_expr(String::from("&(|(f))"))); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/stack_queues.rs:574:9 [INFO] [stdout] | [INFO] [stdout] 574 | assert_eq!(parse_bool_expr(String::from("|(f,f,f,t)")), true); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparison [INFO] [stdout] help: replace it with `assert!(..)` [INFO] [stdout] | [INFO] [stdout] 574 - assert_eq!(parse_bool_expr(String::from("|(f,f,f,t)")), true); [INFO] [stdout] 574 + assert!(parse_bool_expr(String::from("|(f,f,f,t)"))); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/stack_queues.rs:575:9 [INFO] [stdout] | [INFO] [stdout] 575 | assert_eq!(parse_bool_expr(String::from("!(&(f,t))")), true); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparison [INFO] [stdout] help: replace it with `assert!(..)` [INFO] [stdout] | [INFO] [stdout] 575 - assert_eq!(parse_bool_expr(String::from("!(&(f,t))")), true); [INFO] [stdout] 575 + assert!(parse_bool_expr(String::from("!(&(f,t))"))); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: all variants have the same prefix: `Invalid` [INFO] [stdout] --> src/expression_conversion.rs:13:1 [INFO] [stdout] | [INFO] [stdout] 13 | / pub enum ExpressionError { [INFO] [stdout] 14 | | #[error("Invalid Operator")] [INFO] [stdout] 15 | | InvalidOperator, [INFO] [stdout] ... | [INFO] [stdout] 21 | | InvalidExpressionConversion, [INFO] [stdout] 22 | | } [INFO] [stdout] | |_^ [INFO] [stdout] | [INFO] [stdout] = help: remove the prefixes and use full paths to the variants instead of glob imports [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#enum_variant_names [INFO] [stdout] = note: `#[warn(clippy::enum_variant_names)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: non-canonical implementation of `partial_cmp` on an `Ord` type [INFO] [stdout] --> src/expression_conversion.rs:41:1 [INFO] [stdout] | [INFO] [stdout] 41 | / impl PartialOrd for Operator { [INFO] [stdout] 42 | | fn partial_cmp(&self, other: &Self) -> Option { [INFO] [stdout] 43 | | self.precedence().partial_cmp(&other.precedence()) [INFO] [stdout] 44 | | } [INFO] [stdout] 45 | | } [INFO] [stdout] | |_^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#non_canonical_partial_ord_impl [INFO] [stdout] = note: `#[warn(clippy::non_canonical_partial_ord_impl)]` on by default [INFO] [stdout] help: change this to [INFO] [stdout] | [INFO] [stdout] 42 - fn partial_cmp(&self, other: &Self) -> Option { [INFO] [stdout] 43 - self.precedence().partial_cmp(&other.precedence()) [INFO] [stdout] 44 - } [INFO] [stdout] 42 + fn partial_cmp(&self, other: &Self) -> Option { Some(self.cmp(other)) } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `map_or` can be simplified [INFO] [stdout] --> src/expression_conversion.rs:109:27 [INFO] [stdout] | [INFO] [stdout] 109 | while stack.back().map_or(false, |top| { [INFO] [stdout] | ___________________________^ [INFO] [stdout] 110 | | if let ExpressionElement::Operator(top_op) = top { [INFO] [stdout] 111 | | top_op >= op [INFO] [stdout] 112 | | } else { [INFO] [stdout] ... | [INFO] [stdout] 115 | | }) { [INFO] [stdout] | |______________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or [INFO] [stdout] help: use `is_some_and` instead [INFO] [stdout] | [INFO] [stdout] 109 - while stack.back().map_or(false, |top| { [INFO] [stdout] 109 + while stack.back().is_some_and(|top| { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/tries.rs:70:9 [INFO] [stdout] | [INFO] [stdout] 70 | assert_eq!(trie.search("apple"), true); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparison [INFO] [stdout] help: replace it with `assert!(..)` [INFO] [stdout] | [INFO] [stdout] 70 - assert_eq!(trie.search("apple"), true); [INFO] [stdout] 70 + assert!(trie.search("apple")); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/tries.rs:71:9 [INFO] [stdout] | [INFO] [stdout] 71 | assert_eq!(trie.search("appl"), false); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparison [INFO] [stdout] help: replace it with `assert!(..)` [INFO] [stdout] | [INFO] [stdout] 71 - assert_eq!(trie.search("appl"), false); [INFO] [stdout] 71 + assert!(!trie.search("appl")); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/tries.rs:72:9 [INFO] [stdout] | [INFO] [stdout] 72 | assert_eq!(trie.starts_with("appl"), true); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparison [INFO] [stdout] help: replace it with `assert!(..)` [INFO] [stdout] | [INFO] [stdout] 72 - assert_eq!(trie.starts_with("appl"), true); [INFO] [stdout] 72 + assert!(trie.starts_with("appl")); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: useless use of `vec!` [INFO] [stdout] --> src/graphs.rs:2066:20 [INFO] [stdout] | [INFO] [stdout] 2066 | let dict = vec!["baa", "abcd", "abca", "cab", "cad"] [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can use an array directly: `["baa", "abcd", "abca", "cab", "cad"]` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_vec [INFO] [stdout] = note: `#[warn(clippy::useless_vec)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: useless use of `vec!` [INFO] [stdout] --> src/graphs.rs:2072:20 [INFO] [stdout] | [INFO] [stdout] 2072 | let dict = vec!["caa", "aaa", "aab"] [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can use an array directly: `["caa", "aaa", "aab"]` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_vec [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: useless use of `vec!` [INFO] [stdout] --> src/graphs.rs:2094:72 [INFO] [stdout] | [INFO] [stdout] 2094 | ....to_string(), "cog".to_string(), vec!["hot", "dot", "dog", "lot", "log", "cog"].iter().map(|x| x.to_string()).collect()), 5); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can use an array directly: `["hot", "dot", "dog", "lot", "log", "cog"]` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_vec [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: useless use of `vec!` [INFO] [stdout] --> src/graphs.rs:2100:73 [INFO] [stdout] | [INFO] [stdout] 2100 | ....to_string(), "cog".to_string(), vec!["hot", "dot", "dog", "lot", "log", "cog"].iter().map(|x| x.to_string()).collect()), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can use an array directly: `["hot", "dot", "dog", "lot", "log", "cog"]` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_vec [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: useless use of `vec!` [INFO] [stdout] --> src/graphs.rs:2102:17 [INFO] [stdout] | [INFO] [stdout] 2102 | vec!["hit", "hot", "dot", "dog", "cog"].iter().map(|&s| s.to_string()).collect::>(), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can use an array directly: `["hit", "hot", "dot", "dog", "cog"]` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_vec [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: useless use of `vec!` [INFO] [stdout] --> src/graphs.rs:2103:17 [INFO] [stdout] | [INFO] [stdout] 2103 | vec!["hit", "hot", "lot", "log", "cog"].iter().map(|&s| s.to_string()).collect(), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: you can use an array directly: `["hit", "hot", "lot", "log", "cog"]` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_vec [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: useless use of `vec!` [INFO] [stdout] --> src/graphs.rs:2107:69 [INFO] [stdout] | [INFO] [stdout] 2107 | find_ladder_optimised("a".to_string(), "c".to_string(), vec!["a", "b", "c"].iter().map(|x| x.to_string()).collect()), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^ help: you can use an array directly: `["a", "b", "c"]` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_vec [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: useless use of `vec!` [INFO] [stdout] --> src/graphs.rs:2109:17 [INFO] [stdout] | [INFO] [stdout] 2109 | vec!["a", "c"].iter().map(|x| x.to_string()).collect::>() [INFO] [stdout] | ^^^^^^^^^^^^^^ help: you can use an array directly: `["a", "c"]` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_vec [INFO] [stdout] [INFO] [stdout] [INFO] [stderr] Finished `dev` profile [unoptimized + debuginfo] target(s) in 7.28s [INFO] running `Command { std: "docker" "inspect" "dee7c2df55e94910f37fd1bc534bddfe806a8b8a09987ee6d6b0de56313c16be", kill_on_drop: false }` [INFO] running `Command { std: "docker" "rm" "-f" "dee7c2df55e94910f37fd1bc534bddfe806a8b8a09987ee6d6b0de56313c16be", kill_on_drop: false }` [INFO] [stdout] dee7c2df55e94910f37fd1bc534bddfe806a8b8a09987ee6d6b0de56313c16be