[INFO] fetching crate leetcode-rust 0.1.2... [INFO] linting leetcode-rust-0.1.2 against nightly for clippy-nonminimal_bool-denied [INFO] extracting crate leetcode-rust 0.1.2 into /workspace/builds/worker-5-tc1/source [INFO] started tweaking crates.io crate leetcode-rust 0.1.2 [INFO] finished tweaking crates.io crate leetcode-rust 0.1.2 [INFO] tweaked toml for crates.io crate leetcode-rust 0.1.2 written to /workspace/builds/worker-5-tc1/source/Cargo.toml [INFO] validating manifest of crates.io crate leetcode-rust 0.1.2 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] running `Command { std: CARGO_HOME="/workspace/cargo-home" RUSTUP_HOME="/workspace/rustup-home" "/workspace/cargo-home/bin/cargo" "+nightly" "generate-lockfile" "--manifest-path" "Cargo.toml", kill_on_drop: false }` [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-5-tc1/target:/opt/rustwide/target:rw,Z" "-v" "/var/lib/crater-agent-workspace/builds/worker-5-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] e0118866e82c2dba204bc7faf69259182d568777aa7a423a11d0494e32ac1a6a [INFO] running `Command { std: "docker" "start" "-a" "e0118866e82c2dba204bc7faf69259182d568777aa7a423a11d0494e32ac1a6a", kill_on_drop: false }` [INFO] running `Command { std: "docker" "inspect" "e0118866e82c2dba204bc7faf69259182d568777aa7a423a11d0494e32ac1a6a", kill_on_drop: false }` [INFO] running `Command { std: "docker" "rm" "-f" "e0118866e82c2dba204bc7faf69259182d568777aa7a423a11d0494e32ac1a6a", kill_on_drop: false }` [INFO] [stdout] e0118866e82c2dba204bc7faf69259182d568777aa7a423a11d0494e32ac1a6a [INFO] running `Command { std: "docker" "create" "-v" "/var/lib/crater-agent-workspace/builds/worker-5-tc1/target:/opt/rustwide/target:rw,Z" "-v" "/var/lib/crater-agent-workspace/builds/worker-5-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] f084f6d09827e86203864a8eea67809115ed6d149898b11ac460545c021fd57e [INFO] running `Command { std: "docker" "start" "-a" "f084f6d09827e86203864a8eea67809115ed6d149898b11ac460545c021fd57e", kill_on_drop: false }` [INFO] [stderr] Checking leetcode-rust v0.1.2 (/opt/rustwide/workdir) [INFO] [stdout] warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` [INFO] [stdout] --> src/add_two_numbers.rs:17:9 [INFO] [stdout] | [INFO] [stdout] 17 | / match l1 { [INFO] [stdout] 18 | | Some(ref node) => { [INFO] [stdout] 19 | | sum += node.val; [INFO] [stdout] 20 | | l1 = l1.unwrap().next.as_ref(); [INFO] [stdout] ... | [INFO] [stdout] 24 | | None => {} [INFO] [stdout] 25 | | } [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] 17 ~ if let Some(ref node) = l1 { [INFO] [stdout] 18 + sum += node.val; [INFO] [stdout] 19 + l1 = l1.unwrap().next.as_ref(); [INFO] [stdout] 20 + // or [INFO] [stdout] 21 + // l1 = l1.map(|n| n.next.as_ref()).unwrap_or(None); [INFO] [stdout] 22 + } [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/add_two_numbers.rs:27:9 [INFO] [stdout] | [INFO] [stdout] 27 | / match l2 { [INFO] [stdout] 28 | | Some(ref node) => { [INFO] [stdout] 29 | | sum += node.val; [INFO] [stdout] 30 | | l2 = l2.unwrap().next.as_ref(); [INFO] [stdout] 31 | | } [INFO] [stdout] 32 | | None => {} [INFO] [stdout] 33 | | } [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] 27 ~ if let Some(ref node) = l2 { [INFO] [stdout] 28 + sum += node.val; [INFO] [stdout] 29 + l2 = l2.unwrap().next.as_ref(); [INFO] [stdout] 30 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this pattern creates a reference to a reference [INFO] [stdout] --> src/add_two_numbers.rs:18:18 [INFO] [stdout] | [INFO] [stdout] 18 | Some(ref node) => { [INFO] [stdout] | ^^^^^^^^ [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] help: try [INFO] [stdout] | [INFO] [stdout] 18 - Some(ref node) => { [INFO] [stdout] 18 + Some(node) => { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this pattern creates a reference to a reference [INFO] [stdout] --> src/add_two_numbers.rs:28:18 [INFO] [stdout] | [INFO] [stdout] 28 | Some(ref node) => { [INFO] [stdout] | ^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 28 - Some(ref node) => { [INFO] [stdout] 28 + Some(node) => { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is only used to index `rest_vec` [INFO] [stdout] --> src/add_two_numbers.rs:72:14 [INFO] [stdout] | [INFO] [stdout] 72 | for i in min_len..max_len { [INFO] [stdout] | ^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] = note: `#[warn(clippy::needless_range_loop)]` on by default [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 72 - for i in min_len..max_len { [INFO] [stdout] 72 + for in rest_vec.iter().take(max_len).skip(min_len) { [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/add_two_numbers.rs:100:9 [INFO] [stdout] | [INFO] [stdout] 100 | / match list { [INFO] [stdout] 101 | | Some(ref node) => nums.push(node.val), [INFO] [stdout] 102 | | None => {} [INFO] [stdout] 103 | | }; [INFO] [stdout] | |_________^ help: try: `if let Some(ref node) = list { nums.push(node.val) }` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/binary_tree_inorder_traversal.rs:18:49 [INFO] [stdout] | [INFO] [stdout] 18 | inorder(node.borrow().left.clone(), &mut res); [INFO] [stdout] | ^^^^^^^^ help: change this to: `res` [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/binary_tree_inorder_traversal.rs:20:50 [INFO] [stdout] | [INFO] [stdout] 20 | inorder(node.borrow().right.clone(), &mut res); [INFO] [stdout] | ^^^^^^^^ help: change this to: `res` [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: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` [INFO] [stdout] --> src/binary_tree_level_order_traversal.rs:19:9 [INFO] [stdout] | [INFO] [stdout] 19 | / match cur { [INFO] [stdout] 20 | | Some(node) => { [INFO] [stdout] 21 | | if depth >= res.len() { [INFO] [stdout] 22 | | res.push(vec![]); [INFO] [stdout] ... | [INFO] [stdout] 28 | | _ => {} [INFO] [stdout] 29 | | } [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] 19 ~ if let Some(node) = cur { [INFO] [stdout] 20 + if depth >= res.len() { [INFO] [stdout] 21 + res.push(vec![]); [INFO] [stdout] 22 + } [INFO] [stdout] 23 + res[depth].push(node.borrow().val); [INFO] [stdout] 24 + q.push_back((node.borrow().left.clone(), depth + 1)); [INFO] [stdout] 25 + q.push_back((node.borrow().right.clone(), depth + 1)); [INFO] [stdout] 26 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/binary_tree_postorder_traversal.rs:18:51 [INFO] [stdout] | [INFO] [stdout] 18 | postorder(node.borrow().left.clone(), &mut res); [INFO] [stdout] | ^^^^^^^^ help: change this to: `res` [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/binary_tree_postorder_traversal.rs:19:52 [INFO] [stdout] | [INFO] [stdout] 19 | postorder(node.borrow().right.clone(), &mut res); [INFO] [stdout] | ^^^^^^^^ help: change this to: `res` [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/binary_tree_preorder_traversal.rs:19:50 [INFO] [stdout] | [INFO] [stdout] 19 | preorder(node.borrow().left.clone(), &mut res); [INFO] [stdout] | ^^^^^^^^ help: change this to: `res` [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/binary_tree_preorder_traversal.rs:20:51 [INFO] [stdout] | [INFO] [stdout] 20 | preorder(node.borrow().right.clone(), &mut res); [INFO] [stdout] | ^^^^^^^^ help: change this to: `res` [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: equality checks against false can be replaced by a negation [INFO] [stdout] --> src/contains_duplicate.rs:8:12 [INFO] [stdout] | [INFO] [stdout] 8 | if set.insert(num) == false { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `!set.insert(num)` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_comparison [INFO] [stdout] = note: `#[warn(clippy::bool_comparison)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: slow zero-filling initialization [INFO] [stdout] --> src/daily_temperatures.rs:5:19 [INFO] [stdout] | [INFO] [stdout] 5 | let mut res = vec![]; [INFO] [stdout] | ___________________^ [INFO] [stdout] 6 | | res.resize(t.len(), 0); [INFO] [stdout] | |__________________________^ help: consider replacing this with: `vec![0; t.len()]` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#slow_vector_initialization [INFO] [stdout] = note: `#[warn(clippy::slow_vector_initialization)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the variable `count` is used as a loop counter [INFO] [stdout] --> src/daily_temperatures.rs:9:5 [INFO] [stdout] | [INFO] [stdout] 9 | for i in 0..t.len() { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^ help: consider using: `for (count, i) in (0..t.len()).enumerate()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_counter_loop [INFO] [stdout] = note: `#[warn(clippy::explicit_counter_loop)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `repeat().take()` can be written more concisely [INFO] [stdout] --> src/design_circular_queue.rs:19:17 [INFO] [stdout] | [INFO] [stdout] 19 | let q = iter::repeat(0).take(size.clone()).collect::>(); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `repeat_n()` instead: `std::iter::repeat_n(0, size.clone())` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_repeat_n [INFO] [stdout] = note: `#[warn(clippy::manual_repeat_n)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `usize` which implements the `Copy` trait [INFO] [stdout] --> src/design_circular_queue.rs:19:38 [INFO] [stdout] | [INFO] [stdout] 19 | let q = iter::repeat(0).take(size.clone()).collect::>(); [INFO] [stdout] | ^^^^^^^^^^^^ help: try removing the `clone` call: `size` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] = note: `#[warn(clippy::clone_on_copy)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `repeat().take()` can be written more concisely [INFO] [stdout] --> src/design_hashmap.rs:17:22 [INFO] [stdout] | [INFO] [stdout] 17 | let bucket = iter::repeat(LinkedList::new()) [INFO] [stdout] | ______________________^ [INFO] [stdout] 18 | | .take(len as usize) [INFO] [stdout] | |_______________________________^ help: consider using `repeat_n()` instead: `std::iter::repeat_n(LinkedList::new(), len as usize)` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_repeat_n [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: deref which would be done by auto-deref [INFO] [stdout] --> src/design_hashmap.rs:27:17 [INFO] [stdout] | [INFO] [stdout] 27 | (*pair).1 = value; [INFO] [stdout] | ^^^^^^^ help: try: `pair` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref [INFO] [stdout] = note: `#[warn(clippy::explicit_auto_deref)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: deref which would be done by auto-deref [INFO] [stdout] --> src/design_hashmap.rs:40:27 [INFO] [stdout] | [INFO] [stdout] 40 | Some(pair) => (*pair).1, [INFO] [stdout] | ^^^^^^^ help: try: `pair` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: deref which would be done by auto-deref [INFO] [stdout] --> src/design_hashmap.rs:51:17 [INFO] [stdout] | [INFO] [stdout] 51 | (*val).1 = -1; [INFO] [stdout] | ^^^^^^ help: try: `val` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant pattern matching, consider using `is_some()` [INFO] [stdout] --> src/design_hashmap.rs:58:9 [INFO] [stdout] | [INFO] [stdout] 58 | / match self._find(key) { [INFO] [stdout] 59 | | Some(_) => true, [INFO] [stdout] 60 | | None => false, [INFO] [stdout] 61 | | } [INFO] [stdout] | |_________^ help: try: `self._find(key).is_some()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pattern_matching [INFO] [stdout] = note: `#[warn(clippy::redundant_pattern_matching)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of `Iterator::find` [INFO] [stdout] --> src/design_hashmap.rs:68:9 [INFO] [stdout] | [INFO] [stdout] 68 | / for val in list.iter_mut() { [INFO] [stdout] 69 | | if (*val).0 == key { [INFO] [stdout] 70 | | return Some(val); [INFO] [stdout] ... | [INFO] [stdout] 74 | | None [INFO] [stdout] | |____________^ help: replace with an iterator: `list.iter_mut().find(|val| (*val).0 == key).map(|v| v as _)` [INFO] [stdout] | [INFO] [stdout] = note: you may need to dereference some variables [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_find [INFO] [stdout] = note: `#[warn(clippy::manual_find)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: deref which would be done by auto-deref [INFO] [stdout] --> src/design_hashmap.rs:69:16 [INFO] [stdout] | [INFO] [stdout] 69 | if (*val).0 == key { [INFO] [stdout] | ^^^^^^ help: try: `val` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you should consider adding a `Default` implementation for `MyHashSet` [INFO] [stdout] --> src/design_hashset.rs:15:5 [INFO] [stdout] | [INFO] [stdout] 15 | / pub fn new() -> Self { [INFO] [stdout] 16 | | let len: i32 = 2047; [INFO] [stdout] 17 | | let bucket = iter::repeat(LinkedList::new()) [INFO] [stdout] 18 | | .take(len as usize) [INFO] [stdout] 19 | | .collect::>>(); [INFO] [stdout] 20 | | Self { bucket, len } [INFO] [stdout] 21 | | } [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default [INFO] [stdout] = note: `#[warn(clippy::new_without_default)]` on by default [INFO] [stdout] help: try adding this [INFO] [stdout] | [INFO] [stdout] 13 + impl Default for MyHashSet { [INFO] [stdout] 14 + fn default() -> Self { [INFO] [stdout] 15 + Self::new() [INFO] [stdout] 16 + } [INFO] [stdout] 17 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `repeat().take()` can be written more concisely [INFO] [stdout] --> src/design_hashset.rs:17:22 [INFO] [stdout] | [INFO] [stdout] 17 | let bucket = iter::repeat(LinkedList::new()) [INFO] [stdout] | ______________________^ [INFO] [stdout] 18 | | .take(len as usize) [INFO] [stdout] | |_______________________________^ help: consider using `repeat_n()` instead: `std::iter::repeat_n(LinkedList::new(), len as usize)` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_repeat_n [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/design_hashset.rs:25:13 [INFO] [stdout] | [INFO] [stdout] 25 | 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] = note: `#[warn(clippy::needless_return)]` on by default [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 24 - if self.contains(key) { [INFO] [stdout] 25 - return; [INFO] [stdout] 24 + if self.contains(key) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant pattern matching, consider using `is_some()` [INFO] [stdout] --> src/design_hashset.rs:44:9 [INFO] [stdout] | [INFO] [stdout] 44 | / match self._find(key) { [INFO] [stdout] 45 | | Some(_) => true, [INFO] [stdout] 46 | | None => false, [INFO] [stdout] 47 | | } [INFO] [stdout] | |_________^ help: try: `self._find(key).is_some()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pattern_matching [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of `Iterator::find` [INFO] [stdout] --> src/design_hashset.rs:54:9 [INFO] [stdout] | [INFO] [stdout] 54 | / for val in list.iter_mut() { [INFO] [stdout] 55 | | if *val == key { [INFO] [stdout] 56 | | return Some(val); [INFO] [stdout] ... | [INFO] [stdout] 60 | | None [INFO] [stdout] | |____________^ help: replace with an iterator: `list.iter_mut().find(|val| *val == key).map(|v| v as _)` [INFO] [stdout] | [INFO] [stdout] = note: you may need to dereference some variables [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_find [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/diagonal_traverse.rs:8:5 [INFO] [stdout] | [INFO] [stdout] 8 | /// and let up = !up [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] = note: `#[warn(clippy::doc_lazy_continuation)]` on by default [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 8 | /// and let up = !up [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/diagonal_traverse.rs:9:5 [INFO] [stdout] | [INFO] [stdout] 9 | /// otherwise go up and right or go down and left. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 9 | /// otherwise go up and right or go down and left. [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manually reimplementing `div_ceil` [INFO] [stdout] --> src/find_median_sorted_arrays.rs:19:16 [INFO] [stdout] | [INFO] [stdout] 19 | let half = (m + n + 1) / 2; [INFO] [stdout] | ^^^^^^^^^^^^^^^ help: consider using `.div_ceil()`: `(m + 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: unneeded `return` statement [INFO] [stdout] --> src/find_peak_element.rs:30:5 [INFO] [stdout] | [INFO] [stdout] 30 | return left as i32; [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] 30 - return left as i32; [INFO] [stdout] 30 + left as i32 [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` has identical blocks [INFO] [stdout] --> src/find_peak_element.rs:21:49 [INFO] [stdout] | [INFO] [stdout] 21 | } else if mid == 0 && nums[0] > nums[1] { [INFO] [stdout] | _________________________________________________^ [INFO] [stdout] 22 | | return mid as i32; [INFO] [stdout] 23 | | } else if mid == nums.len() - 1 && nums[mid - 1] < nums[mid] { [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] note: same as this [INFO] [stdout] --> src/find_peak_element.rs:23:70 [INFO] [stdout] | [INFO] [stdout] 23 | } else if mid == nums.len() - 1 && nums[mid - 1] < nums[mid] { [INFO] [stdout] | ______________________________________________________________________^ [INFO] [stdout] 24 | | return mid as i32; [INFO] [stdout] 25 | | } else { [INFO] [stdout] | |_________^ [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#if_same_then_else [INFO] [stdout] = note: `#[warn(clippy::if_same_then_else)]` on by default [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/four_sum_2.rs:27:13 [INFO] [stdout] | [INFO] [stdout] 27 | / match sums.get(&sum) { [INFO] [stdout] 28 | | Some(x) => { [INFO] [stdout] 29 | | count += *x; [INFO] [stdout] ... | [INFO] [stdout] 32 | | } [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] 27 ~ if let Some(x) = sums.get(&sum) { [INFO] [stdout] 28 + count += *x; [INFO] [stdout] 29 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you seem to be trying to use `match` for an equality check. Consider using `if` [INFO] [stdout] --> src/group_anagrams.rs:20:9 [INFO] [stdout] | [INFO] [stdout] 20 | / match map.get(&temp) { [INFO] [stdout] 21 | | None => { [INFO] [stdout] 22 | | res.push(vec![]); [INFO] [stdout] 23 | | map.insert(temp.clone(), res.len() - 1); [INFO] [stdout] 24 | | } [INFO] [stdout] 25 | | Some(_) => {} [INFO] [stdout] 26 | | } [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] 20 ~ if map.get(&temp) == None { [INFO] [stdout] 21 + res.push(vec![]); [INFO] [stdout] 22 + map.insert(temp.clone(), res.len() - 1); [INFO] [stdout] 23 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is only used to index `a` [INFO] [stdout] --> src/internal_list_intersections.rs:18:14 [INFO] [stdout] | [INFO] [stdout] 18 | for i in 0..a.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] 18 - for i in 0..a.len() { [INFO] [stdout] 18 + for in &a { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `j` is only used to index `b` [INFO] [stdout] --> src/internal_list_intersections.rs:19:18 [INFO] [stdout] | [INFO] [stdout] 19 | for j in 0..b.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] 19 - for j in 0..b.len() { [INFO] [stdout] 19 + for in &b { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you are using an explicit closure for copying elements [INFO] [stdout] --> src/intersection_of_two_arrays.rs:16:5 [INFO] [stdout] | [INFO] [stdout] 16 | set1.intersection(&set2).map(|x| *x).collect() [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `copied` method: `set1.intersection(&set2).copied()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_clone [INFO] [stdout] = note: `#[warn(clippy::map_clone)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` can be collapsed into the outer `match` [INFO] [stdout] --> src/intersection_of_two_arrays_2.rs:25:17 [INFO] [stdout] | [INFO] [stdout] 25 | / if *v > 0 { [INFO] [stdout] 26 | | *v -= 1; [INFO] [stdout] 27 | | res.push(num); [INFO] [stdout] 28 | | } [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] 24 ~ Some(v) [INFO] [stdout] 25 ~ if *v > 0 => { [INFO] [stdout] 26 | *v -= 1; [INFO] [stdout] 27 | res.push(num); [INFO] [stdout] 28 ~ } [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/intersection_of_two_arrays_2.rs:23:9 [INFO] [stdout] | [INFO] [stdout] 23 | / match map.get_mut(&num) { [INFO] [stdout] 24 | | Some(v) => { [INFO] [stdout] 25 | | if *v > 0 { [INFO] [stdout] 26 | | *v -= 1; [INFO] [stdout] ... | [INFO] [stdout] 31 | | None => {} [INFO] [stdout] 32 | | } [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] 23 ~ if let Some(v) = map.get_mut(&num) { [INFO] [stdout] 24 + if *v > 0 { [INFO] [stdout] 25 + *v -= 1; [INFO] [stdout] 26 + res.push(num); [INFO] [stdout] 27 + } [INFO] [stdout] 28 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: usage of `contains_key` followed by `insert` on a `HashMap` [INFO] [stdout] --> src/isomorphic_strings.rs:14:9 [INFO] [stdout] | [INFO] [stdout] 14 | / if map.contains_key(&c1) { [INFO] [stdout] 15 | | let v = map.get_mut(&c1).unwrap(); [INFO] [stdout] 16 | | if *v != c2 { [INFO] [stdout] 17 | | return false; [INFO] [stdout] ... | [INFO] [stdout] 22 | | map.insert(c1, c2); [INFO] [stdout] 23 | | } [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_entry [INFO] [stdout] = note: `#[warn(clippy::map_entry)]` on by default [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 14 ~ if let std::collections::hash_map::Entry::Vacant(e) = map.entry(c1) if map2.contains_key(&c2) { [INFO] [stdout] 15 + return false; [INFO] [stdout] 16 + } else { [INFO] [stdout] 17 + e.insert(c2); [INFO] [stdout] 18 + } else { [INFO] [stdout] 19 + let v = map.get_mut(&c1).unwrap(); [INFO] [stdout] 20 + if *v != c2 { [INFO] [stdout] 21 + return false; [INFO] [stdout] 22 + } [INFO] [stdout] 23 + } [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/kth_largest_element_in_an_array.rs:21:20 [INFO] [stdout] | [INFO] [stdout] 21 | fn partition(nums: &mut Vec, left: i32, right: 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] = note: `#[warn(clippy::ptr_arg)]` on by default [INFO] [stdout] help: change this to [INFO] [stdout] | [INFO] [stdout] 21 - fn partition(nums: &mut Vec, left: i32, right: i32) -> i32 { [INFO] [stdout] 21 + fn partition(nums: &mut [i32], left: i32, right: i32) -> i32 { [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/kth_largest_element_in_an_array.rs:41:21 [INFO] [stdout] | [INFO] [stdout] 41 | fn partition2(nums: &mut Vec, left: i32, right: 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] 41 - fn partition2(nums: &mut Vec, left: i32, right: i32) -> i32 { [INFO] [stdout] 41 + fn partition2(nums: &mut [i32], left: i32, right: i32) -> i32 { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: casting to the same type is unnecessary (`usize` -> `usize`) [INFO] [stdout] --> src/kth_largest_element_in_an_array.rs:45:15 [INFO] [stdout] | [INFO] [stdout] 45 | nums.swap(left as usize, right as usize); [INFO] [stdout] | ^^^^^^^^^^^^^ help: try: `left` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast [INFO] [stdout] = note: `#[warn(clippy::unnecessary_cast)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: casting to the same type is unnecessary (`usize` -> `usize`) [INFO] [stdout] --> src/kth_largest_element_in_an_array.rs:45:30 [INFO] [stdout] | [INFO] [stdout] 45 | nums.swap(left as usize, right as usize); [INFO] [stdout] | ^^^^^^^^^^^^^^ help: try: `right` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: length comparison to zero [INFO] [stdout] --> src/largest_number_at_least_twice_of_others.rs:4:8 [INFO] [stdout] | [INFO] [stdout] 4 | if nums.len() == 0 { [INFO] [stdout] | ^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `nums.is_empty()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero [INFO] [stdout] = note: `#[warn(clippy::len_zero)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: length comparison to zero [INFO] [stdout] --> src/longest_common_prefix.rs:6:8 [INFO] [stdout] | [INFO] [stdout] 6 | if strs.len() == 0 { [INFO] [stdout] | ^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `strs.is_empty()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded late initialization [INFO] [stdout] --> src/longest_common_prefix.rs:14:9 [INFO] [stdout] | [INFO] [stdout] 14 | let cur_ch: char; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_late_init [INFO] [stdout] = note: `#[warn(clippy::needless_late_init)]` on by default [INFO] [stdout] help: move the declaration `cur_ch` here and remove the assignments from the `match` arms [INFO] [stdout] | [INFO] [stdout] 14 ~ [INFO] [stdout] 15 ~ let cur_ch: char = match strs[0].chars().nth(k) { [INFO] [stdout] 16 | None => { [INFO] [stdout] ... [INFO] [stdout] 19 | Some(ch) => { [INFO] [stdout] 20 ~ ch [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is only used to index `strs` [INFO] [stdout] --> src/longest_common_prefix.rs:24:18 [INFO] [stdout] | [INFO] [stdout] 24 | for i in 1..strs.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] 24 - for i in 1..strs.len() { [INFO] [stdout] 24 + for in strs.iter().skip(1) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `repeat().take()` can be written more concisely [INFO] [stdout] --> src/longest_palindrome.rs:12:17 [INFO] [stdout] | [INFO] [stdout] 12 | dp.push(iter::repeat(true).take(s.len()).collect()) [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `repeat_n()` instead: `std::iter::repeat_n(true, s.len())` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_repeat_n [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/merge_sorted_array.rs:3:21 [INFO] [stdout] | [INFO] [stdout] 3 | pub fn merge(nums1: &mut Vec, m: i32, nums2: &mut 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] 3 - pub fn merge(nums1: &mut Vec, m: i32, nums2: &mut Vec, n: i32) { [INFO] [stdout] 3 + pub fn merge(nums1: &mut [i32], m: i32, nums2: &mut Vec, n: i32) { [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/merge_sorted_array.rs:3:51 [INFO] [stdout] | [INFO] [stdout] 3 | pub fn merge(nums1: &mut Vec, m: i32, nums2: &mut 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] 3 - pub fn merge(nums1: &mut Vec, m: i32, nums2: &mut Vec, n: i32) { [INFO] [stdout] 3 + pub fn merge(nums1: &mut Vec, m: i32, nums2: &mut [i32], n: i32) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this boolean expression can be simplified [INFO] [stdout] --> src/merge_sorted_array.rs:64:12 [INFO] [stdout] | [INFO] [stdout] 64 | if (j < 0 && i >= 0) || (i >= 0 && nums1[i as usize] > nums2[j as usize]) { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#nonminimal_bool [INFO] [stdout] = note: `#[warn(clippy::nonminimal_bool)]` on by default [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 64 - if (j < 0 && i >= 0) || (i >= 0 && nums1[i as usize] > nums2[j as usize]) { [INFO] [stdout] 64 + if !(i < 0 || j >= 0 && nums1[i as usize] <= nums2[j as usize]) { [INFO] [stdout] | [INFO] [stdout] 64 - if (j < 0 && i >= 0) || (i >= 0 && nums1[i as usize] > nums2[j as usize]) { [INFO] [stdout] 64 + if (nums1[i as usize] > nums2[j as usize] || j < 0) && i >= 0 { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this boolean expression can be simplified [INFO] [stdout] --> src/merge_sorted_array.rs:68:19 [INFO] [stdout] | [INFO] [stdout] 68 | } else if (i < 0 && j >= 0) || (j >= 0 && nums1[i as usize] <= nums2[j as usize]) { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#nonminimal_bool [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 68 - } else if (i < 0 && j >= 0) || (j >= 0 && nums1[i as usize] <= nums2[j as usize]) { [INFO] [stdout] 68 + } else if !(j < 0 || i >= 0 && nums1[i as usize] > nums2[j as usize]) { [INFO] [stdout] | [INFO] [stdout] 68 - } else if (i < 0 && j >= 0) || (j >= 0 && nums1[i as usize] <= nums2[j as usize]) { [INFO] [stdout] 68 + } else if (nums1[i as usize] <= nums2[j as usize] || i < 0) && j >= 0 { [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/merge_sorted_array.rs:49:22 [INFO] [stdout] | [INFO] [stdout] 49 | pub fn merge2(nums1: &mut Vec, m: i32, nums2: &mut 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] 49 - pub fn merge2(nums1: &mut Vec, m: i32, nums2: &mut Vec, n: i32) { [INFO] [stdout] 49 + pub fn merge2(nums1: &mut [i32], m: i32, nums2: &mut Vec, n: i32) { [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/merge_sorted_array.rs:49:52 [INFO] [stdout] | [INFO] [stdout] 49 | pub fn merge2(nums1: &mut Vec, m: i32, nums2: &mut 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] 49 - pub fn merge2(nums1: &mut Vec, m: i32, nums2: &mut Vec, n: i32) { [INFO] [stdout] 49 + pub fn merge2(nums1: &mut Vec, m: i32, nums2: &mut [i32], n: i32) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you should consider adding a `Default` implementation for `MinStack` [INFO] [stdout] --> src/min_stack.rs:15:5 [INFO] [stdout] | [INFO] [stdout] 15 | / pub fn new() -> Self { [INFO] [stdout] 16 | | Self { top: None } [INFO] [stdout] 17 | | } [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default [INFO] [stdout] help: try adding this [INFO] [stdout] | [INFO] [stdout] 14 + impl Default for MinStack { [INFO] [stdout] 15 + fn default() -> Self { [INFO] [stdout] 16 + Self::new() [INFO] [stdout] 17 + } [INFO] [stdout] 18 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant pattern matching, consider using `is_none()` [INFO] [stdout] --> src/min_stack.rs:20:9 [INFO] [stdout] | [INFO] [stdout] 20 | / match &self.top { [INFO] [stdout] 21 | | None => true, [INFO] [stdout] 22 | | Some(_) => false, [INFO] [stdout] 23 | | } [INFO] [stdout] | |_________^ help: try: `self.top.is_none()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pattern_matching [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/min_stack.rs:61:9 [INFO] [stdout] | [INFO] [stdout] 61 | / match node { [INFO] [stdout] 62 | | Some(mut x) => self.top = x.next.take(), [INFO] [stdout] 63 | | None => {} [INFO] [stdout] 64 | | }; [INFO] [stdout] | |_________^ help: try: `if let Some(mut x) = node { self.top = x.next.take() }` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match [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/minimum_index_sum_of_two_lists.rs:13:9 [INFO] [stdout] | [INFO] [stdout] 13 | / match map.get_mut(&x) { [INFO] [stdout] 14 | | Some(v) => { [INFO] [stdout] 15 | | if *v + i < min { [INFO] [stdout] 16 | | min = *v + i; [INFO] [stdout] ... | [INFO] [stdout] 23 | | None => {} [INFO] [stdout] 24 | | } [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] 13 ~ if let Some(v) = map.get_mut(&x) { [INFO] [stdout] 14 + if *v + i < min { [INFO] [stdout] 15 + min = *v + i; [INFO] [stdout] 16 + res.clear(); [INFO] [stdout] 17 + res.push(x); [INFO] [stdout] 18 + } else if *v + i == min { [INFO] [stdout] 19 + res.push(x); [INFO] [stdout] 20 + } [INFO] [stdout] 21 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: length comparison to one [INFO] [stdout] --> src/minimum_size_subarray_sum.rs:39:8 [INFO] [stdout] | [INFO] [stdout] 39 | if nums.len() < 1 { [INFO] [stdout] | ^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `nums.is_empty()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do [INFO] [stdout] --> src/move_zeroes.rs:3:26 [INFO] [stdout] | [INFO] [stdout] 3 | pub fn move_zeroes(nums: &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] help: change this to [INFO] [stdout] | [INFO] [stdout] 3 - pub fn move_zeroes(nums: &mut Vec) { [INFO] [stdout] 3 + pub fn move_zeroes(nums: &mut [i32]) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: length comparison to zero [INFO] [stdout] --> src/next_greater_element_1.rs:9:15 [INFO] [stdout] | [INFO] [stdout] 9 | while stack.len() != 0 && stack[stack.len() - 1] < num { [INFO] [stdout] | ^^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!stack.is_empty()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `repeat().take()` can be written more concisely [INFO] [stdout] --> src/number_of_islands.rs:8:22 [INFO] [stdout] | [INFO] [stdout] 8 | visited.push(iter::repeat(false).take(grid[0].len()).collect()); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `repeat_n()` instead: `std::iter::repeat_n(false, grid[0].len())` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_repeat_n [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/number_of_islands.rs:27:13 [INFO] [stdout] | [INFO] [stdout] 27 | dfs(&grid, &mut visited, i + 1, j); [INFO] [stdout] | ^^^^^ help: change this to: `grid` [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/number_of_islands.rs:27:20 [INFO] [stdout] | [INFO] [stdout] 27 | dfs(&grid, &mut visited, i + 1, j); [INFO] [stdout] | ^^^^^^^^^^^^ help: change this to: `visited` [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/number_of_islands.rs:30:13 [INFO] [stdout] | [INFO] [stdout] 30 | dfs(&grid, &mut visited, i - 1, j); [INFO] [stdout] | ^^^^^ help: change this to: `grid` [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/number_of_islands.rs:30:20 [INFO] [stdout] | [INFO] [stdout] 30 | dfs(&grid, &mut visited, i - 1, j); [INFO] [stdout] | ^^^^^^^^^^^^ help: change this to: `visited` [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/number_of_islands.rs:33:13 [INFO] [stdout] | [INFO] [stdout] 33 | dfs(&grid, &mut visited, i, j + 1); [INFO] [stdout] | ^^^^^ help: change this to: `grid` [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/number_of_islands.rs:33:20 [INFO] [stdout] | [INFO] [stdout] 33 | dfs(&grid, &mut visited, i, j + 1); [INFO] [stdout] | ^^^^^^^^^^^^ help: change this to: `visited` [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/number_of_islands.rs:36:13 [INFO] [stdout] | [INFO] [stdout] 36 | dfs(&grid, &mut visited, i, j - 1); [INFO] [stdout] | ^^^^^ help: change this to: `grid` [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/number_of_islands.rs:36:20 [INFO] [stdout] | [INFO] [stdout] 36 | dfs(&grid, &mut visited, i, j - 1); [INFO] [stdout] | ^^^^^^^^^^^^ help: change this to: `visited` [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 `repeat().take()` can be written more concisely [INFO] [stdout] --> src/number_of_islands.rs:45:22 [INFO] [stdout] | [INFO] [stdout] 45 | visited.push(iter::repeat(false).take(grid[0].len()).collect()); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `repeat_n()` instead: `std::iter::repeat_n(false, grid[0].len())` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_repeat_n [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do [INFO] [stdout] --> src/number_of_islands.rs:60:14 [INFO] [stdout] | [INFO] [stdout] 60 | fn bfs(grid: &Vec>, visited: &mut Vec>, i: usize, j: 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] 60 - fn bfs(grid: &Vec>, visited: &mut Vec>, i: usize, j: usize) { [INFO] [stdout] 60 + fn bfs(grid: &[Vec], visited: &mut Vec>, i: usize, j: usize) { [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/number_of_islands.rs:60:40 [INFO] [stdout] | [INFO] [stdout] 60 | fn bfs(grid: &Vec>, visited: &mut Vec>, i: usize, j: 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] 60 - fn bfs(grid: &Vec>, visited: &mut Vec>, i: usize, j: usize) { [INFO] [stdout] 60 + fn bfs(grid: &Vec>, visited: &mut [Vec], i: usize, j: usize) { [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/number_of_islands.rs:102:15 [INFO] [stdout] | [INFO] [stdout] 102 | fn bfs2(grid: &mut Vec>, i: usize, j: 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] 102 - fn bfs2(grid: &mut Vec>, i: usize, j: usize) { [INFO] [stdout] 102 + fn bfs2(grid: &mut [Vec], i: usize, j: usize) { [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/open_the_lock.rs:18:9 [INFO] [stdout] | [INFO] [stdout] 18 | / match dead_ends.get(&cur.0) { [INFO] [stdout] 19 | | Some(_) => { [INFO] [stdout] 20 | | continue; [INFO] [stdout] ... | [INFO] [stdout] 23 | | } [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] 18 ~ if let Some(_) = dead_ends.get(&cur.0) { [INFO] [stdout] 19 + continue; [INFO] [stdout] 20 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this if-then-else expression returns a bool literal [INFO] [stdout] --> src/palindrome_number.rs:17:5 [INFO] [stdout] | [INFO] [stdout] 17 | / if x == reversed_num || x == reversed_num / 10 { [INFO] [stdout] 18 | | true [INFO] [stdout] 19 | | } else { [INFO] [stdout] 20 | | false [INFO] [stdout] 21 | | } [INFO] [stdout] | |_____^ help: you can reduce it to: `x == reversed_num || x == reversed_num / 10` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_bool [INFO] [stdout] = note: `#[warn(clippy::needless_bool)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do [INFO] [stdout] --> src/remove_duplicates.rs:3:32 [INFO] [stdout] | [INFO] [stdout] 3 | pub fn remove_duplicates(nums: &mut Vec) -> 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] 3 - pub fn remove_duplicates(nums: &mut Vec) -> i32 { [INFO] [stdout] 3 + pub fn remove_duplicates(nums: &mut [i32]) -> i32 { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: length comparison to zero [INFO] [stdout] --> src/remove_duplicates.rs:4:8 [INFO] [stdout] | [INFO] [stdout] 4 | if nums.len() == 0 || nums.len() == 1 { [INFO] [stdout] | ^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `nums.is_empty()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do [INFO] [stdout] --> src/remove_duplicates_2.rs:3:32 [INFO] [stdout] | [INFO] [stdout] 3 | pub fn remove_duplicates(nums: &mut Vec) -> 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] 3 - pub fn remove_duplicates(nums: &mut Vec) -> i32 { [INFO] [stdout] 3 + pub fn remove_duplicates(nums: &mut [i32]) -> i32 { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this boolean expression can be simplified [INFO] [stdout] --> src/remove_duplicates_2.rs:34:12 [INFO] [stdout] | [INFO] [stdout] 34 | if (nums[j] != nums[i]) || (nums[j] == nums[i] && nums[j] != nums[k]) { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#nonminimal_bool [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 34 - if (nums[j] != nums[i]) || (nums[j] == nums[i] && nums[j] != nums[k]) { [INFO] [stdout] 34 + if !(nums[j] == nums[i] && nums[j] == nums[k]) { [INFO] [stdout] | [INFO] [stdout] 34 - if (nums[j] != nums[i]) || (nums[j] == nums[i] && nums[j] != nums[k]) { [INFO] [stdout] 34 + if (nums[j] != nums[i]) || nums[j] != nums[k] { [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/remove_duplicates_2.rs:24:33 [INFO] [stdout] | [INFO] [stdout] 24 | pub fn remove_duplicates2(nums: &mut Vec) -> 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] 24 - pub fn remove_duplicates2(nums: &mut Vec) -> i32 { [INFO] [stdout] 24 + pub fn remove_duplicates2(nums: &mut [i32]) -> i32 { [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/remove_duplicates_2.rs:46:33 [INFO] [stdout] | [INFO] [stdout] 46 | pub fn remove_duplicates3(nums: &mut Vec) -> 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] 46 - pub fn remove_duplicates3(nums: &mut Vec) -> i32 { [INFO] [stdout] 46 + pub fn remove_duplicates3(nums: &mut [i32]) -> i32 { [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/remove_element.rs:3:29 [INFO] [stdout] | [INFO] [stdout] 3 | pub fn remove_element(nums: &mut Vec, val: 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] 3 - pub fn remove_element(nums: &mut Vec, val: i32) -> i32 { [INFO] [stdout] 3 + pub fn remove_element(nums: &mut [i32], val: i32) -> i32 { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: importing legacy numeric constants [INFO] [stdout] --> src/reverse_integer.rs:5:9 [INFO] [stdout] | [INFO] [stdout] 5 | use std::i32; [INFO] [stdout] | ^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: remove this import [INFO] [stdout] = note: then `i32::` will resolve to the respective associated constant [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#legacy_numeric_constants [INFO] [stdout] = note: `#[warn(clippy::legacy_numeric_constants)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do [INFO] [stdout] --> src/reverse_string.rs:4:26 [INFO] [stdout] | [INFO] [stdout] 4 | pub fn reverse_string(s: &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] help: change this to [INFO] [stdout] | [INFO] [stdout] 4 - pub fn reverse_string(s: &mut Vec) { [INFO] [stdout] 4 + pub fn reverse_string(s: &mut [char]) { [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/reverse_string.rs:17:27 [INFO] [stdout] | [INFO] [stdout] 17 | pub fn reverse_string2(s: &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] help: change this to [INFO] [stdout] | [INFO] [stdout] 17 - pub fn reverse_string2(s: &mut Vec) { [INFO] [stdout] 17 + pub fn reverse_string2(s: &mut [char]) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: length comparison to one [INFO] [stdout] --> src/reverse_vowels_of_a_string.rs:5:8 [INFO] [stdout] | [INFO] [stdout] 5 | if s.len() < 1 { [INFO] [stdout] | ^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `s.is_empty()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: length comparison to one [INFO] [stdout] --> src/reverse_vowels_of_a_string.rs:29:8 [INFO] [stdout] | [INFO] [stdout] 29 | if s.len() < 1 { [INFO] [stdout] | ^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `s.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: match expression looks like `matches!` macro [INFO] [stdout] --> src/reverse_vowels_of_a_string.rs:54:5 [INFO] [stdout] | [INFO] [stdout] 54 | / match c { [INFO] [stdout] 55 | | b'a' | b'A' | b'e' | b'E' | b'i' | b'I' | b'o' | b'O' | b'u' | b'U' => true, [INFO] [stdout] 56 | | _ => false, [INFO] [stdout] 57 | | } [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_like_matches_macro [INFO] [stdout] = note: `#[warn(clippy::match_like_matches_macro)]` on by default [INFO] [stdout] help: use `matches!` directly [INFO] [stdout] | [INFO] [stdout] 54 - match c { [INFO] [stdout] 55 - b'a' | b'A' | b'e' | b'E' | b'i' | b'I' | b'o' | b'O' | b'u' | b'U' => true, [INFO] [stdout] 56 - _ => false, [INFO] [stdout] 57 - } [INFO] [stdout] 54 + matches!(c, b'a' | b'A' | b'e' | b'E' | b'i' | b'I' | b'o' | b'O' | b'u' | b'U') [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: called `.nth(0)` on a `std::iter::Iterator`, when `.next()` is equivalent [INFO] [stdout] --> src/reverse_words_in_a_string.rs:8:45 [INFO] [stdout] | [INFO] [stdout] 8 | .fold(String::new(), |acc, x| match x.chars().nth(0) { [INFO] [stdout] | ^^^^^^^^^^^^^^^^ help: try calling `.next()` instead of `.nth(0)`: `x.chars().next()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#iter_nth_zero [INFO] [stdout] = note: `#[warn(clippy::iter_nth_zero)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: useless conversion to the same type: `std::str::SplitWhitespace<'_>` [INFO] [stdout] --> src/reverse_words_in_a_string.rs:17:13 [INFO] [stdout] | [INFO] [stdout] 17 | let s = s [INFO] [stdout] | _____________^ [INFO] [stdout] 18 | | .split_whitespace() [INFO] [stdout] 19 | | .into_iter() [INFO] [stdout] | |____________________^ [INFO] [stdout] | [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 `.into_iter()` [INFO] [stdout] | [INFO] [stdout] 17 ~ let s = s [INFO] [stdout] 18 + .split_whitespace() [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/rotate_array.rs:4:21 [INFO] [stdout] | [INFO] [stdout] 4 | pub fn rotate(nums: &mut Vec, k: 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] 4 - pub fn rotate(nums: &mut Vec, k: i32) { [INFO] [stdout] 4 + pub fn rotate(nums: &mut [i32], k: i32) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is only used to index `nums` [INFO] [stdout] --> src/rotate_array.rs:11:14 [INFO] [stdout] | [INFO] [stdout] 11 | for i in mid + 1..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] 11 - for i in mid + 1..nums.len() { [INFO] [stdout] 11 + for in nums.iter().skip(mid + 1) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: it looks like you're manually copying between slices [INFO] [stdout] --> src/rotate_array.rs:17:5 [INFO] [stdout] | [INFO] [stdout] 17 | / for i in 0..k { [INFO] [stdout] 18 | | nums[i] = temp[i]; [INFO] [stdout] 19 | | } [INFO] [stdout] | |_____^ help: try replacing the loop by: `nums[..k].copy_from_slice(&temp[..k]);` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_memcpy [INFO] [stdout] = note: `#[warn(clippy::manual_memcpy)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: deref which would be done by auto-deref [INFO] [stdout] --> src/sort_characters_by_frequency.rs:21:25 [INFO] [stdout] | [INFO] [stdout] 21 | freq.sort_by(|a, b| (*b).1.partial_cmp((*a).1).unwrap()); [INFO] [stdout] | ^^^^ help: try: `b` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: deref which would be done by auto-deref [INFO] [stdout] --> src/sort_characters_by_frequency.rs:21:44 [INFO] [stdout] | [INFO] [stdout] 21 | freq.sort_by(|a, b| (*b).1.partial_cmp((*a).1).unwrap()); [INFO] [stdout] | ^^^^ help: try: `a` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `repeat().take()` can be written more concisely [INFO] [stdout] --> src/sort_characters_by_frequency.rs:59:27 [INFO] [stdout] | [INFO] [stdout] 59 | res.push_str(&iter::repeat(c).take(i).collect::()); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `repeat_n()` instead: `std::iter::repeat_n(c, i)` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_repeat_n [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/sort_colors.rs:3:26 [INFO] [stdout] | [INFO] [stdout] 3 | pub fn sort_colors(nums: &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] help: change this to [INFO] [stdout] | [INFO] [stdout] 3 - pub fn sort_colors(nums: &mut Vec) { [INFO] [stdout] 3 + pub fn sort_colors(nums: &mut [i32]) { [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/sort_colors.rs:19:27 [INFO] [stdout] | [INFO] [stdout] 19 | pub fn sort_colors2(nums: &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] help: change this to [INFO] [stdout] | [INFO] [stdout] 19 - pub fn sort_colors2(nums: &mut Vec) { [INFO] [stdout] 19 + pub fn sort_colors2(nums: &mut [i32]) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `y` is only used to index `matrix` [INFO] [stdout] --> src/spiral_matrix.rs:14:18 [INFO] [stdout] | [INFO] [stdout] 14 | for y in y_min..y_max { [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] 14 - for y in y_min..y_max { [INFO] [stdout] 14 + for in matrix.iter().take(y_max).skip(y_min) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `x` is only used to index `matrix` [INFO] [stdout] --> src/spiral_matrix.rs:21:18 [INFO] [stdout] | [INFO] [stdout] 21 | for x in x_min..x_max { [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] 21 - for x in x_min..x_max { [INFO] [stdout] 21 + for in matrix.iter().take(x_max).skip(x_min) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/target_sum.rs:15:13 [INFO] [stdout] | [INFO] [stdout] 15 | return res; [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] 15 - return res; [INFO] [stdout] 15 + res [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/target_sum.rs:17:13 [INFO] [stdout] | [INFO] [stdout] 17 | return res; [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] 17 - return res; [INFO] [stdout] 17 + res [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/target_sum.rs:20:38 [INFO] [stdout] | [INFO] [stdout] 20 | res += _find_target_sum_ways(&nums, index + 1, s, sum + nums[index]); [INFO] [stdout] | ^^^^^ help: change this to: `nums` [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/target_sum.rs:21:38 [INFO] [stdout] | [INFO] [stdout] 21 | res += _find_target_sum_ways(&nums, index + 1, s, sum - nums[index]); [INFO] [stdout] | ^^^^^ help: change this to: `nums` [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: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()` [INFO] [stdout] --> src/top_k_frequent_elements.rs:24:9 [INFO] [stdout] | [INFO] [stdout] 24 | heap.pop().map(|(_k, v)| res.push(v)); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#option_map_unit_fn [INFO] [stdout] = note: `#[warn(clippy::option_map_unit_fn)]` on by default [INFO] [stdout] help: use `if let` instead [INFO] [stdout] | [INFO] [stdout] 24 - heap.pop().map(|(_k, v)| res.push(v)); [INFO] [stdout] 24 + if let Some((_k, v)) = heap.pop() { res.push(v) } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: length comparison to one [INFO] [stdout] --> src/valid_palindrome.rs:5:8 [INFO] [stdout] | [INFO] [stdout] 5 | if s.len() < 1 { [INFO] [stdout] | ^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `s.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: manual case-insensitive ASCII comparison [INFO] [stdout] --> src/valid_palindrome.rs:22:12 [INFO] [stdout] | [INFO] [stdout] 22 | if c1.to_ascii_lowercase() != c2.to_ascii_lowercase() { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_ignore_case_cmp [INFO] [stdout] = note: `#[warn(clippy::manual_ignore_case_cmp)]` on by default [INFO] [stdout] help: consider using `.eq_ignore_ascii_case()` instead [INFO] [stdout] | [INFO] [stdout] 22 - if c1.to_ascii_lowercase() != c2.to_ascii_lowercase() { [INFO] [stdout] 22 + if !c1.eq_ignore_ascii_case(&c2) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` has identical blocks [INFO] [stdout] --> src/valid_parentheses.rs:16:44 [INFO] [stdout] | [INFO] [stdout] 16 | if top == '(' && ch == ')' { [INFO] [stdout] | ____________________________________________^ [INFO] [stdout] 17 | | stack.pop_back(); [INFO] [stdout] 18 | | } else if top == '[' && ch == ']' { [INFO] [stdout] | |_________________^ [INFO] [stdout] | [INFO] [stdout] note: same as this [INFO] [stdout] --> src/valid_parentheses.rs:18:51 [INFO] [stdout] | [INFO] [stdout] 18 | } else if top == '[' && ch == ']' { [INFO] [stdout] | ___________________________________________________^ [INFO] [stdout] 19 | | stack.pop_back(); [INFO] [stdout] 20 | | } else if top == '{' && ch == '}' { [INFO] [stdout] | |_________________^ [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#if_same_then_else [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` has identical blocks [INFO] [stdout] --> src/valid_parentheses.rs:18:51 [INFO] [stdout] | [INFO] [stdout] 18 | } else if top == '[' && ch == ']' { [INFO] [stdout] | ___________________________________________________^ [INFO] [stdout] 19 | | stack.pop_back(); [INFO] [stdout] 20 | | } else if top == '{' && ch == '}' { [INFO] [stdout] | |_________________^ [INFO] [stdout] | [INFO] [stdout] note: same as this [INFO] [stdout] --> src/valid_parentheses.rs:20:51 [INFO] [stdout] | [INFO] [stdout] 20 | } else if top == '{' && ch == '}' { [INFO] [stdout] | ___________________________________________________^ [INFO] [stdout] 21 | | stack.pop_back(); [INFO] [stdout] 22 | | } else { [INFO] [stdout] | |_________________^ [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#if_same_then_else [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: importing legacy numeric constants [INFO] [stdout] --> src/validate_binary_search_tree.rs:10:9 [INFO] [stdout] | [INFO] [stdout] 10 | use std::i32; [INFO] [stdout] | ^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: remove this import [INFO] [stdout] = note: then `i32::` will resolve to the respective associated constant [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#legacy_numeric_constants [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: usage of a legacy numeric method [INFO] [stdout] --> src/validate_binary_search_tree.rs:11:23 [INFO] [stdout] | [INFO] [stdout] 11 | let mut min_val = i32::min_value(); [INFO] [stdout] | ^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#legacy_numeric_constants [INFO] [stdout] help: use the associated constant instead [INFO] [stdout] | [INFO] [stdout] 11 - let mut min_val = i32::min_value(); [INFO] [stdout] 11 + let mut min_val = i32::MIN; [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/validate_binary_search_tree.rs:30:58 [INFO] [stdout] | [INFO] [stdout] 30 | if _is_valid_bst(node.borrow().left.clone(), &mut val) && *val < node.borrow().val { [INFO] [stdout] | ^^^^^^^^ help: change this to: `val` [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/validate_binary_search_tree.rs:32:60 [INFO] [stdout] | [INFO] [stdout] 32 | _is_valid_bst(node.borrow().right.clone(), &mut val) [INFO] [stdout] | ^^^^^^^^ help: change this to: `val` [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: length comparison to zero [INFO] [stdout] --> src/validate_binary_search_tree.rs:42:8 [INFO] [stdout] | [INFO] [stdout] 42 | if vals.len() == 0 { [INFO] [stdout] | ^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `vals.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 expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/validate_binary_search_tree.rs:63:49 [INFO] [stdout] | [INFO] [stdout] 63 | inorder(node.borrow().left.clone(), &mut res); [INFO] [stdout] | ^^^^^^^^ help: change this to: `res` [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/validate_binary_search_tree.rs:65:50 [INFO] [stdout] | [INFO] [stdout] 65 | inorder(node.borrow().right.clone(), &mut res); [INFO] [stdout] | ^^^^^^^^ help: change this to: `res` [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 `repeat().take()` can be written more concisely [INFO] [stdout] --> src/vertical_order_traversal_of_a_binary_tree.rs:18:23 [INFO] [stdout] | [INFO] [stdout] 18 | let mut res = iter::repeat(vec![]) [INFO] [stdout] | _______________________^ [INFO] [stdout] 19 | | .take((right + 1 - left) as usize) [INFO] [stdout] | |______________________________________________^ help: consider using `repeat_n()` instead: `std::iter::repeat_n(vec![], (right + 1 - left) as usize)` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_repeat_n [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `i32` which implements the `Copy` trait [INFO] [stdout] --> src/vertical_order_traversal_of_a_binary_tree.rs:22:41 [INFO] [stdout] | [INFO] [stdout] 22 | preorder2(root, &mut res, 0, 0, left.clone()); [INFO] [stdout] | ^^^^^^^^^^^^ help: try removing the `clone` call: `left` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: parameter is only used in recursion [INFO] [stdout] --> src/vertical_order_traversal_of_a_binary_tree.rs:31:5 [INFO] [stdout] | [INFO] [stdout] 31 | y: i32, [INFO] [stdout] | ^ help: if this is intentional, prefix it with an underscore: `_y` [INFO] [stdout] | [INFO] [stdout] note: parameter used here [INFO] [stdout] --> src/vertical_order_traversal_of_a_binary_tree.rs:40:57 [INFO] [stdout] | [INFO] [stdout] 40 | preorder(node.borrow().left.clone(), x - 1, y - 1, left, right); [INFO] [stdout] | ^ [INFO] [stdout] 41 | preorder(node.borrow().right.clone(), x + 1, y - 1, left, right); [INFO] [stdout] | ^ [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#only_used_in_recursion [INFO] [stdout] = note: `#[warn(clippy::only_used_in_recursion)]` 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/vertical_order_traversal_of_a_binary_tree.rs:57:51 [INFO] [stdout] | [INFO] [stdout] 57 | preorder2(node.borrow().left.clone(), &mut res, x - 1, y - 1, left); [INFO] [stdout] | ^^^^^^^^ help: change this to: `res` [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/vertical_order_traversal_of_a_binary_tree.rs:58:52 [INFO] [stdout] | [INFO] [stdout] 58 | preorder2(node.borrow().right.clone(), &mut res, x + 1, y - 1, left); [INFO] [stdout] | ^^^^^^^^ help: change this to: `res` [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: parameter is only used in recursion [INFO] [stdout] --> src/vertical_order_traversal_of_a_binary_tree.rs:50:5 [INFO] [stdout] | [INFO] [stdout] 50 | y: i32, [INFO] [stdout] | ^ help: if this is intentional, prefix it with an underscore: `_y` [INFO] [stdout] | [INFO] [stdout] note: parameter used here [INFO] [stdout] --> src/vertical_order_traversal_of_a_binary_tree.rs:57:68 [INFO] [stdout] | [INFO] [stdout] 57 | preorder2(node.borrow().left.clone(), &mut res, x - 1, y - 1, left); [INFO] [stdout] | ^ [INFO] [stdout] 58 | preorder2(node.borrow().right.clone(), &mut res, x + 1, y - 1, left); [INFO] [stdout] | ^ [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#only_used_in_recursion [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: casting to the same type is unnecessary (`usize` -> `usize`) [INFO] [stdout] --> src/zigzag_conversion.rs:11:54 [INFO] [stdout] | [INFO] [stdout] 11 | let mut mat: Vec> = Vec::with_capacity(num_rows as usize); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^ help: try: `num_rows` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `repeat().take()` can be written more concisely [INFO] [stdout] --> src/zigzag_conversion.rs:13:18 [INFO] [stdout] | [INFO] [stdout] 13 | mat.push(iter::repeat('\0').take(s.len()).collect::>()); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `repeat_n()` instead: `std::iter::repeat_n('\0', s.len())` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_repeat_n [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the variable `char_i` is used as a loop counter [INFO] [stdout] --> src/zigzag_conversion.rs:19:5 [INFO] [stdout] | [INFO] [stdout] 19 | for i in (0..num_rows).chain((1..num_rows - 1).rev()).cycle() { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `for (char_i, i) in (0..num_rows).chain((1..num_rows - 1).rev()).cycle().enumerate()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_counter_loop [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the variable `count` is used as a loop counter [INFO] [stdout] --> src/first_unique_character_in_a_string.rs:22:5 [INFO] [stdout] | [INFO] [stdout] 22 | for ch in s { [INFO] [stdout] | ^^^^^^^^^^^ help: consider using: `for (count, ch) in s.into_iter().enumerate()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_counter_loop [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/add_two_numbers.rs:17:9 [INFO] [stdout] | [INFO] [stdout] 17 | / match l1 { [INFO] [stdout] 18 | | Some(ref node) => { [INFO] [stdout] 19 | | sum += node.val; [INFO] [stdout] 20 | | l1 = l1.unwrap().next.as_ref(); [INFO] [stdout] ... | [INFO] [stdout] 24 | | None => {} [INFO] [stdout] 25 | | } [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] 17 ~ if let Some(ref node) = l1 { [INFO] [stdout] 18 + sum += node.val; [INFO] [stdout] 19 + l1 = l1.unwrap().next.as_ref(); [INFO] [stdout] 20 + // or [INFO] [stdout] 21 + // l1 = l1.map(|n| n.next.as_ref()).unwrap_or(None); [INFO] [stdout] 22 + } [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/add_two_numbers.rs:27:9 [INFO] [stdout] | [INFO] [stdout] 27 | / match l2 { [INFO] [stdout] 28 | | Some(ref node) => { [INFO] [stdout] 29 | | sum += node.val; [INFO] [stdout] 30 | | l2 = l2.unwrap().next.as_ref(); [INFO] [stdout] 31 | | } [INFO] [stdout] 32 | | None => {} [INFO] [stdout] 33 | | } [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] 27 ~ if let Some(ref node) = l2 { [INFO] [stdout] 28 + sum += node.val; [INFO] [stdout] 29 + l2 = l2.unwrap().next.as_ref(); [INFO] [stdout] 30 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this pattern creates a reference to a reference [INFO] [stdout] --> src/add_two_numbers.rs:18:18 [INFO] [stdout] | [INFO] [stdout] 18 | Some(ref node) => { [INFO] [stdout] | ^^^^^^^^ [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] help: try [INFO] [stdout] | [INFO] [stdout] 18 - Some(ref node) => { [INFO] [stdout] 18 + Some(node) => { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this pattern creates a reference to a reference [INFO] [stdout] --> src/add_two_numbers.rs:28:18 [INFO] [stdout] | [INFO] [stdout] 28 | Some(ref node) => { [INFO] [stdout] | ^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 28 - Some(ref node) => { [INFO] [stdout] 28 + Some(node) => { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is only used to index `rest_vec` [INFO] [stdout] --> src/add_two_numbers.rs:72:14 [INFO] [stdout] | [INFO] [stdout] 72 | for i in min_len..max_len { [INFO] [stdout] | ^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] = note: `#[warn(clippy::needless_range_loop)]` on by default [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 72 - for i in min_len..max_len { [INFO] [stdout] 72 + for in rest_vec.iter().take(max_len).skip(min_len) { [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/add_two_numbers.rs:100:9 [INFO] [stdout] | [INFO] [stdout] 100 | / match list { [INFO] [stdout] 101 | | Some(ref node) => nums.push(node.val), [INFO] [stdout] 102 | | None => {} [INFO] [stdout] 103 | | }; [INFO] [stdout] | |_________^ help: try: `if let Some(ref node) = list { nums.push(node.val) }` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/binary_tree_inorder_traversal.rs:18:49 [INFO] [stdout] | [INFO] [stdout] 18 | inorder(node.borrow().left.clone(), &mut res); [INFO] [stdout] | ^^^^^^^^ help: change this to: `res` [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/binary_tree_inorder_traversal.rs:20:50 [INFO] [stdout] | [INFO] [stdout] 20 | inorder(node.borrow().right.clone(), &mut res); [INFO] [stdout] | ^^^^^^^^ help: change this to: `res` [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: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` [INFO] [stdout] --> src/binary_tree_level_order_traversal.rs:19:9 [INFO] [stdout] | [INFO] [stdout] 19 | / match cur { [INFO] [stdout] 20 | | Some(node) => { [INFO] [stdout] 21 | | if depth >= res.len() { [INFO] [stdout] 22 | | res.push(vec![]); [INFO] [stdout] ... | [INFO] [stdout] 28 | | _ => {} [INFO] [stdout] 29 | | } [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] 19 ~ if let Some(node) = cur { [INFO] [stdout] 20 + if depth >= res.len() { [INFO] [stdout] 21 + res.push(vec![]); [INFO] [stdout] 22 + } [INFO] [stdout] 23 + res[depth].push(node.borrow().val); [INFO] [stdout] 24 + q.push_back((node.borrow().left.clone(), depth + 1)); [INFO] [stdout] 25 + q.push_back((node.borrow().right.clone(), depth + 1)); [INFO] [stdout] 26 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/binary_tree_postorder_traversal.rs:18:51 [INFO] [stdout] | [INFO] [stdout] 18 | postorder(node.borrow().left.clone(), &mut res); [INFO] [stdout] | ^^^^^^^^ help: change this to: `res` [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/binary_tree_postorder_traversal.rs:19:52 [INFO] [stdout] | [INFO] [stdout] 19 | postorder(node.borrow().right.clone(), &mut res); [INFO] [stdout] | ^^^^^^^^ help: change this to: `res` [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/binary_tree_preorder_traversal.rs:19:50 [INFO] [stdout] | [INFO] [stdout] 19 | preorder(node.borrow().left.clone(), &mut res); [INFO] [stdout] | ^^^^^^^^ help: change this to: `res` [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/binary_tree_preorder_traversal.rs:20:51 [INFO] [stdout] | [INFO] [stdout] 20 | preorder(node.borrow().right.clone(), &mut res); [INFO] [stdout] | ^^^^^^^^ help: change this to: `res` [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: equality checks against false can be replaced by a negation [INFO] [stdout] --> src/contains_duplicate.rs:8:12 [INFO] [stdout] | [INFO] [stdout] 8 | if set.insert(num) == false { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `!set.insert(num)` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bool_comparison [INFO] [stdout] = note: `#[warn(clippy::bool_comparison)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/contains_duplicate.rs:21:9 [INFO] [stdout] | [INFO] [stdout] 21 | assert_eq!(contains_duplicate(vec![1, 2, 3, 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] = note: `#[warn(clippy::bool_assert_comparison)]` on by default [INFO] [stdout] help: replace it with `assert!(..)` [INFO] [stdout] | [INFO] [stdout] 21 - assert_eq!(contains_duplicate(vec![1, 2, 3, 1]), true); [INFO] [stdout] 21 + assert!(contains_duplicate(vec![1, 2, 3, 1])); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/contains_duplicate_2.rs:53:9 [INFO] [stdout] | [INFO] [stdout] 53 | assert_eq!(contains_nearby_duplicate(vec![1, 2, 3, 1, 2, 3], 2), 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] 53 - assert_eq!(contains_nearby_duplicate(vec![1, 2, 3, 1, 2, 3], 2), false); [INFO] [stdout] 53 + assert!(!contains_nearby_duplicate(vec![1, 2, 3, 1, 2, 3], 2)); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/contains_duplicate_2.rs:54:9 [INFO] [stdout] | [INFO] [stdout] 54 | assert_eq!(contains_nearby_duplicate(vec![1, 0, 1, 1], 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] 54 - assert_eq!(contains_nearby_duplicate(vec![1, 0, 1, 1], 1), true); [INFO] [stdout] 54 + assert!(contains_nearby_duplicate(vec![1, 0, 1, 1], 1)); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/contains_duplicate_2.rs:59:9 [INFO] [stdout] | [INFO] [stdout] 59 | assert_eq!(contains_nearby_duplicate2(vec![1, 2, 3, 1, 2, 3], 2), 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] 59 - assert_eq!(contains_nearby_duplicate2(vec![1, 2, 3, 1, 2, 3], 2), false); [INFO] [stdout] 59 + assert!(!contains_nearby_duplicate2(vec![1, 2, 3, 1, 2, 3], 2)); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/contains_duplicate_2.rs:60:9 [INFO] [stdout] | [INFO] [stdout] 60 | assert_eq!(contains_nearby_duplicate2(vec![1, 0, 1, 1], 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] 60 - assert_eq!(contains_nearby_duplicate2(vec![1, 0, 1, 1], 1), true); [INFO] [stdout] 60 + assert!(contains_nearby_duplicate2(vec![1, 0, 1, 1], 1)); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/contains_duplicate_3.rs:57:9 [INFO] [stdout] | [INFO] [stdout] 57 | / assert_eq!( [INFO] [stdout] 58 | | contains_nearby_almost_duplicate(vec![1, 2, 3, 1], 3, 0), [INFO] [stdout] 59 | | true [INFO] [stdout] 60 | | ); [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] 57 ~ assert!( [INFO] [stdout] 58 ~ contains_nearby_almost_duplicate(vec![1, 2, 3, 1], 3, 0) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/contains_duplicate_3.rs:61:9 [INFO] [stdout] | [INFO] [stdout] 61 | / assert_eq!( [INFO] [stdout] 62 | | contains_nearby_almost_duplicate(vec![1, 0, 1, 1], 1, 2), [INFO] [stdout] 63 | | true [INFO] [stdout] 64 | | ); [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] 61 ~ assert!( [INFO] [stdout] 62 ~ contains_nearby_almost_duplicate(vec![1, 0, 1, 1], 1, 2) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/contains_duplicate_3.rs:65:9 [INFO] [stdout] | [INFO] [stdout] 65 | / assert_eq!( [INFO] [stdout] 66 | | contains_nearby_almost_duplicate(vec![1, 5, 9, 1, 5, 9], 2, 3), [INFO] [stdout] 67 | | false [INFO] [stdout] 68 | | ); [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] 65 ~ assert!( [INFO] [stdout] 66 ~ !contains_nearby_almost_duplicate(vec![1, 5, 9, 1, 5, 9], 2, 3) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/contains_duplicate_3.rs:69:9 [INFO] [stdout] | [INFO] [stdout] 69 | / assert_eq!( [INFO] [stdout] 70 | | contains_nearby_almost_duplicate(vec![-1, 2147483647], 1, 2147483647), [INFO] [stdout] 71 | | false [INFO] [stdout] 72 | | ); [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] 69 ~ assert!( [INFO] [stdout] 70 ~ !contains_nearby_almost_duplicate(vec![-1, 2147483647], 1, 2147483647) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/contains_duplicate_3.rs:74:9 [INFO] [stdout] | [INFO] [stdout] 74 | assert_eq!(contains_nearby_almost_duplicate(vec![2, 2], 3, 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] 74 - assert_eq!(contains_nearby_almost_duplicate(vec![2, 2], 3, 0), true); [INFO] [stdout] 74 + assert!(contains_nearby_almost_duplicate(vec![2, 2], 3, 0)); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: slow zero-filling initialization [INFO] [stdout] --> src/daily_temperatures.rs:5:19 [INFO] [stdout] | [INFO] [stdout] 5 | let mut res = vec![]; [INFO] [stdout] | ___________________^ [INFO] [stdout] 6 | | res.resize(t.len(), 0); [INFO] [stdout] | |__________________________^ help: consider replacing this with: `vec![0; t.len()]` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#slow_vector_initialization [INFO] [stdout] = note: `#[warn(clippy::slow_vector_initialization)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the variable `count` is used as a loop counter [INFO] [stdout] --> src/daily_temperatures.rs:9:5 [INFO] [stdout] | [INFO] [stdout] 9 | for i in 0..t.len() { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^ help: consider using: `for (count, i) in (0..t.len()).enumerate()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_counter_loop [INFO] [stdout] = note: `#[warn(clippy::explicit_counter_loop)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `repeat().take()` can be written more concisely [INFO] [stdout] --> src/design_circular_queue.rs:19:17 [INFO] [stdout] | [INFO] [stdout] 19 | let q = iter::repeat(0).take(size.clone()).collect::>(); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `repeat_n()` instead: `std::iter::repeat_n(0, size.clone())` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_repeat_n [INFO] [stdout] = note: `#[warn(clippy::manual_repeat_n)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `usize` which implements the `Copy` trait [INFO] [stdout] --> src/design_circular_queue.rs:19:38 [INFO] [stdout] | [INFO] [stdout] 19 | let q = iter::repeat(0).take(size.clone()).collect::>(); [INFO] [stdout] | ^^^^^^^^^^^^ help: try removing the `clone` call: `size` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] = note: `#[warn(clippy::clone_on_copy)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `repeat().take()` can be written more concisely [INFO] [stdout] --> src/design_hashmap.rs:17:22 [INFO] [stdout] | [INFO] [stdout] 17 | let bucket = iter::repeat(LinkedList::new()) [INFO] [stdout] | ______________________^ [INFO] [stdout] 18 | | .take(len as usize) [INFO] [stdout] | |_______________________________^ help: consider using `repeat_n()` instead: `std::iter::repeat_n(LinkedList::new(), len as usize)` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_repeat_n [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: deref which would be done by auto-deref [INFO] [stdout] --> src/design_hashmap.rs:27:17 [INFO] [stdout] | [INFO] [stdout] 27 | (*pair).1 = value; [INFO] [stdout] | ^^^^^^^ help: try: `pair` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref [INFO] [stdout] = note: `#[warn(clippy::explicit_auto_deref)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: deref which would be done by auto-deref [INFO] [stdout] --> src/design_hashmap.rs:40:27 [INFO] [stdout] | [INFO] [stdout] 40 | Some(pair) => (*pair).1, [INFO] [stdout] | ^^^^^^^ help: try: `pair` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: deref which would be done by auto-deref [INFO] [stdout] --> src/design_hashmap.rs:51:17 [INFO] [stdout] | [INFO] [stdout] 51 | (*val).1 = -1; [INFO] [stdout] | ^^^^^^ help: try: `val` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant pattern matching, consider using `is_some()` [INFO] [stdout] --> src/design_hashmap.rs:58:9 [INFO] [stdout] | [INFO] [stdout] 58 | / match self._find(key) { [INFO] [stdout] 59 | | Some(_) => true, [INFO] [stdout] 60 | | None => false, [INFO] [stdout] 61 | | } [INFO] [stdout] | |_________^ help: try: `self._find(key).is_some()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pattern_matching [INFO] [stdout] = note: `#[warn(clippy::redundant_pattern_matching)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of `Iterator::find` [INFO] [stdout] --> src/design_hashmap.rs:68:9 [INFO] [stdout] | [INFO] [stdout] 68 | / for val in list.iter_mut() { [INFO] [stdout] 69 | | if (*val).0 == key { [INFO] [stdout] 70 | | return Some(val); [INFO] [stdout] ... | [INFO] [stdout] 74 | | None [INFO] [stdout] | |____________^ help: replace with an iterator: `list.iter_mut().find(|val| (*val).0 == key).map(|v| v as _)` [INFO] [stdout] | [INFO] [stdout] = note: you may need to dereference some variables [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_find [INFO] [stdout] = note: `#[warn(clippy::manual_find)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: deref which would be done by auto-deref [INFO] [stdout] --> src/design_hashmap.rs:69:16 [INFO] [stdout] | [INFO] [stdout] 69 | if (*val).0 == key { [INFO] [stdout] | ^^^^^^ help: try: `val` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you should consider adding a `Default` implementation for `MyHashSet` [INFO] [stdout] --> src/design_hashset.rs:15:5 [INFO] [stdout] | [INFO] [stdout] 15 | / pub fn new() -> Self { [INFO] [stdout] 16 | | let len: i32 = 2047; [INFO] [stdout] 17 | | let bucket = iter::repeat(LinkedList::new()) [INFO] [stdout] 18 | | .take(len as usize) [INFO] [stdout] 19 | | .collect::>>(); [INFO] [stdout] 20 | | Self { bucket, len } [INFO] [stdout] 21 | | } [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default [INFO] [stdout] = note: `#[warn(clippy::new_without_default)]` on by default [INFO] [stdout] help: try adding this [INFO] [stdout] | [INFO] [stdout] 13 + impl Default for MyHashSet { [INFO] [stdout] 14 + fn default() -> Self { [INFO] [stdout] 15 + Self::new() [INFO] [stdout] 16 + } [INFO] [stdout] 17 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `repeat().take()` can be written more concisely [INFO] [stdout] --> src/design_hashset.rs:17:22 [INFO] [stdout] | [INFO] [stdout] 17 | let bucket = iter::repeat(LinkedList::new()) [INFO] [stdout] | ______________________^ [INFO] [stdout] 18 | | .take(len as usize) [INFO] [stdout] | |_______________________________^ help: consider using `repeat_n()` instead: `std::iter::repeat_n(LinkedList::new(), len as usize)` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_repeat_n [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/design_hashset.rs:25:13 [INFO] [stdout] | [INFO] [stdout] 25 | 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] = note: `#[warn(clippy::needless_return)]` on by default [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 24 - if self.contains(key) { [INFO] [stdout] 25 - return; [INFO] [stdout] 24 + if self.contains(key) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant pattern matching, consider using `is_some()` [INFO] [stdout] --> src/design_hashset.rs:44:9 [INFO] [stdout] | [INFO] [stdout] 44 | / match self._find(key) { [INFO] [stdout] 45 | | Some(_) => true, [INFO] [stdout] 46 | | None => false, [INFO] [stdout] 47 | | } [INFO] [stdout] | |_________^ help: try: `self._find(key).is_some()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pattern_matching [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of `Iterator::find` [INFO] [stdout] --> src/design_hashset.rs:54:9 [INFO] [stdout] | [INFO] [stdout] 54 | / for val in list.iter_mut() { [INFO] [stdout] 55 | | if *val == key { [INFO] [stdout] 56 | | return Some(val); [INFO] [stdout] ... | [INFO] [stdout] 60 | | None [INFO] [stdout] | |____________^ help: replace with an iterator: `list.iter_mut().find(|val| *val == key).map(|v| v as _)` [INFO] [stdout] | [INFO] [stdout] = note: you may need to dereference some variables [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_find [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/design_hashset.rs:80:9 [INFO] [stdout] | [INFO] [stdout] 80 | assert_eq!(ret, 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] 80 - assert_eq!(ret, false); [INFO] [stdout] 80 + assert!(!ret); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/diagonal_traverse.rs:8:5 [INFO] [stdout] | [INFO] [stdout] 8 | /// and let up = !up [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] = note: `#[warn(clippy::doc_lazy_continuation)]` on by default [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 8 | /// and let up = !up [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: doc list item without indentation [INFO] [stdout] --> src/diagonal_traverse.rs:9:5 [INFO] [stdout] | [INFO] [stdout] 9 | /// otherwise go up and right or go down and left. [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = help: if this is supposed to be its own paragraph, add a blank line [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation [INFO] [stdout] help: indent this line [INFO] [stdout] | [INFO] [stdout] 9 | /// otherwise go up and right or go down and left. [INFO] [stdout] | +++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manually reimplementing `div_ceil` [INFO] [stdout] --> src/find_median_sorted_arrays.rs:19:16 [INFO] [stdout] | [INFO] [stdout] 19 | let half = (m + n + 1) / 2; [INFO] [stdout] | ^^^^^^^^^^^^^^^ help: consider using `.div_ceil()`: `(m + 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: unneeded `return` statement [INFO] [stdout] --> src/find_peak_element.rs:30:5 [INFO] [stdout] | [INFO] [stdout] 30 | return left as i32; [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] 30 - return left as i32; [INFO] [stdout] 30 + left as i32 [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` has identical blocks [INFO] [stdout] --> src/find_peak_element.rs:21:49 [INFO] [stdout] | [INFO] [stdout] 21 | } else if mid == 0 && nums[0] > nums[1] { [INFO] [stdout] | _________________________________________________^ [INFO] [stdout] 22 | | return mid as i32; [INFO] [stdout] 23 | | } else if mid == nums.len() - 1 && nums[mid - 1] < nums[mid] { [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] note: same as this [INFO] [stdout] --> src/find_peak_element.rs:23:70 [INFO] [stdout] | [INFO] [stdout] 23 | } else if mid == nums.len() - 1 && nums[mid - 1] < nums[mid] { [INFO] [stdout] | ______________________________________________________________________^ [INFO] [stdout] 24 | | return mid as i32; [INFO] [stdout] 25 | | } else { [INFO] [stdout] | |_________^ [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#if_same_then_else [INFO] [stdout] = note: `#[warn(clippy::if_same_then_else)]` on by default [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/four_sum_2.rs:27:13 [INFO] [stdout] | [INFO] [stdout] 27 | / match sums.get(&sum) { [INFO] [stdout] 28 | | Some(x) => { [INFO] [stdout] 29 | | count += *x; [INFO] [stdout] ... | [INFO] [stdout] 32 | | } [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] 27 ~ if let Some(x) = sums.get(&sum) { [INFO] [stdout] 28 + count += *x; [INFO] [stdout] 29 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you seem to be trying to use `match` for an equality check. Consider using `if` [INFO] [stdout] --> src/group_anagrams.rs:20:9 [INFO] [stdout] | [INFO] [stdout] 20 | / match map.get(&temp) { [INFO] [stdout] 21 | | None => { [INFO] [stdout] 22 | | res.push(vec![]); [INFO] [stdout] 23 | | map.insert(temp.clone(), res.len() - 1); [INFO] [stdout] 24 | | } [INFO] [stdout] 25 | | Some(_) => {} [INFO] [stdout] 26 | | } [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] 20 ~ if map.get(&temp) == None { [INFO] [stdout] 21 + res.push(vec![]); [INFO] [stdout] 22 + map.insert(temp.clone(), res.len() - 1); [INFO] [stdout] 23 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/happy_number.rs:49:9 [INFO] [stdout] | [INFO] [stdout] 49 | assert_eq!(is_happy(19), 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] 49 - assert_eq!(is_happy(19), true); [INFO] [stdout] 49 + assert!(is_happy(19)); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/happy_number.rs:50:9 [INFO] [stdout] | [INFO] [stdout] 50 | assert_eq!(is_happy(14), 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] 50 - assert_eq!(is_happy(14), false); [INFO] [stdout] 50 + assert!(!is_happy(14)); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/happy_number.rs:55:9 [INFO] [stdout] | [INFO] [stdout] 55 | assert_eq!(is_happy2(19), 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] 55 - assert_eq!(is_happy2(19), true); [INFO] [stdout] 55 + assert!(is_happy2(19)); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/happy_number.rs:56:9 [INFO] [stdout] | [INFO] [stdout] 56 | assert_eq!(is_happy2(14), 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] 56 - assert_eq!(is_happy2(14), false); [INFO] [stdout] 56 + assert!(!is_happy2(14)); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is only used to index `a` [INFO] [stdout] --> src/internal_list_intersections.rs:18:14 [INFO] [stdout] | [INFO] [stdout] 18 | for i in 0..a.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] 18 - for i in 0..a.len() { [INFO] [stdout] 18 + for in &a { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `j` is only used to index `b` [INFO] [stdout] --> src/internal_list_intersections.rs:19:18 [INFO] [stdout] | [INFO] [stdout] 19 | for j in 0..b.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] 19 - for j in 0..b.len() { [INFO] [stdout] 19 + for in &b { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you are using an explicit closure for copying elements [INFO] [stdout] --> src/intersection_of_two_arrays.rs:16:5 [INFO] [stdout] | [INFO] [stdout] 16 | set1.intersection(&set2).map(|x| *x).collect() [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `copied` method: `set1.intersection(&set2).copied()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_clone [INFO] [stdout] = note: `#[warn(clippy::map_clone)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` can be collapsed into the outer `match` [INFO] [stdout] --> src/intersection_of_two_arrays_2.rs:25:17 [INFO] [stdout] | [INFO] [stdout] 25 | / if *v > 0 { [INFO] [stdout] 26 | | *v -= 1; [INFO] [stdout] 27 | | res.push(num); [INFO] [stdout] 28 | | } [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] 24 ~ Some(v) [INFO] [stdout] 25 ~ if *v > 0 => { [INFO] [stdout] 26 | *v -= 1; [INFO] [stdout] 27 | res.push(num); [INFO] [stdout] 28 ~ } [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/intersection_of_two_arrays_2.rs:23:9 [INFO] [stdout] | [INFO] [stdout] 23 | / match map.get_mut(&num) { [INFO] [stdout] 24 | | Some(v) => { [INFO] [stdout] 25 | | if *v > 0 { [INFO] [stdout] 26 | | *v -= 1; [INFO] [stdout] ... | [INFO] [stdout] 31 | | None => {} [INFO] [stdout] 32 | | } [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] 23 ~ if let Some(v) = map.get_mut(&num) { [INFO] [stdout] 24 + if *v > 0 { [INFO] [stdout] 25 + *v -= 1; [INFO] [stdout] 26 + res.push(num); [INFO] [stdout] 27 + } [INFO] [stdout] 28 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: usage of `contains_key` followed by `insert` on a `HashMap` [INFO] [stdout] --> src/isomorphic_strings.rs:14:9 [INFO] [stdout] | [INFO] [stdout] 14 | / if map.contains_key(&c1) { [INFO] [stdout] 15 | | let v = map.get_mut(&c1).unwrap(); [INFO] [stdout] 16 | | if *v != c2 { [INFO] [stdout] 17 | | return false; [INFO] [stdout] ... | [INFO] [stdout] 22 | | map.insert(c1, c2); [INFO] [stdout] 23 | | } [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_entry [INFO] [stdout] = note: `#[warn(clippy::map_entry)]` on by default [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 14 ~ if let std::collections::hash_map::Entry::Vacant(e) = map.entry(c1) if map2.contains_key(&c2) { [INFO] [stdout] 15 + return false; [INFO] [stdout] 16 + } else { [INFO] [stdout] 17 + e.insert(c2); [INFO] [stdout] 18 + } else { [INFO] [stdout] 19 + let v = map.get_mut(&c1).unwrap(); [INFO] [stdout] 20 + if *v != c2 { [INFO] [stdout] 21 + return false; [INFO] [stdout] 22 + } [INFO] [stdout] 23 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/isomorphic_strings.rs:35:9 [INFO] [stdout] | [INFO] [stdout] 35 | / assert_eq!( [INFO] [stdout] 36 | | is_isomorphic(String::from("egg"), String::from("add")), [INFO] [stdout] 37 | | true [INFO] [stdout] 38 | | ); [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] 35 ~ assert!( [INFO] [stdout] 36 ~ is_isomorphic(String::from("egg"), String::from("add")) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/isomorphic_strings.rs:39:9 [INFO] [stdout] | [INFO] [stdout] 39 | assert_eq!(is_isomorphic(String::from("ab"), String::from("aa")), 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] 39 - assert_eq!(is_isomorphic(String::from("ab"), String::from("aa")), false); [INFO] [stdout] 39 + assert!(!is_isomorphic(String::from("ab"), String::from("aa"))); [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/kth_largest_element_in_an_array.rs:21:20 [INFO] [stdout] | [INFO] [stdout] 21 | fn partition(nums: &mut Vec, left: i32, right: 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] = note: `#[warn(clippy::ptr_arg)]` on by default [INFO] [stdout] help: change this to [INFO] [stdout] | [INFO] [stdout] 21 - fn partition(nums: &mut Vec, left: i32, right: i32) -> i32 { [INFO] [stdout] 21 + fn partition(nums: &mut [i32], left: i32, right: i32) -> i32 { [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/kth_largest_element_in_an_array.rs:41:21 [INFO] [stdout] | [INFO] [stdout] 41 | fn partition2(nums: &mut Vec, left: i32, right: 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] 41 - fn partition2(nums: &mut Vec, left: i32, right: i32) -> i32 { [INFO] [stdout] 41 + fn partition2(nums: &mut [i32], left: i32, right: i32) -> i32 { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: casting to the same type is unnecessary (`usize` -> `usize`) [INFO] [stdout] --> src/kth_largest_element_in_an_array.rs:45:15 [INFO] [stdout] | [INFO] [stdout] 45 | nums.swap(left as usize, right as usize); [INFO] [stdout] | ^^^^^^^^^^^^^ help: try: `left` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast [INFO] [stdout] = note: `#[warn(clippy::unnecessary_cast)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: casting to the same type is unnecessary (`usize` -> `usize`) [INFO] [stdout] --> src/kth_largest_element_in_an_array.rs:45:30 [INFO] [stdout] | [INFO] [stdout] 45 | nums.swap(left as usize, right as usize); [INFO] [stdout] | ^^^^^^^^^^^^^^ help: try: `right` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: length comparison to zero [INFO] [stdout] --> src/largest_number_at_least_twice_of_others.rs:4:8 [INFO] [stdout] | [INFO] [stdout] 4 | if nums.len() == 0 { [INFO] [stdout] | ^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `nums.is_empty()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero [INFO] [stdout] = note: `#[warn(clippy::len_zero)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: length comparison to zero [INFO] [stdout] --> src/longest_common_prefix.rs:6:8 [INFO] [stdout] | [INFO] [stdout] 6 | if strs.len() == 0 { [INFO] [stdout] | ^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `strs.is_empty()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded late initialization [INFO] [stdout] --> src/longest_common_prefix.rs:14:9 [INFO] [stdout] | [INFO] [stdout] 14 | let cur_ch: char; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_late_init [INFO] [stdout] = note: `#[warn(clippy::needless_late_init)]` on by default [INFO] [stdout] help: move the declaration `cur_ch` here and remove the assignments from the `match` arms [INFO] [stdout] | [INFO] [stdout] 14 ~ [INFO] [stdout] 15 ~ let cur_ch: char = match strs[0].chars().nth(k) { [INFO] [stdout] 16 | None => { [INFO] [stdout] ... [INFO] [stdout] 19 | Some(ch) => { [INFO] [stdout] 20 ~ ch [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is only used to index `strs` [INFO] [stdout] --> src/longest_common_prefix.rs:24:18 [INFO] [stdout] | [INFO] [stdout] 24 | for i in 1..strs.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] 24 - for i in 1..strs.len() { [INFO] [stdout] 24 + for in strs.iter().skip(1) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `repeat().take()` can be written more concisely [INFO] [stdout] --> src/longest_palindrome.rs:12:17 [INFO] [stdout] | [INFO] [stdout] 12 | dp.push(iter::repeat(true).take(s.len()).collect()) [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `repeat_n()` instead: `std::iter::repeat_n(true, s.len())` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_repeat_n [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/merge_sorted_array.rs:3:21 [INFO] [stdout] | [INFO] [stdout] 3 | pub fn merge(nums1: &mut Vec, m: i32, nums2: &mut 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] 3 - pub fn merge(nums1: &mut Vec, m: i32, nums2: &mut Vec, n: i32) { [INFO] [stdout] 3 + pub fn merge(nums1: &mut [i32], m: i32, nums2: &mut Vec, n: i32) { [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/merge_sorted_array.rs:3:51 [INFO] [stdout] | [INFO] [stdout] 3 | pub fn merge(nums1: &mut Vec, m: i32, nums2: &mut 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] 3 - pub fn merge(nums1: &mut Vec, m: i32, nums2: &mut Vec, n: i32) { [INFO] [stdout] 3 + pub fn merge(nums1: &mut Vec, m: i32, nums2: &mut [i32], n: i32) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this boolean expression can be simplified [INFO] [stdout] --> src/merge_sorted_array.rs:64:12 [INFO] [stdout] | [INFO] [stdout] 64 | if (j < 0 && i >= 0) || (i >= 0 && nums1[i as usize] > nums2[j as usize]) { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#nonminimal_bool [INFO] [stdout] = note: `#[warn(clippy::nonminimal_bool)]` on by default [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 64 - if (j < 0 && i >= 0) || (i >= 0 && nums1[i as usize] > nums2[j as usize]) { [INFO] [stdout] 64 + if !(i < 0 || j >= 0 && nums1[i as usize] <= nums2[j as usize]) { [INFO] [stdout] | [INFO] [stdout] 64 - if (j < 0 && i >= 0) || (i >= 0 && nums1[i as usize] > nums2[j as usize]) { [INFO] [stdout] 64 + if (nums1[i as usize] > nums2[j as usize] || j < 0) && i >= 0 { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this boolean expression can be simplified [INFO] [stdout] --> src/merge_sorted_array.rs:68:19 [INFO] [stdout] | [INFO] [stdout] 68 | } else if (i < 0 && j >= 0) || (j >= 0 && nums1[i as usize] <= nums2[j as usize]) { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#nonminimal_bool [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 68 - } else if (i < 0 && j >= 0) || (j >= 0 && nums1[i as usize] <= nums2[j as usize]) { [INFO] [stdout] 68 + } else if !(j < 0 || i >= 0 && nums1[i as usize] > nums2[j as usize]) { [INFO] [stdout] | [INFO] [stdout] 68 - } else if (i < 0 && j >= 0) || (j >= 0 && nums1[i as usize] <= nums2[j as usize]) { [INFO] [stdout] 68 + } else if (nums1[i as usize] <= nums2[j as usize] || i < 0) && j >= 0 { [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/merge_sorted_array.rs:49:22 [INFO] [stdout] | [INFO] [stdout] 49 | pub fn merge2(nums1: &mut Vec, m: i32, nums2: &mut 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] 49 - pub fn merge2(nums1: &mut Vec, m: i32, nums2: &mut Vec, n: i32) { [INFO] [stdout] 49 + pub fn merge2(nums1: &mut [i32], m: i32, nums2: &mut Vec, n: i32) { [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/merge_sorted_array.rs:49:52 [INFO] [stdout] | [INFO] [stdout] 49 | pub fn merge2(nums1: &mut Vec, m: i32, nums2: &mut 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] 49 - pub fn merge2(nums1: &mut Vec, m: i32, nums2: &mut Vec, n: i32) { [INFO] [stdout] 49 + pub fn merge2(nums1: &mut Vec, m: i32, nums2: &mut [i32], n: i32) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you should consider adding a `Default` implementation for `MinStack` [INFO] [stdout] --> src/min_stack.rs:15:5 [INFO] [stdout] | [INFO] [stdout] 15 | / pub fn new() -> Self { [INFO] [stdout] 16 | | Self { top: None } [INFO] [stdout] 17 | | } [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default [INFO] [stdout] help: try adding this [INFO] [stdout] | [INFO] [stdout] 14 + impl Default for MinStack { [INFO] [stdout] 15 + fn default() -> Self { [INFO] [stdout] 16 + Self::new() [INFO] [stdout] 17 + } [INFO] [stdout] 18 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant pattern matching, consider using `is_none()` [INFO] [stdout] --> src/min_stack.rs:20:9 [INFO] [stdout] | [INFO] [stdout] 20 | / match &self.top { [INFO] [stdout] 21 | | None => true, [INFO] [stdout] 22 | | Some(_) => false, [INFO] [stdout] 23 | | } [INFO] [stdout] | |_________^ help: try: `self.top.is_none()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pattern_matching [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/min_stack.rs:61:9 [INFO] [stdout] | [INFO] [stdout] 61 | / match node { [INFO] [stdout] 62 | | Some(mut x) => self.top = x.next.take(), [INFO] [stdout] 63 | | None => {} [INFO] [stdout] 64 | | }; [INFO] [stdout] | |_________^ help: try: `if let Some(mut x) = node { self.top = x.next.take() }` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match [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/minimum_index_sum_of_two_lists.rs:13:9 [INFO] [stdout] | [INFO] [stdout] 13 | / match map.get_mut(&x) { [INFO] [stdout] 14 | | Some(v) => { [INFO] [stdout] 15 | | if *v + i < min { [INFO] [stdout] 16 | | min = *v + i; [INFO] [stdout] ... | [INFO] [stdout] 23 | | None => {} [INFO] [stdout] 24 | | } [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] 13 ~ if let Some(v) = map.get_mut(&x) { [INFO] [stdout] 14 + if *v + i < min { [INFO] [stdout] 15 + min = *v + i; [INFO] [stdout] 16 + res.clear(); [INFO] [stdout] 17 + res.push(x); [INFO] [stdout] 18 + } else if *v + i == min { [INFO] [stdout] 19 + res.push(x); [INFO] [stdout] 20 + } [INFO] [stdout] 21 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: length comparison to one [INFO] [stdout] --> src/minimum_size_subarray_sum.rs:39:8 [INFO] [stdout] | [INFO] [stdout] 39 | if nums.len() < 1 { [INFO] [stdout] | ^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `nums.is_empty()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do [INFO] [stdout] --> src/move_zeroes.rs:3:26 [INFO] [stdout] | [INFO] [stdout] 3 | pub fn move_zeroes(nums: &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] help: change this to [INFO] [stdout] | [INFO] [stdout] 3 - pub fn move_zeroes(nums: &mut Vec) { [INFO] [stdout] 3 + pub fn move_zeroes(nums: &mut [i32]) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: length comparison to zero [INFO] [stdout] --> src/next_greater_element_1.rs:9:15 [INFO] [stdout] | [INFO] [stdout] 9 | while stack.len() != 0 && stack[stack.len() - 1] < num { [INFO] [stdout] | ^^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!stack.is_empty()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `repeat().take()` can be written more concisely [INFO] [stdout] --> src/number_of_islands.rs:8:22 [INFO] [stdout] | [INFO] [stdout] 8 | visited.push(iter::repeat(false).take(grid[0].len()).collect()); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `repeat_n()` instead: `std::iter::repeat_n(false, grid[0].len())` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_repeat_n [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/number_of_islands.rs:27:13 [INFO] [stdout] | [INFO] [stdout] 27 | dfs(&grid, &mut visited, i + 1, j); [INFO] [stdout] | ^^^^^ help: change this to: `grid` [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/number_of_islands.rs:27:20 [INFO] [stdout] | [INFO] [stdout] 27 | dfs(&grid, &mut visited, i + 1, j); [INFO] [stdout] | ^^^^^^^^^^^^ help: change this to: `visited` [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/number_of_islands.rs:30:13 [INFO] [stdout] | [INFO] [stdout] 30 | dfs(&grid, &mut visited, i - 1, j); [INFO] [stdout] | ^^^^^ help: change this to: `grid` [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/number_of_islands.rs:30:20 [INFO] [stdout] | [INFO] [stdout] 30 | dfs(&grid, &mut visited, i - 1, j); [INFO] [stdout] | ^^^^^^^^^^^^ help: change this to: `visited` [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/number_of_islands.rs:33:13 [INFO] [stdout] | [INFO] [stdout] 33 | dfs(&grid, &mut visited, i, j + 1); [INFO] [stdout] | ^^^^^ help: change this to: `grid` [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/number_of_islands.rs:33:20 [INFO] [stdout] | [INFO] [stdout] 33 | dfs(&grid, &mut visited, i, j + 1); [INFO] [stdout] | ^^^^^^^^^^^^ help: change this to: `visited` [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/number_of_islands.rs:36:13 [INFO] [stdout] | [INFO] [stdout] 36 | dfs(&grid, &mut visited, i, j - 1); [INFO] [stdout] | ^^^^^ help: change this to: `grid` [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/number_of_islands.rs:36:20 [INFO] [stdout] | [INFO] [stdout] 36 | dfs(&grid, &mut visited, i, j - 1); [INFO] [stdout] | ^^^^^^^^^^^^ help: change this to: `visited` [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 `repeat().take()` can be written more concisely [INFO] [stdout] --> src/number_of_islands.rs:45:22 [INFO] [stdout] | [INFO] [stdout] 45 | visited.push(iter::repeat(false).take(grid[0].len()).collect()); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `repeat_n()` instead: `std::iter::repeat_n(false, grid[0].len())` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_repeat_n [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do [INFO] [stdout] --> src/number_of_islands.rs:60:14 [INFO] [stdout] | [INFO] [stdout] 60 | fn bfs(grid: &Vec>, visited: &mut Vec>, i: usize, j: 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] 60 - fn bfs(grid: &Vec>, visited: &mut Vec>, i: usize, j: usize) { [INFO] [stdout] 60 + fn bfs(grid: &[Vec], visited: &mut Vec>, i: usize, j: usize) { [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/number_of_islands.rs:60:40 [INFO] [stdout] | [INFO] [stdout] 60 | fn bfs(grid: &Vec>, visited: &mut Vec>, i: usize, j: 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] 60 - fn bfs(grid: &Vec>, visited: &mut Vec>, i: usize, j: usize) { [INFO] [stdout] 60 + fn bfs(grid: &Vec>, visited: &mut [Vec], i: usize, j: usize) { [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/number_of_islands.rs:102:15 [INFO] [stdout] | [INFO] [stdout] 102 | fn bfs2(grid: &mut Vec>, i: usize, j: 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] 102 - fn bfs2(grid: &mut Vec>, i: usize, j: usize) { [INFO] [stdout] 102 + fn bfs2(grid: &mut [Vec], i: usize, j: usize) { [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/open_the_lock.rs:18:9 [INFO] [stdout] | [INFO] [stdout] 18 | / match dead_ends.get(&cur.0) { [INFO] [stdout] 19 | | Some(_) => { [INFO] [stdout] 20 | | continue; [INFO] [stdout] ... | [INFO] [stdout] 23 | | } [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] 18 ~ if let Some(_) = dead_ends.get(&cur.0) { [INFO] [stdout] 19 + continue; [INFO] [stdout] 20 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this if-then-else expression returns a bool literal [INFO] [stdout] --> src/palindrome_number.rs:17:5 [INFO] [stdout] | [INFO] [stdout] 17 | / if x == reversed_num || x == reversed_num / 10 { [INFO] [stdout] 18 | | true [INFO] [stdout] 19 | | } else { [INFO] [stdout] 20 | | false [INFO] [stdout] 21 | | } [INFO] [stdout] | |_____^ help: you can reduce it to: `x == reversed_num || x == reversed_num / 10` [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: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/palindrome_number.rs:30:9 [INFO] [stdout] | [INFO] [stdout] 30 | assert_eq!(is_palindrome(121), 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] 30 - assert_eq!(is_palindrome(121), true); [INFO] [stdout] 30 + assert!(is_palindrome(121)); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/palindrome_number.rs:31:9 [INFO] [stdout] | [INFO] [stdout] 31 | assert_eq!(is_palindrome(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] 31 - assert_eq!(is_palindrome(0), true); [INFO] [stdout] 31 + assert!(is_palindrome(0)); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/palindrome_number.rs:32:9 [INFO] [stdout] | [INFO] [stdout] 32 | assert_eq!(is_palindrome(10), 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] 32 - assert_eq!(is_palindrome(10), false); [INFO] [stdout] 32 + assert!(!is_palindrome(10)); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/palindrome_number.rs:33:9 [INFO] [stdout] | [INFO] [stdout] 33 | assert_eq!(is_palindrome(-121), 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] 33 - assert_eq!(is_palindrome(-121), false); [INFO] [stdout] 33 + assert!(!is_palindrome(-121)); [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/remove_duplicates.rs:3:32 [INFO] [stdout] | [INFO] [stdout] 3 | pub fn remove_duplicates(nums: &mut Vec) -> 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] 3 - pub fn remove_duplicates(nums: &mut Vec) -> i32 { [INFO] [stdout] 3 + pub fn remove_duplicates(nums: &mut [i32]) -> i32 { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: length comparison to zero [INFO] [stdout] --> src/remove_duplicates.rs:4:8 [INFO] [stdout] | [INFO] [stdout] 4 | if nums.len() == 0 || nums.len() == 1 { [INFO] [stdout] | ^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `nums.is_empty()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do [INFO] [stdout] --> src/remove_duplicates_2.rs:3:32 [INFO] [stdout] | [INFO] [stdout] 3 | pub fn remove_duplicates(nums: &mut Vec) -> 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] 3 - pub fn remove_duplicates(nums: &mut Vec) -> i32 { [INFO] [stdout] 3 + pub fn remove_duplicates(nums: &mut [i32]) -> i32 { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this boolean expression can be simplified [INFO] [stdout] --> src/remove_duplicates_2.rs:34:12 [INFO] [stdout] | [INFO] [stdout] 34 | if (nums[j] != nums[i]) || (nums[j] == nums[i] && nums[j] != nums[k]) { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#nonminimal_bool [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 34 - if (nums[j] != nums[i]) || (nums[j] == nums[i] && nums[j] != nums[k]) { [INFO] [stdout] 34 + if !(nums[j] == nums[i] && nums[j] == nums[k]) { [INFO] [stdout] | [INFO] [stdout] 34 - if (nums[j] != nums[i]) || (nums[j] == nums[i] && nums[j] != nums[k]) { [INFO] [stdout] 34 + if (nums[j] != nums[i]) || nums[j] != nums[k] { [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/remove_duplicates_2.rs:24:33 [INFO] [stdout] | [INFO] [stdout] 24 | pub fn remove_duplicates2(nums: &mut Vec) -> 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] 24 - pub fn remove_duplicates2(nums: &mut Vec) -> i32 { [INFO] [stdout] 24 + pub fn remove_duplicates2(nums: &mut [i32]) -> i32 { [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/remove_duplicates_2.rs:46:33 [INFO] [stdout] | [INFO] [stdout] 46 | pub fn remove_duplicates3(nums: &mut Vec) -> 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] 46 - pub fn remove_duplicates3(nums: &mut Vec) -> i32 { [INFO] [stdout] 46 + pub fn remove_duplicates3(nums: &mut [i32]) -> i32 { [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/remove_element.rs:3:29 [INFO] [stdout] | [INFO] [stdout] 3 | pub fn remove_element(nums: &mut Vec, val: 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] 3 - pub fn remove_element(nums: &mut Vec, val: i32) -> i32 { [INFO] [stdout] 3 + pub fn remove_element(nums: &mut [i32], val: i32) -> i32 { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: importing legacy numeric constants [INFO] [stdout] --> src/reverse_integer.rs:5:9 [INFO] [stdout] | [INFO] [stdout] 5 | use std::i32; [INFO] [stdout] | ^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: remove this import [INFO] [stdout] = note: then `i32::` will resolve to the respective associated constant [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#legacy_numeric_constants [INFO] [stdout] = note: `#[warn(clippy::legacy_numeric_constants)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: importing legacy numeric constants [INFO] [stdout] --> src/reverse_integer.rs:37:13 [INFO] [stdout] | [INFO] [stdout] 37 | use std::i32; [INFO] [stdout] | ^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: remove this import [INFO] [stdout] = note: then `i32::` will resolve to the respective associated constant [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#legacy_numeric_constants [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: usage of a legacy numeric method [INFO] [stdout] --> src/reverse_integer.rs:41:28 [INFO] [stdout] | [INFO] [stdout] 41 | assert_eq!(reverse(i32::max_value()), 0); [INFO] [stdout] | ^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#legacy_numeric_constants [INFO] [stdout] help: use the associated constant instead [INFO] [stdout] | [INFO] [stdout] 41 - assert_eq!(reverse(i32::max_value()), 0); [INFO] [stdout] 41 + assert_eq!(reverse(i32::MAX), 0); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: usage of a legacy numeric method [INFO] [stdout] --> src/reverse_integer.rs:42:28 [INFO] [stdout] | [INFO] [stdout] 42 | assert_eq!(reverse(i32::min_value()), 0); [INFO] [stdout] | ^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#legacy_numeric_constants [INFO] [stdout] help: use the associated constant instead [INFO] [stdout] | [INFO] [stdout] 42 - assert_eq!(reverse(i32::min_value()), 0); [INFO] [stdout] 42 + assert_eq!(reverse(i32::MIN), 0); [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/reverse_string.rs:4:26 [INFO] [stdout] | [INFO] [stdout] 4 | pub fn reverse_string(s: &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] help: change this to [INFO] [stdout] | [INFO] [stdout] 4 - pub fn reverse_string(s: &mut Vec) { [INFO] [stdout] 4 + pub fn reverse_string(s: &mut [char]) { [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/reverse_string.rs:17:27 [INFO] [stdout] | [INFO] [stdout] 17 | pub fn reverse_string2(s: &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] help: change this to [INFO] [stdout] | [INFO] [stdout] 17 - pub fn reverse_string2(s: &mut Vec) { [INFO] [stdout] 17 + pub fn reverse_string2(s: &mut [char]) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: length comparison to one [INFO] [stdout] --> src/reverse_vowels_of_a_string.rs:5:8 [INFO] [stdout] | [INFO] [stdout] 5 | if s.len() < 1 { [INFO] [stdout] | ^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `s.is_empty()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: length comparison to one [INFO] [stdout] --> src/reverse_vowels_of_a_string.rs:29:8 [INFO] [stdout] | [INFO] [stdout] 29 | if s.len() < 1 { [INFO] [stdout] | ^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `s.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: match expression looks like `matches!` macro [INFO] [stdout] --> src/reverse_vowels_of_a_string.rs:54:5 [INFO] [stdout] | [INFO] [stdout] 54 | / match c { [INFO] [stdout] 55 | | b'a' | b'A' | b'e' | b'E' | b'i' | b'I' | b'o' | b'O' | b'u' | b'U' => true, [INFO] [stdout] 56 | | _ => false, [INFO] [stdout] 57 | | } [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_like_matches_macro [INFO] [stdout] = note: `#[warn(clippy::match_like_matches_macro)]` on by default [INFO] [stdout] help: use `matches!` directly [INFO] [stdout] | [INFO] [stdout] 54 - match c { [INFO] [stdout] 55 - b'a' | b'A' | b'e' | b'E' | b'i' | b'I' | b'o' | b'O' | b'u' | b'U' => true, [INFO] [stdout] 56 - _ => false, [INFO] [stdout] 57 - } [INFO] [stdout] 54 + matches!(c, b'a' | b'A' | b'e' | b'E' | b'i' | b'I' | b'o' | b'O' | b'u' | b'U') [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: called `.nth(0)` on a `std::iter::Iterator`, when `.next()` is equivalent [INFO] [stdout] --> src/reverse_words_in_a_string.rs:8:45 [INFO] [stdout] | [INFO] [stdout] 8 | .fold(String::new(), |acc, x| match x.chars().nth(0) { [INFO] [stdout] | ^^^^^^^^^^^^^^^^ help: try calling `.next()` instead of `.nth(0)`: `x.chars().next()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#iter_nth_zero [INFO] [stdout] = note: `#[warn(clippy::iter_nth_zero)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: useless conversion to the same type: `std::str::SplitWhitespace<'_>` [INFO] [stdout] --> src/reverse_words_in_a_string.rs:17:13 [INFO] [stdout] | [INFO] [stdout] 17 | let s = s [INFO] [stdout] | _____________^ [INFO] [stdout] 18 | | .split_whitespace() [INFO] [stdout] 19 | | .into_iter() [INFO] [stdout] | |____________________^ [INFO] [stdout] | [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 `.into_iter()` [INFO] [stdout] | [INFO] [stdout] 17 ~ let s = s [INFO] [stdout] 18 + .split_whitespace() [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/rotate_array.rs:4:21 [INFO] [stdout] | [INFO] [stdout] 4 | pub fn rotate(nums: &mut Vec, k: 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] 4 - pub fn rotate(nums: &mut Vec, k: i32) { [INFO] [stdout] 4 + pub fn rotate(nums: &mut [i32], k: i32) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is only used to index `nums` [INFO] [stdout] --> src/rotate_array.rs:11:14 [INFO] [stdout] | [INFO] [stdout] 11 | for i in mid + 1..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] 11 - for i in mid + 1..nums.len() { [INFO] [stdout] 11 + for in nums.iter().skip(mid + 1) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: it looks like you're manually copying between slices [INFO] [stdout] --> src/rotate_array.rs:17:5 [INFO] [stdout] | [INFO] [stdout] 17 | / for i in 0..k { [INFO] [stdout] 18 | | nums[i] = temp[i]; [INFO] [stdout] 19 | | } [INFO] [stdout] | |_____^ help: try replacing the loop by: `nums[..k].copy_from_slice(&temp[..k]);` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_memcpy [INFO] [stdout] = note: `#[warn(clippy::manual_memcpy)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: deref which would be done by auto-deref [INFO] [stdout] --> src/sort_characters_by_frequency.rs:21:25 [INFO] [stdout] | [INFO] [stdout] 21 | freq.sort_by(|a, b| (*b).1.partial_cmp((*a).1).unwrap()); [INFO] [stdout] | ^^^^ help: try: `b` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: deref which would be done by auto-deref [INFO] [stdout] --> src/sort_characters_by_frequency.rs:21:44 [INFO] [stdout] | [INFO] [stdout] 21 | freq.sort_by(|a, b| (*b).1.partial_cmp((*a).1).unwrap()); [INFO] [stdout] | ^^^^ help: try: `a` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `repeat().take()` can be written more concisely [INFO] [stdout] --> src/sort_characters_by_frequency.rs:59:27 [INFO] [stdout] | [INFO] [stdout] 59 | res.push_str(&iter::repeat(c).take(i).collect::()); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `repeat_n()` instead: `std::iter::repeat_n(c, i)` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_repeat_n [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/sort_characters_by_frequency.rs:72:9 [INFO] [stdout] | [INFO] [stdout] 72 | / assert_eq!( [INFO] [stdout] 73 | | res == String::from("eert") || res == String::from("eetr"), [INFO] [stdout] 74 | | true [INFO] [stdout] 75 | | ); [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!( [INFO] [stdout] 73 ~ res == String::from("eert") || res == String::from("eetr") [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this creates an owned instance just for comparison [INFO] [stdout] --> src/sort_characters_by_frequency.rs:73:20 [INFO] [stdout] | [INFO] [stdout] 73 | res == String::from("eert") || res == String::from("eetr"), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^ help: try: `"eert"` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cmp_owned [INFO] [stdout] = note: `#[warn(clippy::cmp_owned)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this creates an owned instance just for comparison [INFO] [stdout] --> src/sort_characters_by_frequency.rs:73:51 [INFO] [stdout] | [INFO] [stdout] 73 | res == String::from("eert") || res == String::from("eetr"), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^ help: try: `"eetr"` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cmp_owned [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/sort_characters_by_frequency.rs:81:9 [INFO] [stdout] | [INFO] [stdout] 81 | / assert_eq!( [INFO] [stdout] 82 | | res == String::from("eert") || res == String::from("eetr"), [INFO] [stdout] 83 | | true [INFO] [stdout] 84 | | ); [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] 81 ~ assert!( [INFO] [stdout] 82 ~ res == String::from("eert") || res == String::from("eetr") [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this creates an owned instance just for comparison [INFO] [stdout] --> src/sort_characters_by_frequency.rs:82:20 [INFO] [stdout] | [INFO] [stdout] 82 | res == String::from("eert") || res == String::from("eetr"), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^ help: try: `"eert"` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cmp_owned [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this creates an owned instance just for comparison [INFO] [stdout] --> src/sort_characters_by_frequency.rs:82:51 [INFO] [stdout] | [INFO] [stdout] 82 | res == String::from("eert") || res == String::from("eetr"), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^ help: try: `"eetr"` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cmp_owned [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/sort_colors.rs:3:26 [INFO] [stdout] | [INFO] [stdout] 3 | pub fn sort_colors(nums: &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] help: change this to [INFO] [stdout] | [INFO] [stdout] 3 - pub fn sort_colors(nums: &mut Vec) { [INFO] [stdout] 3 + pub fn sort_colors(nums: &mut [i32]) { [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/sort_colors.rs:19:27 [INFO] [stdout] | [INFO] [stdout] 19 | pub fn sort_colors2(nums: &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] help: change this to [INFO] [stdout] | [INFO] [stdout] 19 - pub fn sort_colors2(nums: &mut Vec) { [INFO] [stdout] 19 + pub fn sort_colors2(nums: &mut [i32]) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `y` is only used to index `matrix` [INFO] [stdout] --> src/spiral_matrix.rs:14:18 [INFO] [stdout] | [INFO] [stdout] 14 | for y in y_min..y_max { [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] 14 - for y in y_min..y_max { [INFO] [stdout] 14 + for in matrix.iter().take(y_max).skip(y_min) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `x` is only used to index `matrix` [INFO] [stdout] --> src/spiral_matrix.rs:21:18 [INFO] [stdout] | [INFO] [stdout] 21 | for x in x_min..x_max { [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] 21 - for x in x_min..x_max { [INFO] [stdout] 21 + for in matrix.iter().take(x_max).skip(x_min) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/target_sum.rs:15:13 [INFO] [stdout] | [INFO] [stdout] 15 | return res; [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] 15 - return res; [INFO] [stdout] 15 + res [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/target_sum.rs:17:13 [INFO] [stdout] | [INFO] [stdout] 17 | return res; [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] 17 - return res; [INFO] [stdout] 17 + res [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/target_sum.rs:20:38 [INFO] [stdout] | [INFO] [stdout] 20 | res += _find_target_sum_ways(&nums, index + 1, s, sum + nums[index]); [INFO] [stdout] | ^^^^^ help: change this to: `nums` [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/target_sum.rs:21:38 [INFO] [stdout] | [INFO] [stdout] 21 | res += _find_target_sum_ways(&nums, index + 1, s, sum - nums[index]); [INFO] [stdout] | ^^^^^ help: change this to: `nums` [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: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()` [INFO] [stdout] --> src/top_k_frequent_elements.rs:24:9 [INFO] [stdout] | [INFO] [stdout] 24 | heap.pop().map(|(_k, v)| res.push(v)); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#option_map_unit_fn [INFO] [stdout] = note: `#[warn(clippy::option_map_unit_fn)]` on by default [INFO] [stdout] help: use `if let` instead [INFO] [stdout] | [INFO] [stdout] 24 - heap.pop().map(|(_k, v)| res.push(v)); [INFO] [stdout] 24 + if let Some((_k, v)) = heap.pop() { res.push(v) } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/valid_anagram.rs:43:9 [INFO] [stdout] | [INFO] [stdout] 43 | / assert_eq!( [INFO] [stdout] 44 | | is_anagram(String::from("anagram"), String::from("nagaram")), [INFO] [stdout] 45 | | true [INFO] [stdout] 46 | | ); [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] 43 ~ assert!( [INFO] [stdout] 44 ~ is_anagram(String::from("anagram"), String::from("nagaram")) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/valid_anagram.rs:47:9 [INFO] [stdout] | [INFO] [stdout] 47 | assert_eq!(is_anagram(String::from("rat"), String::from("car")), 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] 47 - assert_eq!(is_anagram(String::from("rat"), String::from("car")), false); [INFO] [stdout] 47 + assert!(!is_anagram(String::from("rat"), String::from("car"))); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: length comparison to one [INFO] [stdout] --> src/valid_palindrome.rs:5:8 [INFO] [stdout] | [INFO] [stdout] 5 | if s.len() < 1 { [INFO] [stdout] | ^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `s.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: manual case-insensitive ASCII comparison [INFO] [stdout] --> src/valid_palindrome.rs:22:12 [INFO] [stdout] | [INFO] [stdout] 22 | if c1.to_ascii_lowercase() != c2.to_ascii_lowercase() { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_ignore_case_cmp [INFO] [stdout] = note: `#[warn(clippy::manual_ignore_case_cmp)]` on by default [INFO] [stdout] help: consider using `.eq_ignore_ascii_case()` instead [INFO] [stdout] | [INFO] [stdout] 22 - if c1.to_ascii_lowercase() != c2.to_ascii_lowercase() { [INFO] [stdout] 22 + if !c1.eq_ignore_ascii_case(&c2) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/valid_palindrome.rs:50:9 [INFO] [stdout] | [INFO] [stdout] 50 | assert_eq!(is_palindrome(String::from(".,")), 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] 50 - assert_eq!(is_palindrome(String::from(".,")), true); [INFO] [stdout] 50 + assert!(is_palindrome(String::from(".,"))); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/valid_palindrome.rs:52:9 [INFO] [stdout] | [INFO] [stdout] 52 | / assert_eq!( [INFO] [stdout] 53 | | is_palindrome(String::from("A man, a plan, a canal: Panama")), [INFO] [stdout] 54 | | true [INFO] [stdout] 55 | | ); [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] 52 ~ assert!( [INFO] [stdout] 53 ~ is_palindrome(String::from("A man, a plan, a canal: Panama")) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/valid_palindrome.rs:56:9 [INFO] [stdout] | [INFO] [stdout] 56 | assert_eq!(is_palindrome(String::from(".a")), 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] 56 - assert_eq!(is_palindrome(String::from(".a")), true); [INFO] [stdout] 56 + assert!(is_palindrome(String::from(".a"))); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/valid_palindrome.rs:57:9 [INFO] [stdout] | [INFO] [stdout] 57 | assert_eq!(is_palindrome(String::from("!!!")), 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] 57 - assert_eq!(is_palindrome(String::from("!!!")), true); [INFO] [stdout] 57 + assert!(is_palindrome(String::from("!!!"))); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/valid_palindrome.rs:58:9 [INFO] [stdout] | [INFO] [stdout] 58 | assert_eq!(is_palindrome(String::from("a.")), 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] 58 - assert_eq!(is_palindrome(String::from("a.")), true); [INFO] [stdout] 58 + assert!(is_palindrome(String::from("a."))); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/valid_palindrome.rs:63:9 [INFO] [stdout] | [INFO] [stdout] 63 | / assert_eq!( [INFO] [stdout] 64 | | is_palindrome2(String::from("A man, a plan, a canal: Panama")), [INFO] [stdout] 65 | | true [INFO] [stdout] 66 | | ); [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] 63 ~ assert!( [INFO] [stdout] 64 ~ is_palindrome2(String::from("A man, a plan, a canal: Panama")) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/valid_palindrome.rs:67:9 [INFO] [stdout] | [INFO] [stdout] 67 | assert_eq!(is_palindrome2(String::from(".a")), 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] 67 - assert_eq!(is_palindrome2(String::from(".a")), true); [INFO] [stdout] 67 + assert!(is_palindrome2(String::from(".a"))); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/valid_palindrome.rs:68:9 [INFO] [stdout] | [INFO] [stdout] 68 | assert_eq!(is_palindrome2(String::from("a.")), 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] 68 - assert_eq!(is_palindrome2(String::from("a.")), true); [INFO] [stdout] 68 + assert!(is_palindrome2(String::from("a."))); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/valid_palindrome.rs:69:9 [INFO] [stdout] | [INFO] [stdout] 69 | assert_eq!(is_palindrome2(String::from(".,")), 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] 69 - assert_eq!(is_palindrome2(String::from(".,")), true); [INFO] [stdout] 69 + assert!(is_palindrome2(String::from(".,"))); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` has identical blocks [INFO] [stdout] --> src/valid_parentheses.rs:16:44 [INFO] [stdout] | [INFO] [stdout] 16 | if top == '(' && ch == ')' { [INFO] [stdout] | ____________________________________________^ [INFO] [stdout] 17 | | stack.pop_back(); [INFO] [stdout] 18 | | } else if top == '[' && ch == ']' { [INFO] [stdout] | |_________________^ [INFO] [stdout] | [INFO] [stdout] note: same as this [INFO] [stdout] --> src/valid_parentheses.rs:18:51 [INFO] [stdout] | [INFO] [stdout] 18 | } else if top == '[' && ch == ']' { [INFO] [stdout] | ___________________________________________________^ [INFO] [stdout] 19 | | stack.pop_back(); [INFO] [stdout] 20 | | } else if top == '{' && ch == '}' { [INFO] [stdout] | |_________________^ [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#if_same_then_else [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` has identical blocks [INFO] [stdout] --> src/valid_parentheses.rs:18:51 [INFO] [stdout] | [INFO] [stdout] 18 | } else if top == '[' && ch == ']' { [INFO] [stdout] | ___________________________________________________^ [INFO] [stdout] 19 | | stack.pop_back(); [INFO] [stdout] 20 | | } else if top == '{' && ch == '}' { [INFO] [stdout] | |_________________^ [INFO] [stdout] | [INFO] [stdout] note: same as this [INFO] [stdout] --> src/valid_parentheses.rs:20:51 [INFO] [stdout] | [INFO] [stdout] 20 | } else if top == '{' && ch == '}' { [INFO] [stdout] | ___________________________________________________^ [INFO] [stdout] 21 | | stack.pop_back(); [INFO] [stdout] 22 | | } else { [INFO] [stdout] | |_________________^ [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#if_same_then_else [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/valid_parentheses.rs:39:9 [INFO] [stdout] | [INFO] [stdout] 39 | assert_eq!(is_valid(s), 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] 39 - assert_eq!(is_valid(s), true); [INFO] [stdout] 39 + assert!(is_valid(s)); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/valid_parentheses.rs:41:9 [INFO] [stdout] | [INFO] [stdout] 41 | assert_eq!(is_valid(s), 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] 41 - assert_eq!(is_valid(s), false); [INFO] [stdout] 41 + assert!(!is_valid(s)); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/valid_parentheses.rs:43:9 [INFO] [stdout] | [INFO] [stdout] 43 | assert_eq!(is_valid(s), 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] 43 - assert_eq!(is_valid(s), true); [INFO] [stdout] 43 + assert!(is_valid(s)); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: importing legacy numeric constants [INFO] [stdout] --> src/validate_binary_search_tree.rs:10:9 [INFO] [stdout] | [INFO] [stdout] 10 | use std::i32; [INFO] [stdout] | ^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: remove this import [INFO] [stdout] = note: then `i32::` will resolve to the respective associated constant [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#legacy_numeric_constants [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: usage of a legacy numeric method [INFO] [stdout] --> src/validate_binary_search_tree.rs:11:23 [INFO] [stdout] | [INFO] [stdout] 11 | let mut min_val = i32::min_value(); [INFO] [stdout] | ^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#legacy_numeric_constants [INFO] [stdout] help: use the associated constant instead [INFO] [stdout] | [INFO] [stdout] 11 - let mut min_val = i32::min_value(); [INFO] [stdout] 11 + let mut min_val = i32::MIN; [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/validate_binary_search_tree.rs:30:58 [INFO] [stdout] | [INFO] [stdout] 30 | if _is_valid_bst(node.borrow().left.clone(), &mut val) && *val < node.borrow().val { [INFO] [stdout] | ^^^^^^^^ help: change this to: `val` [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/validate_binary_search_tree.rs:32:60 [INFO] [stdout] | [INFO] [stdout] 32 | _is_valid_bst(node.borrow().right.clone(), &mut val) [INFO] [stdout] | ^^^^^^^^ help: change this to: `val` [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: length comparison to zero [INFO] [stdout] --> src/validate_binary_search_tree.rs:42:8 [INFO] [stdout] | [INFO] [stdout] 42 | if vals.len() == 0 { [INFO] [stdout] | ^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `vals.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 expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/validate_binary_search_tree.rs:63:49 [INFO] [stdout] | [INFO] [stdout] 63 | inorder(node.borrow().left.clone(), &mut res); [INFO] [stdout] | ^^^^^^^^ help: change this to: `res` [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/validate_binary_search_tree.rs:65:50 [INFO] [stdout] | [INFO] [stdout] 65 | inorder(node.borrow().right.clone(), &mut res); [INFO] [stdout] | ^^^^^^^^ help: change this to: `res` [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: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/validate_binary_search_tree.rs:89:9 [INFO] [stdout] | [INFO] [stdout] 89 | assert_eq!(is_valid_bst(tree), 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] 89 - assert_eq!(is_valid_bst(tree), false); [INFO] [stdout] 89 + assert!(!is_valid_bst(tree)); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/validate_binary_search_tree.rs:104:9 [INFO] [stdout] | [INFO] [stdout] 104 | assert_eq!(is_valid_bst(tree), 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] 104 - assert_eq!(is_valid_bst(tree), true); [INFO] [stdout] 104 + assert!(is_valid_bst(tree)); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/validate_binary_search_tree.rs:122:9 [INFO] [stdout] | [INFO] [stdout] 122 | assert_eq!(is_valid_bst2(tree), 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] 122 - assert_eq!(is_valid_bst2(tree), false); [INFO] [stdout] 122 + assert!(!is_valid_bst2(tree)); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/validate_binary_search_tree.rs:137:9 [INFO] [stdout] | [INFO] [stdout] 137 | assert_eq!(is_valid_bst2(tree), 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] 137 - assert_eq!(is_valid_bst2(tree), true); [INFO] [stdout] 137 + assert!(is_valid_bst2(tree)); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/validate_binary_search_tree.rs:144:9 [INFO] [stdout] | [INFO] [stdout] 144 | assert_eq!(is_valid_bst2(tree), 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] 144 - assert_eq!(is_valid_bst2(tree), true); [INFO] [stdout] 144 + assert!(is_valid_bst2(tree)); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: used `assert_eq!` with a literal bool [INFO] [stdout] --> src/validate_binary_search_tree.rs:145:9 [INFO] [stdout] | [INFO] [stdout] 145 | assert_eq!(is_valid_bst2(None), 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] 145 - assert_eq!(is_valid_bst2(None), true); [INFO] [stdout] 145 + assert!(is_valid_bst2(None)); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `repeat().take()` can be written more concisely [INFO] [stdout] --> src/vertical_order_traversal_of_a_binary_tree.rs:18:23 [INFO] [stdout] | [INFO] [stdout] 18 | let mut res = iter::repeat(vec![]) [INFO] [stdout] | _______________________^ [INFO] [stdout] 19 | | .take((right + 1 - left) as usize) [INFO] [stdout] | |______________________________________________^ help: consider using `repeat_n()` instead: `std::iter::repeat_n(vec![], (right + 1 - left) as usize)` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_repeat_n [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `i32` which implements the `Copy` trait [INFO] [stdout] --> src/vertical_order_traversal_of_a_binary_tree.rs:22:41 [INFO] [stdout] | [INFO] [stdout] 22 | preorder2(root, &mut res, 0, 0, left.clone()); [INFO] [stdout] | ^^^^^^^^^^^^ help: try removing the `clone` call: `left` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: parameter is only used in recursion [INFO] [stdout] --> src/vertical_order_traversal_of_a_binary_tree.rs:31:5 [INFO] [stdout] | [INFO] [stdout] 31 | y: i32, [INFO] [stdout] | ^ help: if this is intentional, prefix it with an underscore: `_y` [INFO] [stdout] | [INFO] [stdout] note: parameter used here [INFO] [stdout] --> src/vertical_order_traversal_of_a_binary_tree.rs:40:57 [INFO] [stdout] | [INFO] [stdout] 40 | preorder(node.borrow().left.clone(), x - 1, y - 1, left, right); [INFO] [stdout] | ^ [INFO] [stdout] 41 | preorder(node.borrow().right.clone(), x + 1, y - 1, left, right); [INFO] [stdout] | ^ [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#only_used_in_recursion [INFO] [stdout] = note: `#[warn(clippy::only_used_in_recursion)]` 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/vertical_order_traversal_of_a_binary_tree.rs:57:51 [INFO] [stdout] | [INFO] [stdout] 57 | preorder2(node.borrow().left.clone(), &mut res, x - 1, y - 1, left); [INFO] [stdout] | ^^^^^^^^ help: change this to: `res` [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/vertical_order_traversal_of_a_binary_tree.rs:58:52 [INFO] [stdout] | [INFO] [stdout] 58 | preorder2(node.borrow().right.clone(), &mut res, x + 1, y - 1, left); [INFO] [stdout] | ^^^^^^^^ help: change this to: `res` [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: parameter is only used in recursion [INFO] [stdout] --> src/vertical_order_traversal_of_a_binary_tree.rs:50:5 [INFO] [stdout] | [INFO] [stdout] 50 | y: i32, [INFO] [stdout] | ^ help: if this is intentional, prefix it with an underscore: `_y` [INFO] [stdout] | [INFO] [stdout] note: parameter used here [INFO] [stdout] --> src/vertical_order_traversal_of_a_binary_tree.rs:57:68 [INFO] [stdout] | [INFO] [stdout] 57 | preorder2(node.borrow().left.clone(), &mut res, x - 1, y - 1, left); [INFO] [stdout] | ^ [INFO] [stdout] 58 | preorder2(node.borrow().right.clone(), &mut res, x + 1, y - 1, left); [INFO] [stdout] | ^ [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#only_used_in_recursion [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: casting to the same type is unnecessary (`usize` -> `usize`) [INFO] [stdout] --> src/zigzag_conversion.rs:11:54 [INFO] [stdout] | [INFO] [stdout] 11 | let mut mat: Vec> = Vec::with_capacity(num_rows as usize); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^ help: try: `num_rows` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `repeat().take()` can be written more concisely [INFO] [stdout] --> src/zigzag_conversion.rs:13:18 [INFO] [stdout] | [INFO] [stdout] 13 | mat.push(iter::repeat('\0').take(s.len()).collect::>()); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `repeat_n()` instead: `std::iter::repeat_n('\0', s.len())` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_repeat_n [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the variable `char_i` is used as a loop counter [INFO] [stdout] --> src/zigzag_conversion.rs:19:5 [INFO] [stdout] | [INFO] [stdout] 19 | for i in (0..num_rows).chain((1..num_rows - 1).rev()).cycle() { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `for (char_i, i) in (0..num_rows).chain((1..num_rows - 1).rev()).cycle().enumerate()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_counter_loop [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the variable `count` is used as a loop counter [INFO] [stdout] --> src/first_unique_character_in_a_string.rs:22:5 [INFO] [stdout] | [INFO] [stdout] 22 | for ch in s { [INFO] [stdout] | ^^^^^^^^^^^ help: consider using: `for (count, ch) in s.into_iter().enumerate()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_counter_loop [INFO] [stdout] [INFO] [stdout] [INFO] [stderr] Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.76s [INFO] running `Command { std: "docker" "inspect" "f084f6d09827e86203864a8eea67809115ed6d149898b11ac460545c021fd57e", kill_on_drop: false }` [INFO] running `Command { std: "docker" "rm" "-f" "f084f6d09827e86203864a8eea67809115ed6d149898b11ac460545c021fd57e", kill_on_drop: false }` [INFO] [stdout] f084f6d09827e86203864a8eea67809115ed6d149898b11ac460545c021fd57e