[INFO] cloning repository https://github.com/oriax11/localserver-rust [INFO] running `Command { std: "git" "-c" "credential.helper=" "-c" "credential.helper=/workspace/cargo-home/bin/git-credential-null" "clone" "--bare" "https://github.com/oriax11/localserver-rust" "/workspace/cache/git-repos/https%3A%2F%2Fgithub.com%2Foriax11%2Flocalserver-rust", kill_on_drop: false }` [INFO] [stderr] Cloning into bare repository '/workspace/cache/git-repos/https%3A%2F%2Fgithub.com%2Foriax11%2Flocalserver-rust'... [INFO] running `Command { std: "git" "rev-parse" "HEAD", kill_on_drop: false }` [INFO] [stdout] 52662f30d5f7660a9adbe66683c5bacca8652356 [INFO] linting oriax11/localserver-rust against nightly for clippy-nonminimal_bool-denied [INFO] running `Command { std: "git" "clone" "/workspace/cache/git-repos/https%3A%2F%2Fgithub.com%2Foriax11%2Flocalserver-rust" "/workspace/builds/worker-0-tc1/source", kill_on_drop: false }` [INFO] [stderr] Cloning into '/workspace/builds/worker-0-tc1/source'... [INFO] [stderr] done. [INFO] started tweaking git repo https://github.com/oriax11/localserver-rust [INFO] finished tweaking git repo https://github.com/oriax11/localserver-rust [INFO] tweaked toml for git repo https://github.com/oriax11/localserver-rust written to /workspace/builds/worker-0-tc1/source/Cargo.toml [INFO] validating manifest of git repo https://github.com/oriax11/localserver-rust 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/oriax11/localserver-rust 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] Blocking waiting for file lock on package cache [INFO] running `Command { std: "docker" "create" "-v" "/var/lib/crater-agent-workspace/builds/worker-0-tc1/target:/opt/rustwide/target:rw,Z" "-v" "/var/lib/crater-agent-workspace/builds/worker-0-tc1/source:/opt/rustwide/workdir:ro,Z" "-v" "/var/lib/crater-agent-workspace/cargo-home:/opt/rustwide/cargo-home:ro,Z" "-v" "/var/lib/crater-agent-workspace/rustup-home:/opt/rustwide/rustup-home:ro,Z" "-e" "SOURCE_DIR=/opt/rustwide/workdir" "-e" "CARGO_TARGET_DIR=/opt/rustwide/target" "-e" "CARGO_HOME=/opt/rustwide/cargo-home" "-e" "RUSTUP_HOME=/opt/rustwide/rustup-home" "-w" "/opt/rustwide/workdir" "-m" "1610612736" "--user" "0:0" "--network" "none" "ghcr.io/rust-lang/crates-build-env/linux@sha256:d429b63d4308055ea97f60fb1d3dfca48854a00942f1bd2ad806beaf015945ec" "/opt/rustwide/cargo-home/bin/cargo" "+nightly" "metadata" "--no-deps" "--format-version=1", kill_on_drop: false }` [INFO] [stdout] 5980beb02f4cf2540ed53b0d950327dd20e00f0c8defac014d190f9f31d23410 [INFO] running `Command { std: "docker" "start" "-a" "5980beb02f4cf2540ed53b0d950327dd20e00f0c8defac014d190f9f31d23410", kill_on_drop: false }` [INFO] running `Command { std: "docker" "inspect" "5980beb02f4cf2540ed53b0d950327dd20e00f0c8defac014d190f9f31d23410", kill_on_drop: false }` [INFO] running `Command { std: "docker" "rm" "-f" "5980beb02f4cf2540ed53b0d950327dd20e00f0c8defac014d190f9f31d23410", kill_on_drop: false }` [INFO] [stdout] 5980beb02f4cf2540ed53b0d950327dd20e00f0c8defac014d190f9f31d23410 [INFO] running `Command { std: "docker" "create" "-v" "/var/lib/crater-agent-workspace/builds/worker-0-tc1/target:/opt/rustwide/target:rw,Z" "-v" "/var/lib/crater-agent-workspace/builds/worker-0-tc1/source:/opt/rustwide/workdir:ro,Z" "-v" "/var/lib/crater-agent-workspace/cargo-home:/opt/rustwide/cargo-home:ro,Z" "-v" "/var/lib/crater-agent-workspace/rustup-home:/opt/rustwide/rustup-home:ro,Z" "-e" "SOURCE_DIR=/opt/rustwide/workdir" "-e" "CARGO_TARGET_DIR=/opt/rustwide/target" "-e" "CARGO_INCREMENTAL=0" "-e" "RUST_BACKTRACE=full" "-e" "RUSTFLAGS=--cap-lints=forbid" "-e" "RUSTDOCFLAGS=--cap-lints=forbid" "-e" "CARGO_HOME=/opt/rustwide/cargo-home" "-e" "RUSTUP_HOME=/opt/rustwide/rustup-home" "-w" "/opt/rustwide/workdir" "-m" "1610612736" "--user" "0:0" "--network" "none" "ghcr.io/rust-lang/crates-build-env/linux@sha256:d429b63d4308055ea97f60fb1d3dfca48854a00942f1bd2ad806beaf015945ec" "/opt/rustwide/cargo-home/bin/cargo" "+nightly" "clippy" "--frozen" "--all" "--all-targets" "--message-format=json", kill_on_drop: false }` [INFO] [stdout] 1255cf1323df425b470d495f0216a8aa01a978bb1770b6f1a3a2b81aba2de038 [INFO] running `Command { std: "docker" "start" "-a" "1255cf1323df425b470d495f0216a8aa01a978bb1770b6f1a3a2b81aba2de038", kill_on_drop: false }` [INFO] [stderr] Compiling libc v0.2.178 [INFO] [stderr] Compiling getrandom v0.3.4 [INFO] [stderr] Checking mio v1.1.1 [INFO] [stderr] Checking uuid v1.19.0 [INFO] [stderr] Checking localserver v0.1.0 (/opt/rustwide/workdir) [INFO] [stdout] warning: can be more succinctly written as a byte str [INFO] [stdout] --> src/cgi.rs:119:58 [INFO] [stdout] | [INFO] [stdout] 119 | ... let line = line.strip_suffix(&[b'\r']).unwrap_or(line); [INFO] [stdout] | ^^^^^^^^ help: try: `b"\r"` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#byte_char_slices [INFO] [stdout] = note: `#[warn(clippy::byte_char_slices)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: can be more succinctly written as a byte str [INFO] [stdout] --> src/cgi.rs:119:58 [INFO] [stdout] | [INFO] [stdout] 119 | ... let line = line.strip_suffix(&[b'\r']).unwrap_or(line); [INFO] [stdout] | ^^^^^^^^ help: try: `b"\r"` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#byte_char_slices [INFO] [stdout] = note: `#[warn(clippy::byte_char_slices)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: use of `unwrap_or` to construct default value [INFO] [stdout] --> src/cgi.rs:31:40 [INFO] [stdout] | [INFO] [stdout] 31 | body: request.body.clone().unwrap_or(Vec::new()), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_or_default [INFO] [stdout] = note: `#[warn(clippy::unwrap_or_default)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/cgi.rs:97:13 [INFO] [stdout] | [INFO] [stdout] 97 | / if context.method == "POST" && !context.body.is_empty() { [INFO] [stdout] 98 | | if let Some(mut stdin) = child.stdin.take() { [INFO] [stdout] 99 | | if let Err(e) = stdin.write_all(&context.body) { [INFO] [stdout] 100 | | eprintln!("Failed to write body to CGI stdin: {:?}", e); [INFO] [stdout] ... | [INFO] [stdout] 107 | | } [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] 97 ~ if context.method == "POST" && !context.body.is_empty() [INFO] [stdout] 98 ~ && let Some(mut stdin) = child.stdin.take() { [INFO] [stdout] 99 | if let Err(e) = stdin.write_all(&context.body) { [INFO] [stdout] ... [INFO] [stdout] 105 | drop(stdin); [INFO] [stdout] 106 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this loop could be written as a `for` loop [INFO] [stdout] --> src/cgi.rs:117:25 [INFO] [stdout] | [INFO] [stdout] 117 | while let Some(line) = lines.next() { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for line in lines.by_ref()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#while_let_on_iterator [INFO] [stdout] = note: `#[warn(clippy::while_let_on_iterator)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/config.rs:120:5 [INFO] [stdout] | [INFO] [stdout] 120 | / if !first_line.is_empty() { [INFO] [stdout] 121 | | if let Some((key, value)) = first_line.split_once(':') { [INFO] [stdout] 122 | | parse_route_field(&mut route, key, value)?; [INFO] [stdout] 123 | | } [INFO] [stdout] 124 | | } [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 120 ~ if !first_line.is_empty() [INFO] [stdout] 121 ~ && let Some((key, value)) = first_line.split_once(':') { [INFO] [stdout] 122 | parse_route_field(&mut route, key, value)?; [INFO] [stdout] 123 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you should consider adding a `Default` implementation for `HttpRequestBuilder` [INFO] [stdout] --> src/request.rs:44:5 [INFO] [stdout] | [INFO] [stdout] 44 | / pub fn new() -> Self { [INFO] [stdout] 45 | | Self { [INFO] [stdout] 46 | | buffer: Vec::new(), [INFO] [stdout] 47 | | state: ParserState::ParsingHeaders, [INFO] [stdout] ... | [INFO] [stdout] 50 | | } [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] 43 + impl Default for HttpRequestBuilder { [INFO] [stdout] 44 + fn default() -> Self { [INFO] [stdout] 45 + Self::new() [INFO] [stdout] 46 + } [INFO] [stdout] 47 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this boolean expression can be simplified [INFO] [stdout] --> src/request.rs:134:12 [INFO] [stdout] | [INFO] [stdout] 134 | if !headers.get("connection").is_some() { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `headers.get("connection").is_none()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#nonminimal_bool [INFO] [stdout] = note: `#[warn(clippy::nonminimal_bool)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/request.rs:168:9 [INFO] [stdout] | [INFO] [stdout] 168 | / if let Some(transfer_encoding) = headers.get("transfer-encoding") { [INFO] [stdout] 169 | | if transfer_encoding.to_lowercase().contains("chunked") { [INFO] [stdout] 170 | | return BodyType::Chunked { [INFO] [stdout] 171 | | bytes_read: 0, [INFO] [stdout] ... | [INFO] [stdout] 176 | | } [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 168 ~ if let Some(transfer_encoding) = headers.get("transfer-encoding") [INFO] [stdout] 169 ~ && transfer_encoding.to_lowercase().contains("chunked") { [INFO] [stdout] 170 | return BodyType::Chunked { [INFO] [stdout] ... [INFO] [stdout] 174 | }; [INFO] [stdout] 175 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/request.rs:178:9 [INFO] [stdout] | [INFO] [stdout] 178 | / if let Some(content_length) = headers.get("content-length") { [INFO] [stdout] 179 | | if let Ok(length) = content_length.trim().parse::() { [INFO] [stdout] 180 | | return BodyType::ContentLength(length); [INFO] [stdout] 181 | | } [INFO] [stdout] 182 | | } [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 178 ~ if let Some(content_length) = headers.get("content-length") [INFO] [stdout] 179 ~ && let Ok(length) = content_length.trim().parse::() { [INFO] [stdout] 180 | return BodyType::ContentLength(length); [INFO] [stdout] 181 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/request.rs:323:17 [INFO] [stdout] | [INFO] [stdout] 323 | / if hex.len() == 2 { [INFO] [stdout] 324 | | if let Ok(byte) = u8::from_str_radix(&hex, 16) { [INFO] [stdout] 325 | | result.push(byte as char); [INFO] [stdout] 326 | | continue; [INFO] [stdout] 327 | | } [INFO] [stdout] 328 | | } [INFO] [stdout] | |_________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 323 ~ if hex.len() == 2 [INFO] [stdout] 324 ~ && let Ok(byte) = u8::from_str_radix(&hex, 16) { [INFO] [stdout] 325 | result.push(byte as char); [INFO] [stdout] 326 | continue; [INFO] [stdout] 327 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you should consider adding a `Default` implementation for `Router` [INFO] [stdout] --> src/router.rs:10:5 [INFO] [stdout] | [INFO] [stdout] 10 | / pub fn new() -> Self { [INFO] [stdout] 11 | | Router { [INFO] [stdout] 12 | | routes: std::collections::HashMap::new(), [INFO] [stdout] 13 | | } [INFO] [stdout] 14 | | } [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] 9 + impl Default for Router { [INFO] [stdout] 10 + fn default() -> Self { [INFO] [stdout] 11 + Self::new() [INFO] [stdout] 12 + } [INFO] [stdout] 13 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: use of `or_insert_with` to construct default value [INFO] [stdout] --> src/server.rs:78:22 [INFO] [stdout] | [INFO] [stdout] 78 | .or_insert_with(Vec::new) [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_or_default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the variable `token_counter` is used as a loop counter [INFO] [stdout] --> src/server.rs:85:9 [INFO] [stdout] | [INFO] [stdout] 85 | for ((host, port), server_list) in listener_map { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `for (token_counter, ((host, port), server_list)) in listener_map.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] = note: `#[warn(clippy::explicit_counter_loop)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: method `from_str` can be confused for the standard trait method `std::str::FromStr::from_str` [INFO] [stdout] --> src/utils/methods.rs:10:5 [INFO] [stdout] | [INFO] [stdout] 10 | / pub fn from_str(method: &str) -> HttpMethod { [INFO] [stdout] 11 | | match method { [INFO] [stdout] 12 | | "GET" => HttpMethod::GET, [INFO] [stdout] 13 | | "POST" => HttpMethod::POST, [INFO] [stdout] ... | [INFO] [stdout] 17 | | } [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: consider implementing the trait `std::str::FromStr` or choosing a less ambiguous method name [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#should_implement_trait [INFO] [stdout] = note: `#[warn(clippy::should_implement_trait)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: struct `HttpHeaders` has a public `len` method, but no `is_empty` method [INFO] [stdout] --> src/utils/headers.rs:27:5 [INFO] [stdout] | [INFO] [stdout] 27 | pub fn len(&self) -> usize { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_without_is_empty [INFO] [stdout] = note: `#[warn(clippy::len_without_is_empty)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you should consider adding a `Default` implementation for `Session` [INFO] [stdout] --> src/utils/session.rs:19:5 [INFO] [stdout] | [INFO] [stdout] 19 | / pub fn new() -> Self { [INFO] [stdout] 20 | | let id = Uuid::new_v4().to_string(); [INFO] [stdout] 21 | | let now = Instant::now(); [INFO] [stdout] ... | [INFO] [stdout] 29 | | } [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] 18 + impl Default for Session { [INFO] [stdout] 19 + fn default() -> Self { [INFO] [stdout] 20 + Self::new() [INFO] [stdout] 21 + } [INFO] [stdout] 22 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you should consider adding a `Default` implementation for `SessionStore` [INFO] [stdout] --> src/utils/session.rs:62:5 [INFO] [stdout] | [INFO] [stdout] 62 | / pub fn new() -> Self { [INFO] [stdout] 63 | | Self { [INFO] [stdout] 64 | | inner: Rc::new(RefCell::new(HashMap::new())), [INFO] [stdout] 65 | | } [INFO] [stdout] 66 | | } [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] 61 + impl Default for SessionStore { [INFO] [stdout] 62 + fn default() -> Self { [INFO] [stdout] 63 + Self::new() [INFO] [stdout] 64 + } [INFO] [stdout] 65 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: writing `&String` instead of `&str` involves a new object where a slice will do [INFO] [stdout] --> src/response.rs:80:31 [INFO] [stdout] | [INFO] [stdout] 80 | pub fn redirect(location: &String) -> Self { [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] 80 - pub fn redirect(location: &String) -> Self { [INFO] [stdout] 80 + pub fn redirect(location: &str) -> Self { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unnecessary `if let` since only the `Ok` variant of the iterator element is used [INFO] [stdout] --> src/response.rs:119:13 [INFO] [stdout] | [INFO] [stdout] 119 | / for entry in entries { [INFO] [stdout] 120 | | if let Ok(entry) = entry { [INFO] [stdout] 121 | | let file_name = entry.file_name(); [INFO] [stdout] 122 | | let file_name_str = file_name.to_string_lossy(); [INFO] [stdout] ... | [INFO] [stdout] 128 | | } [INFO] [stdout] | |_____________^ [INFO] [stdout] | [INFO] [stdout] help: try `.flatten()` and remove the `if let` statement in the for loop [INFO] [stdout] --> src/response.rs:120:17 [INFO] [stdout] | [INFO] [stdout] 120 | / if let Ok(entry) = entry { [INFO] [stdout] 121 | | let file_name = entry.file_name(); [INFO] [stdout] 122 | | let file_name_str = file_name.to_string_lossy(); [INFO] [stdout] 123 | | listing.push_str(&format!( [INFO] [stdout] ... | [INFO] [stdout] 126 | | )); [INFO] [stdout] 127 | | } [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] 119 ~ for entry in entries.flatten() { [INFO] [stdout] 120 + let file_name = entry.file_name(); [INFO] [stdout] 121 + let file_name_str = file_name.to_string_lossy(); [INFO] [stdout] 122 + listing.push_str(&format!( [INFO] [stdout] 123 + "
  • {}
  • ", [INFO] [stdout] 124 + route_path, file_name_str, file_name_str [INFO] [stdout] 125 + )); [INFO] [stdout] 126 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: use of `unwrap_or` to construct default value [INFO] [stdout] --> src/cgi.rs:31:40 [INFO] [stdout] | [INFO] [stdout] 31 | body: request.body.clone().unwrap_or(Vec::new()), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_or_default [INFO] [stdout] = note: `#[warn(clippy::unwrap_or_default)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this manual char comparison can be written more succinctly [INFO] [stdout] --> src/response.rs:306:19 [INFO] [stdout] | [INFO] [stdout] 306 | .find(|c: char| c == ';' || c == '\r' || c == '\n') [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using an array of `char`: `[';', '\r', '\n']` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_pattern_char_comparison [INFO] [stdout] = note: `#[warn(clippy::manual_pattern_char_comparison)]` 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/handler.rs:30:17 [INFO] [stdout] | [INFO] [stdout] 30 | &cookie, [INFO] [stdout] | ^^^^^^^ help: change this to: `cookie` [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 `if` statement can be collapsed [INFO] [stdout] --> src/cgi.rs:97:13 [INFO] [stdout] | [INFO] [stdout] 97 | / if context.method == "POST" && !context.body.is_empty() { [INFO] [stdout] 98 | | if let Some(mut stdin) = child.stdin.take() { [INFO] [stdout] 99 | | if let Err(e) = stdin.write_all(&context.body) { [INFO] [stdout] 100 | | eprintln!("Failed to write body to CGI stdin: {:?}", e); [INFO] [stdout] ... | [INFO] [stdout] 107 | | } [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] 97 ~ if context.method == "POST" && !context.body.is_empty() [INFO] [stdout] 98 ~ && let Some(mut stdin) = child.stdin.take() { [INFO] [stdout] 99 | if let Err(e) = stdin.write_all(&context.body) { [INFO] [stdout] ... [INFO] [stdout] 105 | drop(stdin); [INFO] [stdout] 106 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/handler.rs:56:29 [INFO] [stdout] | [INFO] [stdout] 56 | match FileResponse::new(&request_path , cookie) { [INFO] [stdout] | ^^^^^^^^^^^^^ help: change this to: `request_path` [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 loop could be written as a `for` loop [INFO] [stdout] --> src/cgi.rs:117:25 [INFO] [stdout] | [INFO] [stdout] 117 | while let Some(line) = lines.next() { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `for line in lines.by_ref()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#while_let_on_iterator [INFO] [stdout] = note: `#[warn(clippy::while_let_on_iterator)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: called `Iterator::last` on a `DoubleEndedIterator`; this will needlessly iterate the entire iterator [INFO] [stdout] --> src/handler.rs:115:32 [INFO] [stdout] | [INFO] [stdout] 115 | let last_segment = request.path.split('/').last().unwrap_or(""); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#double_ended_iterator_last [INFO] [stdout] = note: `#[warn(clippy::double_ended_iterator_last)]` on by default [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 115 - let last_segment = request.path.split('/').last().unwrap_or(""); [INFO] [stdout] 115 + let last_segment = request.path.split('/').next_back().unwrap_or(""); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/config.rs:120:5 [INFO] [stdout] | [INFO] [stdout] 120 | / if !first_line.is_empty() { [INFO] [stdout] 121 | | if let Some((key, value)) = first_line.split_once(':') { [INFO] [stdout] 122 | | parse_route_field(&mut route, key, value)?; [INFO] [stdout] 123 | | } [INFO] [stdout] 124 | | } [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 120 ~ if !first_line.is_empty() [INFO] [stdout] 121 ~ && let Some((key, value)) = first_line.split_once(':') { [INFO] [stdout] 122 | parse_route_field(&mut route, key, value)?; [INFO] [stdout] 123 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/read.rs:142:17 [INFO] [stdout] | [INFO] [stdout] 142 | / if let Some(max) = socket.max_body_size { [INFO] [stdout] 143 | | if socket.request.body_len() > max { [INFO] [stdout] 144 | | socket.body_too_large = true; [INFO] [stdout] 145 | | socket.request.set_state(ParserState::Complete); [INFO] [stdout] ... | [INFO] [stdout] 148 | | } [INFO] [stdout] | |_________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 142 ~ if let Some(max) = socket.max_body_size [INFO] [stdout] 143 ~ && socket.request.body_len() > max { [INFO] [stdout] 144 | socket.body_too_large = true; [INFO] [stdout] 145 | socket.request.set_state(ParserState::Complete); [INFO] [stdout] 146 | return Some(true); [INFO] [stdout] 147 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/read.rs:226:64 [INFO] [stdout] | [INFO] [stdout] 226 | let response_bytes = handle_method_not_allowed(&allowed, &selected_server, &cookie); [INFO] [stdout] | ^^^^^^^^ help: change this to: `allowed` [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/read.rs:226:74 [INFO] [stdout] | [INFO] [stdout] 226 | let response_bytes = handle_method_not_allowed(&allowed, &selected_server, &cookie); [INFO] [stdout] | ^^^^^^^^^^^^^^^^ help: change this to: `selected_server` [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: use of `unwrap_or_else` to construct default value [INFO] [stdout] --> src/read.rs:230:22 [INFO] [stdout] | [INFO] [stdout] 230 | .unwrap_or_else(|| "".to_string()); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_or_default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/read.rs:232:17 [INFO] [stdout] | [INFO] [stdout] 232 | / if let Some(cgi_ext) = &route.cgi { [INFO] [stdout] 233 | | if request.path.ends_with(cgi_ext) { [INFO] [stdout] 234 | | let cgi_context = crate::cgi::CgiContext::from_request(request); [INFO] [stdout] 235 | | if run_cgi(route, cgi_context, &file_path, socket_data) { [INFO] [stdout] ... | [INFO] [stdout] 241 | | } [INFO] [stdout] | |_________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 232 ~ if let Some(cgi_ext) = &route.cgi [INFO] [stdout] 233 ~ && request.path.ends_with(cgi_ext) { [INFO] [stdout] 234 | let cgi_context = crate::cgi::CgiContext::from_request(request); [INFO] [stdout] ... [INFO] [stdout] 239 | } [INFO] [stdout] 240 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/read.rs:244:63 [INFO] [stdout] | [INFO] [stdout] 244 | HttpMethod::GET => handle_get(&file_path, &selected_server, &request, &cookie), [INFO] [stdout] | ^^^^^^^^^^^^^^^^ help: change this to: `selected_server` [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/read.rs:244:81 [INFO] [stdout] | [INFO] [stdout] 244 | HttpMethod::GET => handle_get(&file_path, &selected_server, &request, &cookie), [INFO] [stdout] | ^^^^^^^^ help: change this to: `request` [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/read.rs:246:70 [INFO] [stdout] | [INFO] [stdout] 246 | let response_bytes = handle_post(&file_path, &request, &cookie); [INFO] [stdout] | ^^^^^^^^ help: change this to: `request` [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/read.rs:257:55 [INFO] [stdout] | [INFO] [stdout] 257 | ... handle_method_not_allowed(&allowed, &selected_server, &cookie); [INFO] [stdout] | ^^^^^^^^ help: change this to: `allowed` [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/read.rs:257:65 [INFO] [stdout] | [INFO] [stdout] 257 | ... handle_method_not_allowed(&allowed, &selected_server, &cookie); [INFO] [stdout] | ^^^^^^^^^^^^^^^^ help: change this to: `selected_server` [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 should consider adding a `Default` implementation for `HttpRequestBuilder` [INFO] [stdout] --> src/request.rs:44:5 [INFO] [stdout] | [INFO] [stdout] 44 | / pub fn new() -> Self { [INFO] [stdout] 45 | | Self { [INFO] [stdout] 46 | | buffer: Vec::new(), [INFO] [stdout] 47 | | state: ParserState::ParsingHeaders, [INFO] [stdout] ... | [INFO] [stdout] 50 | | } [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] 43 + impl Default for HttpRequestBuilder { [INFO] [stdout] 44 + fn default() -> Self { [INFO] [stdout] 45 + Self::new() [INFO] [stdout] 46 + } [INFO] [stdout] 47 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this boolean expression can be simplified [INFO] [stdout] --> src/request.rs:134:12 [INFO] [stdout] | [INFO] [stdout] 134 | if !headers.get("connection").is_some() { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `headers.get("connection").is_none()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#nonminimal_bool [INFO] [stdout] = note: `#[warn(clippy::nonminimal_bool)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/request.rs:168:9 [INFO] [stdout] | [INFO] [stdout] 168 | / if let Some(transfer_encoding) = headers.get("transfer-encoding") { [INFO] [stdout] 169 | | if transfer_encoding.to_lowercase().contains("chunked") { [INFO] [stdout] 170 | | return BodyType::Chunked { [INFO] [stdout] 171 | | bytes_read: 0, [INFO] [stdout] ... | [INFO] [stdout] 176 | | } [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 168 ~ if let Some(transfer_encoding) = headers.get("transfer-encoding") [INFO] [stdout] 169 ~ && transfer_encoding.to_lowercase().contains("chunked") { [INFO] [stdout] 170 | return BodyType::Chunked { [INFO] [stdout] ... [INFO] [stdout] 174 | }; [INFO] [stdout] 175 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/request.rs:178:9 [INFO] [stdout] | [INFO] [stdout] 178 | / if let Some(content_length) = headers.get("content-length") { [INFO] [stdout] 179 | | if let Ok(length) = content_length.trim().parse::() { [INFO] [stdout] 180 | | return BodyType::ContentLength(length); [INFO] [stdout] 181 | | } [INFO] [stdout] 182 | | } [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 178 ~ if let Some(content_length) = headers.get("content-length") [INFO] [stdout] 179 ~ && let Ok(length) = content_length.trim().parse::() { [INFO] [stdout] 180 | return BodyType::ContentLength(length); [INFO] [stdout] 181 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/request.rs:323:17 [INFO] [stdout] | [INFO] [stdout] 323 | / if hex.len() == 2 { [INFO] [stdout] 324 | | if let Ok(byte) = u8::from_str_radix(&hex, 16) { [INFO] [stdout] 325 | | result.push(byte as char); [INFO] [stdout] 326 | | continue; [INFO] [stdout] 327 | | } [INFO] [stdout] 328 | | } [INFO] [stdout] | |_________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 323 ~ if hex.len() == 2 [INFO] [stdout] 324 ~ && let Ok(byte) = u8::from_str_radix(&hex, 16) { [INFO] [stdout] 325 | result.push(byte as char); [INFO] [stdout] 326 | continue; [INFO] [stdout] 327 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you should consider adding a `Default` implementation for `Router` [INFO] [stdout] --> src/router.rs:10:5 [INFO] [stdout] | [INFO] [stdout] 10 | / pub fn new() -> Self { [INFO] [stdout] 11 | | Router { [INFO] [stdout] 12 | | routes: std::collections::HashMap::new(), [INFO] [stdout] 13 | | } [INFO] [stdout] 14 | | } [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] 9 + impl Default for Router { [INFO] [stdout] 10 + fn default() -> Self { [INFO] [stdout] 11 + Self::new() [INFO] [stdout] 12 + } [INFO] [stdout] 13 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: use of `or_insert_with` to construct default value [INFO] [stdout] --> src/server.rs:78:22 [INFO] [stdout] | [INFO] [stdout] 78 | .or_insert_with(Vec::new) [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_or_default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the variable `token_counter` is used as a loop counter [INFO] [stdout] --> src/server.rs:85:9 [INFO] [stdout] | [INFO] [stdout] 85 | for ((host, port), server_list) in listener_map { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `for (token_counter, ((host, port), server_list)) in listener_map.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] = note: `#[warn(clippy::explicit_counter_loop)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: method `from_str` can be confused for the standard trait method `std::str::FromStr::from_str` [INFO] [stdout] --> src/utils/methods.rs:10:5 [INFO] [stdout] | [INFO] [stdout] 10 | / pub fn from_str(method: &str) -> HttpMethod { [INFO] [stdout] 11 | | match method { [INFO] [stdout] 12 | | "GET" => HttpMethod::GET, [INFO] [stdout] 13 | | "POST" => HttpMethod::POST, [INFO] [stdout] ... | [INFO] [stdout] 17 | | } [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: consider implementing the trait `std::str::FromStr` or choosing a less ambiguous method name [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#should_implement_trait [INFO] [stdout] = note: `#[warn(clippy::should_implement_trait)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: struct `HttpHeaders` has a public `len` method, but no `is_empty` method [INFO] [stdout] --> src/utils/headers.rs:27:5 [INFO] [stdout] | [INFO] [stdout] 27 | pub fn len(&self) -> usize { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_without_is_empty [INFO] [stdout] = note: `#[warn(clippy::len_without_is_empty)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you should consider adding a `Default` implementation for `Session` [INFO] [stdout] --> src/utils/session.rs:19:5 [INFO] [stdout] | [INFO] [stdout] 19 | / pub fn new() -> Self { [INFO] [stdout] 20 | | let id = Uuid::new_v4().to_string(); [INFO] [stdout] 21 | | let now = Instant::now(); [INFO] [stdout] ... | [INFO] [stdout] 29 | | } [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] 18 + impl Default for Session { [INFO] [stdout] 19 + fn default() -> Self { [INFO] [stdout] 20 + Self::new() [INFO] [stdout] 21 + } [INFO] [stdout] 22 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you should consider adding a `Default` implementation for `SessionStore` [INFO] [stdout] --> src/utils/session.rs:62:5 [INFO] [stdout] | [INFO] [stdout] 62 | / pub fn new() -> Self { [INFO] [stdout] 63 | | Self { [INFO] [stdout] 64 | | inner: Rc::new(RefCell::new(HashMap::new())), [INFO] [stdout] 65 | | } [INFO] [stdout] 66 | | } [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] 61 + impl Default for SessionStore { [INFO] [stdout] 62 + fn default() -> Self { [INFO] [stdout] 63 + Self::new() [INFO] [stdout] 64 + } [INFO] [stdout] 65 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: writing `&String` instead of `&str` involves a new object where a slice will do [INFO] [stdout] --> src/response.rs:80:31 [INFO] [stdout] | [INFO] [stdout] 80 | pub fn redirect(location: &String) -> Self { [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] 80 - pub fn redirect(location: &String) -> Self { [INFO] [stdout] 80 + pub fn redirect(location: &str) -> Self { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unnecessary `if let` since only the `Ok` variant of the iterator element is used [INFO] [stdout] --> src/response.rs:119:13 [INFO] [stdout] | [INFO] [stdout] 119 | / for entry in entries { [INFO] [stdout] 120 | | if let Ok(entry) = entry { [INFO] [stdout] 121 | | let file_name = entry.file_name(); [INFO] [stdout] 122 | | let file_name_str = file_name.to_string_lossy(); [INFO] [stdout] ... | [INFO] [stdout] 128 | | } [INFO] [stdout] | |_____________^ [INFO] [stdout] | [INFO] [stdout] help: try `.flatten()` and remove the `if let` statement in the for loop [INFO] [stdout] --> src/response.rs:120:17 [INFO] [stdout] | [INFO] [stdout] 120 | / if let Ok(entry) = entry { [INFO] [stdout] 121 | | let file_name = entry.file_name(); [INFO] [stdout] 122 | | let file_name_str = file_name.to_string_lossy(); [INFO] [stdout] 123 | | listing.push_str(&format!( [INFO] [stdout] ... | [INFO] [stdout] 126 | | )); [INFO] [stdout] 127 | | } [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] 119 ~ for entry in entries.flatten() { [INFO] [stdout] 120 + let file_name = entry.file_name(); [INFO] [stdout] 121 + let file_name_str = file_name.to_string_lossy(); [INFO] [stdout] 122 + listing.push_str(&format!( [INFO] [stdout] 123 + "
  • {}
  • ", [INFO] [stdout] 124 + route_path, file_name_str, file_name_str [INFO] [stdout] 125 + )); [INFO] [stdout] 126 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this manual char comparison can be written more succinctly [INFO] [stdout] --> src/response.rs:306:19 [INFO] [stdout] | [INFO] [stdout] 306 | .find(|c: char| c == ';' || c == '\r' || c == '\n') [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using an array of `char`: `[';', '\r', '\n']` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_pattern_char_comparison [INFO] [stdout] = note: `#[warn(clippy::manual_pattern_char_comparison)]` 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/handler.rs:30:17 [INFO] [stdout] | [INFO] [stdout] 30 | &cookie, [INFO] [stdout] | ^^^^^^^ help: change this to: `cookie` [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/handler.rs:56:29 [INFO] [stdout] | [INFO] [stdout] 56 | match FileResponse::new(&request_path , cookie) { [INFO] [stdout] | ^^^^^^^^^^^^^ help: change this to: `request_path` [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 `Iterator::last` on a `DoubleEndedIterator`; this will needlessly iterate the entire iterator [INFO] [stdout] --> src/handler.rs:115:32 [INFO] [stdout] | [INFO] [stdout] 115 | let last_segment = request.path.split('/').last().unwrap_or(""); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#double_ended_iterator_last [INFO] [stdout] = note: `#[warn(clippy::double_ended_iterator_last)]` on by default [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 115 - let last_segment = request.path.split('/').last().unwrap_or(""); [INFO] [stdout] 115 + let last_segment = request.path.split('/').next_back().unwrap_or(""); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/read.rs:142:17 [INFO] [stdout] | [INFO] [stdout] 142 | / if let Some(max) = socket.max_body_size { [INFO] [stdout] 143 | | if socket.request.body_len() > max { [INFO] [stdout] 144 | | socket.body_too_large = true; [INFO] [stdout] 145 | | socket.request.set_state(ParserState::Complete); [INFO] [stdout] ... | [INFO] [stdout] 148 | | } [INFO] [stdout] | |_________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 142 ~ if let Some(max) = socket.max_body_size [INFO] [stdout] 143 ~ && socket.request.body_len() > max { [INFO] [stdout] 144 | socket.body_too_large = true; [INFO] [stdout] 145 | socket.request.set_state(ParserState::Complete); [INFO] [stdout] 146 | return Some(true); [INFO] [stdout] 147 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/read.rs:226:64 [INFO] [stdout] | [INFO] [stdout] 226 | let response_bytes = handle_method_not_allowed(&allowed, &selected_server, &cookie); [INFO] [stdout] | ^^^^^^^^ help: change this to: `allowed` [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/read.rs:226:74 [INFO] [stdout] | [INFO] [stdout] 226 | let response_bytes = handle_method_not_allowed(&allowed, &selected_server, &cookie); [INFO] [stdout] | ^^^^^^^^^^^^^^^^ help: change this to: `selected_server` [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: use of `unwrap_or_else` to construct default value [INFO] [stdout] --> src/read.rs:230:22 [INFO] [stdout] | [INFO] [stdout] 230 | .unwrap_or_else(|| "".to_string()); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `unwrap_or_default()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_or_default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/read.rs:232:17 [INFO] [stdout] | [INFO] [stdout] 232 | / if let Some(cgi_ext) = &route.cgi { [INFO] [stdout] 233 | | if request.path.ends_with(cgi_ext) { [INFO] [stdout] 234 | | let cgi_context = crate::cgi::CgiContext::from_request(request); [INFO] [stdout] 235 | | if run_cgi(route, cgi_context, &file_path, socket_data) { [INFO] [stdout] ... | [INFO] [stdout] 241 | | } [INFO] [stdout] | |_________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if [INFO] [stdout] help: collapse nested if block [INFO] [stdout] | [INFO] [stdout] 232 ~ if let Some(cgi_ext) = &route.cgi [INFO] [stdout] 233 ~ && request.path.ends_with(cgi_ext) { [INFO] [stdout] 234 | let cgi_context = crate::cgi::CgiContext::from_request(request); [INFO] [stdout] ... [INFO] [stdout] 239 | } [INFO] [stdout] 240 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/read.rs:244:63 [INFO] [stdout] | [INFO] [stdout] 244 | HttpMethod::GET => handle_get(&file_path, &selected_server, &request, &cookie), [INFO] [stdout] | ^^^^^^^^^^^^^^^^ help: change this to: `selected_server` [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/read.rs:244:81 [INFO] [stdout] | [INFO] [stdout] 244 | HttpMethod::GET => handle_get(&file_path, &selected_server, &request, &cookie), [INFO] [stdout] | ^^^^^^^^ help: change this to: `request` [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/read.rs:246:70 [INFO] [stdout] | [INFO] [stdout] 246 | let response_bytes = handle_post(&file_path, &request, &cookie); [INFO] [stdout] | ^^^^^^^^ help: change this to: `request` [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/read.rs:257:55 [INFO] [stdout] | [INFO] [stdout] 257 | ... handle_method_not_allowed(&allowed, &selected_server, &cookie); [INFO] [stdout] | ^^^^^^^^ help: change this to: `allowed` [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/read.rs:257:65 [INFO] [stdout] | [INFO] [stdout] 257 | ... handle_method_not_allowed(&allowed, &selected_server, &cookie); [INFO] [stdout] | ^^^^^^^^^^^^^^^^ help: change this to: `selected_server` [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] [stderr] Finished `dev` profile [unoptimized + debuginfo] target(s) in 2.97s [INFO] running `Command { std: "docker" "inspect" "1255cf1323df425b470d495f0216a8aa01a978bb1770b6f1a3a2b81aba2de038", kill_on_drop: false }` [INFO] running `Command { std: "docker" "rm" "-f" "1255cf1323df425b470d495f0216a8aa01a978bb1770b6f1a3a2b81aba2de038", kill_on_drop: false }` [INFO] [stdout] 1255cf1323df425b470d495f0216a8aa01a978bb1770b6f1a3a2b81aba2de038