[INFO] cloning repository https://github.com/LRamson/rust-shell [INFO] running `Command { std: "git" "-c" "credential.helper=" "-c" "credential.helper=/workspace/cargo-home/bin/git-credential-null" "clone" "--bare" "https://github.com/LRamson/rust-shell" "/workspace/cache/git-repos/https%3A%2F%2Fgithub.com%2FLRamson%2Frust-shell", kill_on_drop: false }` [INFO] [stderr] Cloning into bare repository '/workspace/cache/git-repos/https%3A%2F%2Fgithub.com%2FLRamson%2Frust-shell'... [INFO] running `Command { std: "git" "rev-parse" "HEAD", kill_on_drop: false }` [INFO] [stdout] 9c9426f1e249bf6a75b4c94ff434015e21280e7d [INFO] linting LRamson/rust-shell against nightly for clippy-nonminimal_bool-denied [INFO] running `Command { std: "git" "clone" "/workspace/cache/git-repos/https%3A%2F%2Fgithub.com%2FLRamson%2Frust-shell" "/workspace/builds/worker-3-tc1/source", kill_on_drop: false }` [INFO] [stderr] Cloning into '/workspace/builds/worker-3-tc1/source'... [INFO] [stderr] done. [INFO] started tweaking git repo https://github.com/LRamson/rust-shell [INFO] finished tweaking git repo https://github.com/LRamson/rust-shell [INFO] tweaked toml for git repo https://github.com/LRamson/rust-shell written to /workspace/builds/worker-3-tc1/source/Cargo.toml [INFO] validating manifest of git repo https://github.com/LRamson/rust-shell on toolchain nightly [INFO] running `Command { std: CARGO_HOME="/workspace/cargo-home" RUSTUP_HOME="/workspace/rustup-home" "/workspace/cargo-home/bin/cargo" "+nightly" "metadata" "--manifest-path" "Cargo.toml" "--no-deps", kill_on_drop: false }` [INFO] crate git repo https://github.com/LRamson/rust-shell already has a lockfile, it will not be regenerated [INFO] running `Command { std: CARGO_HOME="/workspace/cargo-home" RUSTUP_HOME="/workspace/rustup-home" "/workspace/cargo-home/bin/cargo" "+nightly" "fetch" "--manifest-path" "Cargo.toml", kill_on_drop: false }` [INFO] [stderr] Downloading crates ... [INFO] [stderr] Downloaded rustyline v14.0.0 [INFO] running `Command { std: "docker" "create" "-v" "/var/lib/crater-agent-workspace/builds/worker-3-tc1/target:/opt/rustwide/target:rw,Z" "-v" "/var/lib/crater-agent-workspace/builds/worker-3-tc1/source:/opt/rustwide/workdir:ro,Z" "-v" "/var/lib/crater-agent-workspace/cargo-home:/opt/rustwide/cargo-home:ro,Z" "-v" "/var/lib/crater-agent-workspace/rustup-home:/opt/rustwide/rustup-home:ro,Z" "-e" "SOURCE_DIR=/opt/rustwide/workdir" "-e" "CARGO_TARGET_DIR=/opt/rustwide/target" "-e" "CARGO_HOME=/opt/rustwide/cargo-home" "-e" "RUSTUP_HOME=/opt/rustwide/rustup-home" "-w" "/opt/rustwide/workdir" "-m" "1610612736" "--user" "0:0" "--network" "none" "ghcr.io/rust-lang/crates-build-env/linux@sha256:d429b63d4308055ea97f60fb1d3dfca48854a00942f1bd2ad806beaf015945ec" "/opt/rustwide/cargo-home/bin/cargo" "+nightly" "metadata" "--no-deps" "--format-version=1", kill_on_drop: false }` [INFO] [stdout] cda3cba541e800c6deac2853837fc6354f896ba498f0d58ae7313598a4bb16a1 [INFO] running `Command { std: "docker" "start" "-a" "cda3cba541e800c6deac2853837fc6354f896ba498f0d58ae7313598a4bb16a1", kill_on_drop: false }` [INFO] running `Command { std: "docker" "inspect" "cda3cba541e800c6deac2853837fc6354f896ba498f0d58ae7313598a4bb16a1", kill_on_drop: false }` [INFO] running `Command { std: "docker" "rm" "-f" "cda3cba541e800c6deac2853837fc6354f896ba498f0d58ae7313598a4bb16a1", kill_on_drop: false }` [INFO] [stdout] cda3cba541e800c6deac2853837fc6354f896ba498f0d58ae7313598a4bb16a1 [INFO] running `Command { std: "docker" "create" "-v" "/var/lib/crater-agent-workspace/builds/worker-3-tc1/target:/opt/rustwide/target:rw,Z" "-v" "/var/lib/crater-agent-workspace/builds/worker-3-tc1/source:/opt/rustwide/workdir:ro,Z" "-v" "/var/lib/crater-agent-workspace/cargo-home:/opt/rustwide/cargo-home:ro,Z" "-v" "/var/lib/crater-agent-workspace/rustup-home:/opt/rustwide/rustup-home:ro,Z" "-e" "SOURCE_DIR=/opt/rustwide/workdir" "-e" "CARGO_TARGET_DIR=/opt/rustwide/target" "-e" "CARGO_INCREMENTAL=0" "-e" "RUST_BACKTRACE=full" "-e" "RUSTFLAGS=--cap-lints=forbid" "-e" "RUSTDOCFLAGS=--cap-lints=forbid" "-e" "CARGO_HOME=/opt/rustwide/cargo-home" "-e" "RUSTUP_HOME=/opt/rustwide/rustup-home" "-w" "/opt/rustwide/workdir" "-m" "1610612736" "--user" "0:0" "--network" "none" "ghcr.io/rust-lang/crates-build-env/linux@sha256:d429b63d4308055ea97f60fb1d3dfca48854a00942f1bd2ad806beaf015945ec" "/opt/rustwide/cargo-home/bin/cargo" "+nightly" "clippy" "--frozen" "--all" "--all-targets" "--message-format=json", kill_on_drop: false }` [INFO] [stdout] 6dff82764ed7067649de19707e73a03537ca08d76befbc73bad7d32ef0eca25f [INFO] running `Command { std: "docker" "start" "-a" "6dff82764ed7067649de19707e73a03537ca08d76befbc73bad7d32ef0eca25f", kill_on_drop: false }` [INFO] [stderr] Compiling libc v0.2.178 [INFO] [stderr] Checking smallvec v1.15.1 [INFO] [stderr] Compiling nix v0.28.0 [INFO] [stderr] Checking endian-type v0.1.2 [INFO] [stderr] Compiling anyhow v1.0.86 [INFO] [stderr] Checking home v0.5.12 [INFO] [stderr] Checking unicode-segmentation v1.12.0 [INFO] [stderr] Checking log v0.4.29 [INFO] [stderr] Checking bytes v1.7.1 [INFO] [stderr] Compiling quote v1.0.36 [INFO] [stderr] Checking fd-lock v4.0.4 [INFO] [stderr] Compiling syn v2.0.75 [INFO] [stderr] Checking nibble_vec v0.1.0 [INFO] [stderr] Checking radix_trie v0.2.1 [INFO] [stderr] Compiling thiserror-impl v1.0.63 [INFO] [stderr] Checking thiserror v1.0.63 [INFO] [stderr] Checking rustyline v14.0.0 [INFO] [stderr] Checking codecrafters-shell v0.1.0 (/opt/rustwide/workdir) [INFO] [stdout] warning: constants have by default a `'static` lifetime [INFO] [stdout] --> src/utils/parser.rs:1:25 [INFO] [stdout] | [INFO] [stdout] 1 | const SPECIAL_CHARS: &[&'static str] = &["\"", "\\"]; [INFO] [stdout] | -^^^^^^^---- help: consider removing `'static`: `&str` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_static_lifetimes [INFO] [stdout] = note: `#[warn(clippy::redundant_static_lifetimes)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: constants have by default a `'static` lifetime [INFO] [stdout] --> src/utils/parser.rs:1:25 [INFO] [stdout] | [INFO] [stdout] 1 | const SPECIAL_CHARS: &[&'static str] = &["\"", "\\"]; [INFO] [stdout] | -^^^^^^^---- help: consider removing `'static`: `&str` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_static_lifetimes [INFO] [stdout] = note: `#[warn(clippy::redundant_static_lifetimes)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: comparison to empty slice [INFO] [stdout] --> src/commands/exit.rs:10:12 [INFO] [stdout] | [INFO] [stdout] 10 | if path_hist != "" { [INFO] [stdout] | ^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!path_hist.is_empty()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#comparison_to_empty [INFO] [stdout] = note: `#[warn(clippy::comparison_to_empty)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/commands/type_cmd.rs:16:57 [INFO] [stdout] | [INFO] [stdout] 16 | if let Some(command) = registry.get_builtin(&arg) { [INFO] [stdout] | ^^^^ help: change this to: `arg` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow [INFO] [stdout] = note: `#[warn(clippy::needless_borrow)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/commands/type_cmd.rs:18:80 [INFO] [stdout] | [INFO] [stdout] 18 | } else if let Some(executable_path) = registry.get_executable_path(&arg) { [INFO] [stdout] | ^^^^ help: change this to: `arg` [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 `&Box`. Consider using just `&T` [INFO] [stdout] --> src/commands/registry.rs:27:53 [INFO] [stdout] | [INFO] [stdout] 27 | pub fn get_builtin(&self, name: &str) -> Option<&Box> { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^ help: try: `&dyn Command` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#borrowed_box [INFO] [stdout] = note: `#[warn(clippy::borrowed_box)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unnecessary `if let` since only the `Ok` variant of the iterator element is used [INFO] [stdout] --> src/commands/registry.rs:101:17 [INFO] [stdout] | [INFO] [stdout] 101 | / for entry in entries { [INFO] [stdout] 102 | | if let Ok(entry) = entry { [INFO] [stdout] 103 | | let file_name = entry.file_name().into_string().unwrap_or_default(); [INFO] [stdout] ... | [INFO] [stdout] 114 | | } [INFO] [stdout] | |_________________^ [INFO] [stdout] | [INFO] [stdout] help: try `.flatten()` and remove the `if let` statement in the for loop [INFO] [stdout] --> src/commands/registry.rs:102:21 [INFO] [stdout] | [INFO] [stdout] 102 | / if let Ok(entry) = entry { [INFO] [stdout] 103 | | let file_name = entry.file_name().into_string().unwrap_or_default(); [INFO] [stdout] 104 | | [INFO] [stdout] 105 | | if self.executables.contains_key(&file_name) { [INFO] [stdout] ... | [INFO] [stdout] 113 | | } [INFO] [stdout] | |_____________________^ [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_flatten [INFO] [stdout] = note: `#[warn(clippy::manual_flatten)]` on by default [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 101 ~ for entry in entries.flatten() { [INFO] [stdout] 102 + let file_name = entry.file_name().into_string().unwrap_or_default(); [INFO] [stdout] 103 + [INFO] [stdout] 104 + if self.executables.contains_key(&file_name) { [INFO] [stdout] 105 + continue; [INFO] [stdout] 106 + } [INFO] [stdout] 107 + [INFO] [stdout] 108 + let full_path = format!("{}/{}", path, file_name); [INFO] [stdout] 109 + if fs::metadata(&full_path).map(|m| m.permissions().mode() & 0o111 != 0).unwrap_or(false) { [INFO] [stdout] 110 + self.register_executable(&file_name, &full_path); [INFO] [stdout] 111 + } [INFO] [stdout] 112 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/commands/registry.rs:132:9 [INFO] [stdout] | [INFO] [stdout] 132 | return None; [INFO] [stdout] | ^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] = note: `#[warn(clippy::needless_return)]` on by default [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 132 - return None; [INFO] [stdout] 132 + None [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant pattern matching, consider using `is_err()` [INFO] [stdout] --> src/commands/cd.rs:17:20 [INFO] [stdout] | [INFO] [stdout] 17 | if let Err(_) = env::set_current_dir(&home_path) { [INFO] [stdout] | -------^^^^^^----------------------------------- help: try: `if env::set_current_dir(&home_path).is_err()` [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: redundant pattern matching, consider using `is_err()` [INFO] [stdout] --> src/commands/cd.rs:26:16 [INFO] [stdout] | [INFO] [stdout] 26 | if let Err(_) = env::set_current_dir(&root) { [INFO] [stdout] | -------^^^^^^------------------------------ help: try: `if env::set_current_dir(&root).is_err()` [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: the borrowed expression implements the required traits [INFO] [stdout] --> src/commands/cd.rs:26:46 [INFO] [stdout] | [INFO] [stdout] 26 | if let Err(_) = env::set_current_dir(&root) { [INFO] [stdout] | ^^^^^ help: change this to: `root` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args [INFO] [stdout] = note: `#[warn(clippy::needless_borrows_for_generic_args)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/commands/executor.rs:161:9 [INFO] [stdout] | [INFO] [stdout] 161 | / if let PipeState::Buffer(data) = input { [INFO] [stdout] 162 | | if let Some(mut stdin) = child.stdin.take() { [INFO] [stdout] 163 | | let _ = stdin.write_all(data); [INFO] [stdout] 164 | | } [INFO] [stdout] 165 | | } [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] = note: `#[warn(clippy::collapsible_if)]` on by default [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 161 ~ if let PipeState::Buffer(data) = input [INFO] [stdout] 162 ~ && let Some(mut stdin) = child.stdin.take() { [INFO] [stdout] 163 | let _ = stdin.write_all(data); [INFO] [stdout] 164 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this boolean expression can be simplified [INFO] [stdout] --> src/utils/parser.rs:106:20 [INFO] [stdout] | [INFO] [stdout] 106 | if (!in_double_quotes && !in_quotes && !escape_next) || [INFO] [stdout] | ____________________^ [INFO] [stdout] 107 | | (chars.peek().map_or(false, |next_c| SPECIAL_CHARS.contains(&next_c.to_string().as_str())) [INFO] [stdout] 108 | | && !escape_next && in_double_quotes){ [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] 106 - if (!in_double_quotes && !in_quotes && !escape_next) || [INFO] [stdout] 107 - (chars.peek().map_or(false, |next_c| SPECIAL_CHARS.contains(&next_c.to_string().as_str())) [INFO] [stdout] 108 - && !escape_next && in_double_quotes){ [INFO] [stdout] 106 + if !(escape_next || !in_double_quotes && in_quotes || in_double_quotes && !chars.peek().map_or(false, |next_c| SPECIAL_CHARS.contains(&next_c.to_string().as_str()))){ [INFO] [stdout] | [INFO] [stdout] 106 - if (!in_double_quotes && !in_quotes && !escape_next) || [INFO] [stdout] 107 - (chars.peek().map_or(false, |next_c| SPECIAL_CHARS.contains(&next_c.to_string().as_str())) [INFO] [stdout] 108 - && !escape_next && in_double_quotes){ [INFO] [stdout] 106 + if (chars.peek().map_or(false, |next_c| SPECIAL_CHARS.contains(&next_c.to_string().as_str())) || !in_double_quotes) && (!in_quotes || in_double_quotes) && !escape_next{ [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` can be collapsed into the outer `match` [INFO] [stdout] --> src/utils/parser.rs:106:17 [INFO] [stdout] | [INFO] [stdout] 106 | / if (!in_double_quotes && !in_quotes && !escape_next) || [INFO] [stdout] 107 | | (chars.peek().map_or(false, |next_c| SPECIAL_CHARS.contains(&next_c.to_string().as_str())) [INFO] [stdout] 108 | | && !escape_next && in_double_quotes){ [INFO] [stdout] 109 | | escape_next = true; [INFO] [stdout] ... | [INFO] [stdout] 112 | | escape_next = false; [INFO] [stdout] 113 | | } [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] 105 ~ '\\' [INFO] [stdout] 106 ~ if ((!in_double_quotes && !in_quotes && !escape_next) || [INFO] [stdout] 107 | (chars.peek().map_or(false, |next_c| SPECIAL_CHARS.contains(&next_c.to_string().as_str())) [INFO] [stdout] 108 ~ && !escape_next && in_double_quotes)=> ){ [INFO] [stdout] 109 | escape_next = true; [INFO] [stdout] 110 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` can be collapsed into the outer `match` [INFO] [stdout] --> src/utils/parser.rs:116:17 [INFO] [stdout] | [INFO] [stdout] 116 | / if !in_double_quotes && !escape_next { [INFO] [stdout] 117 | | in_quotes = !in_quotes; [INFO] [stdout] 118 | | } else { [INFO] [stdout] 119 | | current_arg.push(c); [INFO] [stdout] 120 | | escape_next = false; [INFO] [stdout] 121 | | } [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] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 115 ~ '\'' [INFO] [stdout] 116 ~ if !in_double_quotes && !escape_next => { [INFO] [stdout] 117 | in_quotes = !in_quotes; [INFO] [stdout] 118 ~ }, [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` can be collapsed into the outer `match` [INFO] [stdout] --> src/utils/parser.rs:124:17 [INFO] [stdout] | [INFO] [stdout] 124 | / if !in_quotes && !escape_next { [INFO] [stdout] 125 | | in_double_quotes = !in_double_quotes; [INFO] [stdout] 126 | | } else { [INFO] [stdout] 127 | | current_arg.push(c); [INFO] [stdout] 128 | | escape_next = false; [INFO] [stdout] 129 | | } [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] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 123 ~ '"' [INFO] [stdout] 124 ~ if !in_quotes && !escape_next => { [INFO] [stdout] 125 | in_double_quotes = !in_double_quotes; [INFO] [stdout] 126 ~ }, [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `map_or` can be simplified [INFO] [stdout] --> src/utils/parser.rs:107:22 [INFO] [stdout] | [INFO] [stdout] 107 | (chars.peek().map_or(false, |next_c| SPECIAL_CHARS.contains(&next_c.to_string().as_str())) [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or [INFO] [stdout] = note: `#[warn(clippy::unnecessary_map_or)]` on by default [INFO] [stdout] help: use `is_some_and` instead [INFO] [stdout] | [INFO] [stdout] 107 - (chars.peek().map_or(false, |next_c| SPECIAL_CHARS.contains(&next_c.to_string().as_str())) [INFO] [stdout] 107 + (chars.peek().is_some_and(|next_c| SPECIAL_CHARS.contains(&next_c.to_string().as_str())) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: comparison to empty slice [INFO] [stdout] --> src/main.rs:18:8 [INFO] [stdout] | [INFO] [stdout] 18 | if path_hist != "" { [INFO] [stdout] | ^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!path_hist.is_empty()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#comparison_to_empty [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: comparison to empty slice [INFO] [stdout] --> src/commands/exit.rs:10:12 [INFO] [stdout] | [INFO] [stdout] 10 | if path_hist != "" { [INFO] [stdout] | ^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!path_hist.is_empty()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#comparison_to_empty [INFO] [stdout] = note: `#[warn(clippy::comparison_to_empty)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/commands/type_cmd.rs:16:57 [INFO] [stdout] | [INFO] [stdout] 16 | if let Some(command) = registry.get_builtin(&arg) { [INFO] [stdout] | ^^^^ help: change this to: `arg` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow [INFO] [stdout] = note: `#[warn(clippy::needless_borrow)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/commands/type_cmd.rs:18:80 [INFO] [stdout] | [INFO] [stdout] 18 | } else if let Some(executable_path) = registry.get_executable_path(&arg) { [INFO] [stdout] | ^^^^ help: change this to: `arg` [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 `&Box`. Consider using just `&T` [INFO] [stdout] --> src/commands/registry.rs:27:53 [INFO] [stdout] | [INFO] [stdout] 27 | pub fn get_builtin(&self, name: &str) -> Option<&Box> { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^ help: try: `&dyn Command` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#borrowed_box [INFO] [stdout] = note: `#[warn(clippy::borrowed_box)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unnecessary `if let` since only the `Ok` variant of the iterator element is used [INFO] [stdout] --> src/commands/registry.rs:101:17 [INFO] [stdout] | [INFO] [stdout] 101 | / for entry in entries { [INFO] [stdout] 102 | | if let Ok(entry) = entry { [INFO] [stdout] 103 | | let file_name = entry.file_name().into_string().unwrap_or_default(); [INFO] [stdout] ... | [INFO] [stdout] 114 | | } [INFO] [stdout] | |_________________^ [INFO] [stdout] | [INFO] [stdout] help: try `.flatten()` and remove the `if let` statement in the for loop [INFO] [stdout] --> src/commands/registry.rs:102:21 [INFO] [stdout] | [INFO] [stdout] 102 | / if let Ok(entry) = entry { [INFO] [stdout] 103 | | let file_name = entry.file_name().into_string().unwrap_or_default(); [INFO] [stdout] 104 | | [INFO] [stdout] 105 | | if self.executables.contains_key(&file_name) { [INFO] [stdout] ... | [INFO] [stdout] 113 | | } [INFO] [stdout] | |_____________________^ [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_flatten [INFO] [stdout] = note: `#[warn(clippy::manual_flatten)]` on by default [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 101 ~ for entry in entries.flatten() { [INFO] [stdout] 102 + let file_name = entry.file_name().into_string().unwrap_or_default(); [INFO] [stdout] 103 + [INFO] [stdout] 104 + if self.executables.contains_key(&file_name) { [INFO] [stdout] 105 + continue; [INFO] [stdout] 106 + } [INFO] [stdout] 107 + [INFO] [stdout] 108 + let full_path = format!("{}/{}", path, file_name); [INFO] [stdout] 109 + if fs::metadata(&full_path).map(|m| m.permissions().mode() & 0o111 != 0).unwrap_or(false) { [INFO] [stdout] 110 + self.register_executable(&file_name, &full_path); [INFO] [stdout] 111 + } [INFO] [stdout] 112 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/commands/registry.rs:132:9 [INFO] [stdout] | [INFO] [stdout] 132 | return None; [INFO] [stdout] | ^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] = note: `#[warn(clippy::needless_return)]` on by default [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 132 - return None; [INFO] [stdout] 132 + None [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant pattern matching, consider using `is_err()` [INFO] [stdout] --> src/commands/cd.rs:17:20 [INFO] [stdout] | [INFO] [stdout] 17 | if let Err(_) = env::set_current_dir(&home_path) { [INFO] [stdout] | -------^^^^^^----------------------------------- help: try: `if env::set_current_dir(&home_path).is_err()` [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: redundant pattern matching, consider using `is_err()` [INFO] [stdout] --> src/commands/cd.rs:26:16 [INFO] [stdout] | [INFO] [stdout] 26 | if let Err(_) = env::set_current_dir(&root) { [INFO] [stdout] | -------^^^^^^------------------------------ help: try: `if env::set_current_dir(&root).is_err()` [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: the borrowed expression implements the required traits [INFO] [stdout] --> src/commands/cd.rs:26:46 [INFO] [stdout] | [INFO] [stdout] 26 | if let Err(_) = env::set_current_dir(&root) { [INFO] [stdout] | ^^^^^ help: change this to: `root` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args [INFO] [stdout] = note: `#[warn(clippy::needless_borrows_for_generic_args)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/commands/executor.rs:161:9 [INFO] [stdout] | [INFO] [stdout] 161 | / if let PipeState::Buffer(data) = input { [INFO] [stdout] 162 | | if let Some(mut stdin) = child.stdin.take() { [INFO] [stdout] 163 | | let _ = stdin.write_all(data); [INFO] [stdout] 164 | | } [INFO] [stdout] 165 | | } [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] = note: `#[warn(clippy::collapsible_if)]` on by default [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 161 ~ if let PipeState::Buffer(data) = input [INFO] [stdout] 162 ~ && let Some(mut stdin) = child.stdin.take() { [INFO] [stdout] 163 | let _ = stdin.write_all(data); [INFO] [stdout] 164 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this boolean expression can be simplified [INFO] [stdout] --> src/utils/parser.rs:106:20 [INFO] [stdout] | [INFO] [stdout] 106 | if (!in_double_quotes && !in_quotes && !escape_next) || [INFO] [stdout] | ____________________^ [INFO] [stdout] 107 | | (chars.peek().map_or(false, |next_c| SPECIAL_CHARS.contains(&next_c.to_string().as_str())) [INFO] [stdout] 108 | | && !escape_next && in_double_quotes){ [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] 106 - if (!in_double_quotes && !in_quotes && !escape_next) || [INFO] [stdout] 107 - (chars.peek().map_or(false, |next_c| SPECIAL_CHARS.contains(&next_c.to_string().as_str())) [INFO] [stdout] 108 - && !escape_next && in_double_quotes){ [INFO] [stdout] 106 + if !(escape_next || !in_double_quotes && in_quotes || in_double_quotes && !chars.peek().map_or(false, |next_c| SPECIAL_CHARS.contains(&next_c.to_string().as_str()))){ [INFO] [stdout] | [INFO] [stdout] 106 - if (!in_double_quotes && !in_quotes && !escape_next) || [INFO] [stdout] 107 - (chars.peek().map_or(false, |next_c| SPECIAL_CHARS.contains(&next_c.to_string().as_str())) [INFO] [stdout] 108 - && !escape_next && in_double_quotes){ [INFO] [stdout] 106 + if (chars.peek().map_or(false, |next_c| SPECIAL_CHARS.contains(&next_c.to_string().as_str())) || !in_double_quotes) && (!in_quotes || in_double_quotes) && !escape_next{ [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` can be collapsed into the outer `match` [INFO] [stdout] --> src/utils/parser.rs:106:17 [INFO] [stdout] | [INFO] [stdout] 106 | / if (!in_double_quotes && !in_quotes && !escape_next) || [INFO] [stdout] 107 | | (chars.peek().map_or(false, |next_c| SPECIAL_CHARS.contains(&next_c.to_string().as_str())) [INFO] [stdout] 108 | | && !escape_next && in_double_quotes){ [INFO] [stdout] 109 | | escape_next = true; [INFO] [stdout] ... | [INFO] [stdout] 112 | | escape_next = false; [INFO] [stdout] 113 | | } [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] 105 ~ '\\' [INFO] [stdout] 106 ~ if ((!in_double_quotes && !in_quotes && !escape_next) || [INFO] [stdout] 107 | (chars.peek().map_or(false, |next_c| SPECIAL_CHARS.contains(&next_c.to_string().as_str())) [INFO] [stdout] 108 ~ && !escape_next && in_double_quotes)=> ){ [INFO] [stdout] 109 | escape_next = true; [INFO] [stdout] 110 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` can be collapsed into the outer `match` [INFO] [stdout] --> src/utils/parser.rs:116:17 [INFO] [stdout] | [INFO] [stdout] 116 | / if !in_double_quotes && !escape_next { [INFO] [stdout] 117 | | in_quotes = !in_quotes; [INFO] [stdout] 118 | | } else { [INFO] [stdout] 119 | | current_arg.push(c); [INFO] [stdout] 120 | | escape_next = false; [INFO] [stdout] 121 | | } [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] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 115 ~ '\'' [INFO] [stdout] 116 ~ if !in_double_quotes && !escape_next => { [INFO] [stdout] 117 | in_quotes = !in_quotes; [INFO] [stdout] 118 ~ }, [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` can be collapsed into the outer `match` [INFO] [stdout] --> src/utils/parser.rs:124:17 [INFO] [stdout] | [INFO] [stdout] 124 | / if !in_quotes && !escape_next { [INFO] [stdout] 125 | | in_double_quotes = !in_double_quotes; [INFO] [stdout] 126 | | } else { [INFO] [stdout] 127 | | current_arg.push(c); [INFO] [stdout] 128 | | escape_next = false; [INFO] [stdout] 129 | | } [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] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 123 ~ '"' [INFO] [stdout] 124 ~ if !in_quotes && !escape_next => { [INFO] [stdout] 125 | in_double_quotes = !in_double_quotes; [INFO] [stdout] 126 ~ }, [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `map_or` can be simplified [INFO] [stdout] --> src/utils/parser.rs:107:22 [INFO] [stdout] | [INFO] [stdout] 107 | (chars.peek().map_or(false, |next_c| SPECIAL_CHARS.contains(&next_c.to_string().as_str())) [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or [INFO] [stdout] = note: `#[warn(clippy::unnecessary_map_or)]` on by default [INFO] [stdout] help: use `is_some_and` instead [INFO] [stdout] | [INFO] [stdout] 107 - (chars.peek().map_or(false, |next_c| SPECIAL_CHARS.contains(&next_c.to_string().as_str())) [INFO] [stdout] 107 + (chars.peek().is_some_and(|next_c| SPECIAL_CHARS.contains(&next_c.to_string().as_str())) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: comparison to empty slice [INFO] [stdout] --> src/main.rs:18:8 [INFO] [stdout] | [INFO] [stdout] 18 | if path_hist != "" { [INFO] [stdout] | ^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!path_hist.is_empty()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#comparison_to_empty [INFO] [stdout] [INFO] [stdout] [INFO] [stderr] Finished `dev` profile [unoptimized + debuginfo] target(s) in 6.68s [INFO] running `Command { std: "docker" "inspect" "6dff82764ed7067649de19707e73a03537ca08d76befbc73bad7d32ef0eca25f", kill_on_drop: false }` [INFO] running `Command { std: "docker" "rm" "-f" "6dff82764ed7067649de19707e73a03537ca08d76befbc73bad7d32ef0eca25f", kill_on_drop: false }` [INFO] [stdout] 6dff82764ed7067649de19707e73a03537ca08d76befbc73bad7d32ef0eca25f