[INFO] cloning repository https://github.com/ferhatgec/gretea [INFO] running `Command { std: "git" "-c" "credential.helper=" "-c" "credential.helper=/workspace/cargo-home/bin/git-credential-null" "clone" "--bare" "https://github.com/ferhatgec/gretea" "/workspace/cache/git-repos/https%3A%2F%2Fgithub.com%2Fferhatgec%2Fgretea", kill_on_drop: false }` [INFO] [stderr] Cloning into bare repository '/workspace/cache/git-repos/https%3A%2F%2Fgithub.com%2Fferhatgec%2Fgretea'... [INFO] running `Command { std: "git" "rev-parse" "HEAD", kill_on_drop: false }` [INFO] [stdout] 814b9be460c3409d2ba7e3bd94e59bc9070852c3 [INFO] linting ferhatgec/gretea against nightly for clippy-nonminimal_bool-denied [INFO] running `Command { std: "git" "clone" "/workspace/cache/git-repos/https%3A%2F%2Fgithub.com%2Fferhatgec%2Fgretea" "/workspace/builds/worker-1-tc1/source", kill_on_drop: false }` [INFO] [stderr] Cloning into '/workspace/builds/worker-1-tc1/source'... [INFO] [stderr] done. [INFO] started tweaking git repo https://github.com/ferhatgec/gretea [INFO] finished tweaking git repo https://github.com/ferhatgec/gretea [INFO] tweaked toml for git repo https://github.com/ferhatgec/gretea written to /workspace/builds/worker-1-tc1/source/Cargo.toml [INFO] validating manifest of git repo https://github.com/ferhatgec/gretea 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/ferhatgec/gretea 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] Updating crates.io index [INFO] [stderr] Downloading crates ... [INFO] [stderr] Downloaded elite v0.1.4 [INFO] running `Command { std: "docker" "create" "-v" "/var/lib/crater-agent-workspace/builds/worker-1-tc1/target:/opt/rustwide/target:rw,Z" "-v" "/var/lib/crater-agent-workspace/builds/worker-1-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] d37868105af1cf59860b621f363574c400d4bbef8325e8d596eb3edc499925d6 [INFO] running `Command { std: "docker" "start" "-a" "d37868105af1cf59860b621f363574c400d4bbef8325e8d596eb3edc499925d6", kill_on_drop: false }` [INFO] running `Command { std: "docker" "inspect" "d37868105af1cf59860b621f363574c400d4bbef8325e8d596eb3edc499925d6", kill_on_drop: false }` [INFO] running `Command { std: "docker" "rm" "-f" "d37868105af1cf59860b621f363574c400d4bbef8325e8d596eb3edc499925d6", kill_on_drop: false }` [INFO] [stdout] d37868105af1cf59860b621f363574c400d4bbef8325e8d596eb3edc499925d6 [INFO] running `Command { std: "docker" "create" "-v" "/var/lib/crater-agent-workspace/builds/worker-1-tc1/target:/opt/rustwide/target:rw,Z" "-v" "/var/lib/crater-agent-workspace/builds/worker-1-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] 10699001bb65bf3a0ce2322da4521d9d9a1e52b982678c7b1d1190b5472aab83 [INFO] running `Command { std: "docker" "start" "-a" "10699001bb65bf3a0ce2322da4521d9d9a1e52b982678c7b1d1190b5472aab83", kill_on_drop: false }` [INFO] [stderr] Checking elite v0.1.4 [INFO] [stderr] Checking gretea v0.1.0 (/opt/rustwide/workdir) [INFO] [stdout] warning: statics have by default a `'static` lifetime [INFO] [stdout] --> src/tokenizer.rs:14:29 [INFO] [stdout] | [INFO] [stdout] 14 | pub static TOKEN_LIST: &'static [char] = &[ [INFO] [stdout] | -^^^^^^^------- help: consider removing `'static`: `&[char]` [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: statics have by default a `'static` lifetime [INFO] [stdout] --> src/tokenizer.rs:35:22 [INFO] [stdout] | [INFO] [stdout] 35 | pub static ESC: &'static str = "\\x1b"; [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] [INFO] [stdout] [INFO] [stdout] warning: unused import: `BTreeMap` [INFO] [stdout] --> src/parser.rs:40:13 [INFO] [stdout] | [INFO] [stdout] 40 | BTreeMap [INFO] [stdout] | ^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unused import: `elite::logger::elite_logger::log` [INFO] [stdout] --> src/parser.rs:45:5 [INFO] [stdout] | [INFO] [stdout] 45 | use elite::logger::elite_logger::log; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this looks like an `else if` but the `else` is missing [INFO] [stdout] --> src/parser.rs:194:14 [INFO] [stdout] | [INFO] [stdout] 194 | } if token.ends_with('\n') { current_line += 1; } [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = note: to remove this lint, add the missing `else` or add a new line before the second `if` [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#possible_missing_else [INFO] [stdout] = note: `#[warn(clippy::possible_missing_else)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: statics have by default a `'static` lifetime [INFO] [stdout] --> src/tokenizer.rs:14:29 [INFO] [stdout] | [INFO] [stdout] 14 | pub static TOKEN_LIST: &'static [char] = &[ [INFO] [stdout] | -^^^^^^^------- help: consider removing `'static`: `&[char]` [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: statics have by default a `'static` lifetime [INFO] [stdout] --> src/tokenizer.rs:35:22 [INFO] [stdout] | [INFO] [stdout] 35 | pub static ESC: &'static str = "\\x1b"; [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] [INFO] [stdout] [INFO] [stdout] warning: unused import: `BTreeMap` [INFO] [stdout] --> src/parser.rs:40:13 [INFO] [stdout] | [INFO] [stdout] 40 | BTreeMap [INFO] [stdout] | ^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unused import: `elite::logger::elite_logger::log` [INFO] [stdout] --> src/parser.rs:45:5 [INFO] [stdout] | [INFO] [stdout] 45 | use elite::logger::elite_logger::log; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this looks like an `else if` but the `else` is missing [INFO] [stdout] --> src/parser.rs:194:14 [INFO] [stdout] | [INFO] [stdout] 194 | } if token.ends_with('\n') { current_line += 1; } [INFO] [stdout] | ^ [INFO] [stdout] | [INFO] [stdout] = note: to remove this lint, add the missing `else` or add a new line before the second `if` [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#possible_missing_else [INFO] [stdout] = note: `#[warn(clippy::possible_missing_else)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unreachable statement [INFO] [stdout] --> src/parser.rs:1080:37 [INFO] [stdout] | [INFO] [stdout] 1057 | ... continue; [INFO] [stdout] | -------- any code following this expression is unreachable [INFO] [stdout] ... [INFO] [stdout] 1080 | ... argument_name.clear(); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^ unreachable statement [INFO] [stdout] | [INFO] [stdout] = note: `#[warn(unreachable_code)]` (part of `#[warn(unused)]`) on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unreachable statement [INFO] [stdout] --> src/parser.rs:1080:37 [INFO] [stdout] | [INFO] [stdout] 1057 | ... continue; [INFO] [stdout] | -------- any code following this expression is unreachable [INFO] [stdout] ... [INFO] [stdout] 1080 | ... argument_name.clear(); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^ unreachable statement [INFO] [stdout] | [INFO] [stdout] = note: `#[warn(unreachable_code)]` (part of `#[warn(unused)]`) on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: variable does not need to be mutable [INFO] [stdout] --> src/parser.rs:105:13 [INFO] [stdout] | [INFO] [stdout] 105 | let mut type_name = String::new(); [INFO] [stdout] | ----^^^^^^^^^ [INFO] [stdout] | | [INFO] [stdout] | help: remove this `mut` [INFO] [stdout] | [INFO] [stdout] = note: `#[warn(unused_mut)]` (part of `#[warn(unused)]`) on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unused variable: `type_name` [INFO] [stdout] --> src/parser.rs:105:13 [INFO] [stdout] | [INFO] [stdout] 105 | let mut type_name = String::new(); [INFO] [stdout] | ^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_type_name` [INFO] [stdout] | [INFO] [stdout] = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: field `unparsed` is never read [INFO] [stdout] --> src/read.rs:24:9 [INFO] [stdout] | [INFO] [stdout] 22 | pub struct GreteaFileData { [INFO] [stdout] | -------------- field in this struct [INFO] [stdout] 23 | pub raw_data : String, [INFO] [stdout] 24 | pub unparsed : Vec, [INFO] [stdout] | ^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: `GreteaFileData` has a derived impl for the trait `Clone`, but this is intentionally ignored during dead code analysis [INFO] [stdout] = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: variant `Info` is never constructed [INFO] [stdout] --> src/log.rs:10:5 [INFO] [stdout] | [INFO] [stdout] 9 | pub enum LogTypes { [INFO] [stdout] | -------- variant in this enum [INFO] [stdout] 10 | Info, [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/read.rs:47:13 [INFO] [stdout] | [INFO] [stdout] 47 | / for line in lines { [INFO] [stdout] 48 | | if let Ok(ip) = line { [INFO] [stdout] 49 | | if is_comment(&ip.as_str()) { continue; } [INFO] [stdout] ... | [INFO] [stdout] 54 | | } [INFO] [stdout] | |_____________^ [INFO] [stdout] | [INFO] [stdout] help: try `.flatten()` and remove the `if let` statement in the for loop [INFO] [stdout] --> src/read.rs:48:17 [INFO] [stdout] | [INFO] [stdout] 48 | / if let Ok(ip) = line { [INFO] [stdout] 49 | | if is_comment(&ip.as_str()) { continue; } [INFO] [stdout] 50 | | [INFO] [stdout] 51 | | raw_data.push(' '); raw_data.push_str(&ip); raw_data.push('\n'); [INFO] [stdout] 52 | | self.lines.push(ip); [INFO] [stdout] 53 | | } [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] 47 ~ for ip in lines.flatten() { [INFO] [stdout] 48 + if is_comment(&ip.as_str()) { continue; } [INFO] [stdout] 49 + [INFO] [stdout] 50 + raw_data.push(' '); raw_data.push_str(&ip); raw_data.push('\n'); [INFO] [stdout] 51 + self.lines.push(ip); [INFO] [stdout] 52 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: useless conversion to the same type: `std::string::String` [INFO] [stdout] --> src/tokenizer.rs:117:37 [INFO] [stdout] | [INFO] [stdout] 117 | let token = String::from(replace(&temporary_tokens[i].to_string())); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `String::from()`: `replace(&temporary_tokens[i].to_string())` [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] [INFO] [stdout] [INFO] [stdout] warning: deref which would be done by auto-deref [INFO] [stdout] --> src/tokenizer.rs:147:39 [INFO] [stdout] | [INFO] [stdout] 147 | data.push_str(&*format!("{}{}", tokens.clone(), if is_seq { [INFO] [stdout] | _______________________________________^ [INFO] [stdout] 148 | | if tokens == "[" { is_seq = false; } [INFO] [stdout] 149 | | "" [INFO] [stdout] 150 | | } else { " " })); [INFO] [stdout] | |_______________________________________^ [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] help: try [INFO] [stdout] | [INFO] [stdout] 147 ~ data.push_str(&format!("{}{}", tokens.clone(), if is_seq { [INFO] [stdout] 148 + if tokens == "[" { is_seq = false; } [INFO] [stdout] 149 + "" [INFO] [stdout] 150 ~ } else { " " })); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: deref which would be done by auto-deref [INFO] [stdout] --> src/tokenizer.rs:156:35 [INFO] [stdout] | [INFO] [stdout] 156 | data.push_str(&*format!("{}{}", tokens.clone(), if tokens[1..] != *ESC { [INFO] [stdout] | ___________________________________^ [INFO] [stdout] 157 | | " " [INFO] [stdout] 158 | | } else { is_seq = true; "" })); continue; [INFO] [stdout] | |_________________________________________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 156 ~ data.push_str(&format!("{}{}", tokens.clone(), if tokens[1..] != *ESC { [INFO] [stdout] 157 + " " [INFO] [stdout] 158 ~ } else { is_seq = true; "" })); continue; [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/tokenizer.rs:179:9 [INFO] [stdout] | [INFO] [stdout] 179 | / return if is_start_of_data(token) || is_end_of_data(token) { [INFO] [stdout] 180 | | true [INFO] [stdout] 181 | | } else { false }; [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] 179 ~ if is_start_of_data(token) || is_end_of_data(token) { [INFO] [stdout] 180 + true [INFO] [stdout] 181 ~ } else { false } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this if-then-else expression returns a bool literal [INFO] [stdout] --> src/tokenizer.rs:179:16 [INFO] [stdout] | [INFO] [stdout] 179 | return if is_start_of_data(token) || is_end_of_data(token) { [INFO] [stdout] | ________________^ [INFO] [stdout] 180 | | true [INFO] [stdout] 181 | | } else { false }; [INFO] [stdout] | |________________________^ help: you can reduce it to: `is_start_of_data(token) || is_end_of_data(token)` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_bool [INFO] [stdout] = note: `#[warn(clippy::needless_bool)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/tokenizer.rs:185:9 [INFO] [stdout] | [INFO] [stdout] 185 | / return if token.trim_start().starts_with('"') { [INFO] [stdout] 186 | | true [INFO] [stdout] 187 | | } else { false }; [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] 185 ~ if token.trim_start().starts_with('"') { [INFO] [stdout] 186 + true [INFO] [stdout] 187 ~ } else { false } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this if-then-else expression returns a bool literal [INFO] [stdout] --> src/tokenizer.rs:185:16 [INFO] [stdout] | [INFO] [stdout] 185 | return if token.trim_start().starts_with('"') { [INFO] [stdout] | ________________^ [INFO] [stdout] 186 | | true [INFO] [stdout] 187 | | } else { false }; [INFO] [stdout] | |________________________^ help: you can reduce it to: `token.trim_start().starts_with('"')` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_bool [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/tokenizer.rs:195:9 [INFO] [stdout] | [INFO] [stdout] 195 | / return if token.ends_with('"') { [INFO] [stdout] 196 | | true [INFO] [stdout] 197 | | } else { false }; [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] 195 ~ if token.ends_with('"') { [INFO] [stdout] 196 + true [INFO] [stdout] 197 ~ } else { false } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this if-then-else expression returns a bool literal [INFO] [stdout] --> src/tokenizer.rs:195:16 [INFO] [stdout] | [INFO] [stdout] 195 | return if token.ends_with('"') { [INFO] [stdout] | ________________^ [INFO] [stdout] 196 | | true [INFO] [stdout] 197 | | } else { false }; [INFO] [stdout] | |________________________^ help: you can reduce it to: `token.ends_with('"')` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_bool [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/tokenizer.rs:205:9 [INFO] [stdout] | [INFO] [stdout] 205 | / return if token.starts_with('/') && token.chars().nth(1).unwrap() == '/' { [INFO] [stdout] 206 | | true [INFO] [stdout] 207 | | } else { false }; [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] 205 ~ if token.starts_with('/') && token.chars().nth(1).unwrap() == '/' { [INFO] [stdout] 206 + true [INFO] [stdout] 207 ~ } else { false } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this if-then-else expression returns a bool literal [INFO] [stdout] --> src/tokenizer.rs:205:16 [INFO] [stdout] | [INFO] [stdout] 205 | return if token.starts_with('/') && token.chars().nth(1).unwrap() == '/' { [INFO] [stdout] | ________________^ [INFO] [stdout] 206 | | true [INFO] [stdout] 207 | | } else { false }; [INFO] [stdout] | |________________________^ help: you can reduce it to: `token.starts_with('/') && token.chars().nth(1).unwrap() == '/'` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_bool [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: writing `&String` instead of `&str` involves a new object where a slice will do [INFO] [stdout] --> src/tokenizer.rs:210:32 [INFO] [stdout] | [INFO] [stdout] 210 | pub fn replace_with(token: &String, character: char) -> String { [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] 210 - pub fn replace_with(token: &String, character: char) -> String { [INFO] [stdout] 210 + pub fn replace_with(token: &str, character: char) -> String { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `impl` can be derived [INFO] [stdout] --> src/ast.rs:282:1 [INFO] [stdout] | [INFO] [stdout] 282 | / impl Default for GreteaVariableList { [INFO] [stdout] 283 | | fn default() -> Self { [INFO] [stdout] 284 | | GreteaVariableList { [INFO] [stdout] 285 | | variable_list: vec![] [INFO] [stdout] ... | [INFO] [stdout] 288 | | } [INFO] [stdout] | |_^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derivable_impls [INFO] [stdout] = note: `#[warn(clippy::derivable_impls)]` on by default [INFO] [stdout] help: replace the manual implementation with a derive attribute [INFO] [stdout] | [INFO] [stdout] 161 + #[derive(Default)] [INFO] [stdout] 162 | pub struct GreteaVariableList { [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/ast.rs:313:30 [INFO] [stdout] | [INFO] [stdout] 313 | pub fn from_module(data: &String) -> String { [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] 313 - pub fn from_module(data: &String) -> String { [INFO] [stdout] 313 + pub fn from_module(data: &str) -> String { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this boolean expression can be simplified [INFO] [stdout] --> src/parser.rs:213:20 [INFO] [stdout] | [INFO] [stdout] 213 | if !get_alias_data.is_none() { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `get_alias_data.is_some()` [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: called `unwrap` on `get_alias_data` after checking its variant with `is_none` [INFO] [stdout] --> src/parser.rs:214:29 [INFO] [stdout] | [INFO] [stdout] 213 | if !get_alias_data.is_none() { [INFO] [stdout] | ------------------------ the check is happening here [INFO] [stdout] 214 | token = get_alias_data.unwrap().clone(); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: try using `match` [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_unwrap [INFO] [stdout] = note: `#[warn(clippy::unnecessary_unwrap)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do [INFO] [stdout] --> src/parser.rs:57:37 [INFO] [stdout] | [INFO] [stdout] 57 | pub fn parse(&mut self, tokens: &Vec) -> GreteaCodegen { [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] 57 ~ pub fn parse(&mut self, tokens: &[String]) -> GreteaCodegen { [INFO] [stdout] 58 | let mut codegen = GreteaCodegen { [INFO] [stdout] ... [INFO] [stdout] 186 | [INFO] [stdout] 187 ~ for mut token in tokens.to_owned() { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/parser.rs:204:18 [INFO] [stdout] | [INFO] [stdout] 204 | else if token.starts_with('"') { [INFO] [stdout] | __________________^ [INFO] [stdout] 205 | | if !token.trim_end().ends_with('"') { [INFO] [stdout] 206 | | is_get_data = true; get_data.push_str(token.clone().as_str()); continue; [INFO] [stdout] 207 | | } [INFO] [stdout] 208 | | } [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] 204 ~ else if token.starts_with('"') [INFO] [stdout] 205 ~ && !token.trim_end().ends_with('"') { [INFO] [stdout] 206 | is_get_data = true; get_data.push_str(token.clone().as_str()); continue; [INFO] [stdout] 207 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: variable does not need to be mutable [INFO] [stdout] --> src/parser.rs:105:13 [INFO] [stdout] | [INFO] [stdout] 105 | let mut type_name = String::new(); [INFO] [stdout] | ----^^^^^^^^^ [INFO] [stdout] | | [INFO] [stdout] | help: remove this `mut` [INFO] [stdout] | [INFO] [stdout] = note: `#[warn(unused_mut)]` (part of `#[warn(unused)]`) on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/parser.rs:250:13 [INFO] [stdout] | [INFO] [stdout] 250 | / if matched_type == GreteaKeywords::Type { [INFO] [stdout] 251 | | if !is_fn_call && !is_var_data { [INFO] [stdout] 252 | | matched_type = GreteaKeywords::Undefined; [INFO] [stdout] 253 | | } [INFO] [stdout] 254 | | } [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] 250 ~ if matched_type == GreteaKeywords::Type [INFO] [stdout] 251 ~ && !is_fn_call && !is_var_data { [INFO] [stdout] 252 | matched_type = GreteaKeywords::Undefined; [INFO] [stdout] 253 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: deref which would be done by auto-deref [INFO] [stdout] --> src/parser.rs:380:52 [INFO] [stdout] | [INFO] [stdout] 380 | ... variable_type.push_str(&*token.clone()); [INFO] [stdout] | ^^^^^^^^^^^^^^^ help: try: `&token.clone()` [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: unused variable: `type_name` [INFO] [stdout] --> src/parser.rs:105:13 [INFO] [stdout] | [INFO] [stdout] 105 | let mut type_name = String::new(); [INFO] [stdout] | ^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_type_name` [INFO] [stdout] | [INFO] [stdout] = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: deref which would be done by auto-deref [INFO] [stdout] --> src/parser.rs:383:47 [INFO] [stdout] | [INFO] [stdout] 383 | ... var_data.push_str(&*token.clone()); [INFO] [stdout] | ^^^^^^^^^^^^^^^ help: try: `&token.clone()` [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: calling `push_str()` using a single-character string literal [INFO] [stdout] --> src/parser.rs:424:25 [INFO] [stdout] | [INFO] [stdout] 424 | return_val.push_str("["); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `push` with a character literal: `return_val.push('[')` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_char_add_str [INFO] [stdout] = note: `#[warn(clippy::single_char_add_str)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: calling `push_str()` using a single-character string literal [INFO] [stdout] --> src/parser.rs:442:25 [INFO] [stdout] | [INFO] [stdout] 442 | return_val.push_str("]"); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `push` with a character literal: `return_val.push(']')` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_char_add_str [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `GreteaCompileType` which implements the `Copy` trait [INFO] [stdout] --> src/parser.rs:471:45 [INFO] [stdout] | [INFO] [stdout] 471 | ... __type: compile_config.clone(), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `compile_config` [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 `if` statement can be collapsed [INFO] [stdout] --> src/parser.rs:574:21 [INFO] [stdout] | [INFO] [stdout] 574 | / if !is_runtime || !is_cpp_linker { [INFO] [stdout] 575 | | if is_preprocessor { [INFO] [stdout] 576 | | is_set = true; continue; [INFO] [stdout] 577 | | } [INFO] [stdout] 578 | | } [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] 574 ~ if (!is_runtime || !is_cpp_linker) { [INFO] [stdout] 575 ~ && is_preprocessor { [INFO] [stdout] 576 | is_set = true; continue; [INFO] [stdout] 577 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: deref which would be done by auto-deref [INFO] [stdout] --> src/parser.rs:621:55 [INFO] [stdout] | [INFO] [stdout] 621 | ... compile_data.push_str(&*format!("{} ", from_module(&token))); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&format!("{} ", from_module(&token))` [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/parser.rs:702:45 [INFO] [stdout] | [INFO] [stdout] 702 | ... &*token, [INFO] [stdout] | ^^^^^^^ help: try: `&token` [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/parser.rs:709:45 [INFO] [stdout] | [INFO] [stdout] 709 | ... &*token, [INFO] [stdout] | ^^^^^^^ help: try: `&token` [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 `if` statement can be collapsed [INFO] [stdout] --> src/parser.rs:719:25 [INFO] [stdout] | [INFO] [stdout] 719 | / if is_unsafe || is_safe { [INFO] [stdout] 720 | | if token == "{" { continue; } [INFO] [stdout] 721 | | } [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] 719 ~ if (is_unsafe || is_safe) { [INFO] [stdout] 720 ~ && token == "{" { continue; } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this if-then-else expression will always return false [INFO] [stdout] --> src/parser.rs:778:57 [INFO] [stdout] | [INFO] [stdout] 778 | ... is_struct_generic = if is_struct_generic { false } else { false }; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_bool [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` has identical blocks [INFO] [stdout] --> src/parser.rs:778:78 [INFO] [stdout] | [INFO] [stdout] 778 | ... is_struct_generic = if is_struct_generic { false } else { false }; [INFO] [stdout] | ^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] note: same as this [INFO] [stdout] --> src/parser.rs:778:93 [INFO] [stdout] | [INFO] [stdout] 778 | ... is_struct_generic = if is_struct_generic { false } else { false }; [INFO] [stdout] | ^^^^^^^^^ [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#if_same_then_else [INFO] [stdout] = note: `#[warn(clippy::if_same_then_else)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/parser.rs:803:37 [INFO] [stdout] | [INFO] [stdout] 803 | / ... if !struct_member_type.is_empty() { [INFO] [stdout] 804 | | ... if token.ends_with('\n') || token.ends_with(',') || token.ends_with('\\') { [INFO] [stdout] 805 | | ... codegen.variable_definition(&struct_member_default, &struct_member_type, [INFO] [stdout] 806 | | ... &struct_member_name, struct_member_immutable); [INFO] [stdout] ... | [INFO] [stdout] 822 | | ... } [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] 803 ~ if !struct_member_type.is_empty() [INFO] [stdout] 804 ~ && (token.ends_with('\n') || token.ends_with(',') || token.ends_with('\\')) { [INFO] [stdout] 805 | codegen.variable_definition(&struct_member_default, &struct_member_type, [INFO] [stdout] ... [INFO] [stdout] 820 | continue; [INFO] [stdout] 821 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: called `Iterator::last` on a `DoubleEndedIterator`; this will needlessly iterate the entire iterator [INFO] [stdout] --> src/parser.rs:932:51 [INFO] [stdout] | [INFO] [stdout] 932 | ... let __token = token.split('#').last().unwrap().trim().to_string(); [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] 932 - let __token = token.split('#').last().unwrap().trim().to_string(); [INFO] [stdout] 932 + let __token = token.split('#').next_back().unwrap().trim().to_string(); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: deref which would be done by auto-deref [INFO] [stdout] --> src/parser.rs:1000:49 [INFO] [stdout] | [INFO] [stdout] 1000 | ... &*token, [INFO] [stdout] | ^^^^^^^ help: try: `&token` [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 `if` statement can be collapsed [INFO] [stdout] --> src/parser.rs:1060:45 [INFO] [stdout] | [INFO] [stdout] 1060 | / ... if is_expandable { [INFO] [stdout] 1061 | | ... if argument_value == fn_generic { [INFO] [stdout] 1062 | | ... argument_value.push_str("..."); [INFO] [stdout] 1063 | | ... } [INFO] [stdout] 1064 | | ... } [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] 1060 ~ if is_expandable [INFO] [stdout] 1061 ~ && argument_value == fn_generic { [INFO] [stdout] 1062 | argument_value.push_str("..."); [INFO] [stdout] 1063 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: called `Iterator::last` on a `DoubleEndedIterator`; this will needlessly iterate the entire iterator [INFO] [stdout] --> src/parser.rs:1095:39 [INFO] [stdout] | [INFO] [stdout] 1095 | ... fn_name = token.split('#').last().unwrap().to_string(); [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] help: try [INFO] [stdout] | [INFO] [stdout] 1095 - fn_name = token.split('#').last().unwrap().to_string(); [INFO] [stdout] 1095 + fn_name = token.split('#').next_back().unwrap().to_string(); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/parser.rs:1139:49 [INFO] [stdout] | [INFO] [stdout] 1139 | / ... if !var_struct_init_data.is_empty() { [INFO] [stdout] 1140 | | ... if token == "," || token.ends_with('\n') { [INFO] [stdout] 1141 | | ... var_data.push_str(format!(".{}={},", var_struct_init_name, [INFO] [stdout] 1142 | | ... var_struct_init_data).as_str()); [INFO] [stdout] ... | [INFO] [stdout] 1147 | | ... } [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] 1139 ~ if !var_struct_init_data.is_empty() [INFO] [stdout] 1140 ~ && (token == "," || token.ends_with('\n')) { [INFO] [stdout] 1141 | var_data.push_str(format!(".{}={},", var_struct_init_name, [INFO] [stdout] ... [INFO] [stdout] 1145 | continue; [INFO] [stdout] 1146 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/parser.rs:1225:29 [INFO] [stdout] | [INFO] [stdout] 1225 | / ... if is_for_variable { [INFO] [stdout] 1226 | | ... if is_for_in { [INFO] [stdout] 1227 | | ... for_iter = token.clone(); [INFO] [stdout] 1228 | | ... codegen.for_iter(&for_var, &for_iter); [INFO] [stdout] ... | [INFO] [stdout] 1238 | | ... } [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] 1225 ~ if is_for_variable [INFO] [stdout] 1226 ~ && is_for_in { [INFO] [stdout] 1227 | for_iter = token.clone(); [INFO] [stdout] ... [INFO] [stdout] 1236 | continue; [INFO] [stdout] 1237 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: called `Iterator::last` on a `DoubleEndedIterator`; this will needlessly iterate the entire iterator [INFO] [stdout] --> src/parser.rs:1303:46 [INFO] [stdout] | [INFO] [stdout] 1303 | let function_token = token.clone().split('#').last().unwrap().to_string(); [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] help: try [INFO] [stdout] | [INFO] [stdout] 1303 - let function_token = token.clone().split('#').last().unwrap().to_string(); [INFO] [stdout] 1303 + let function_token = token.clone().split('#').next_back().unwrap().to_string(); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: called `Iterator::last` on a `DoubleEndedIterator`; this will needlessly iterate the entire iterator [INFO] [stdout] --> src/parser.rs:1307:54 [INFO] [stdout] | [INFO] [stdout] 1307 | ... let function_token = token.clone().split('.').last().unwrap().to_string(); [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] help: try [INFO] [stdout] | [INFO] [stdout] 1307 - let function_token = token.clone().split('.').last().unwrap().to_string(); [INFO] [stdout] 1307 + let function_token = token.clone().split('.').next_back().unwrap().to_string(); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: called `Iterator::last` on a `DoubleEndedIterator`; this will needlessly iterate the entire iterator [INFO] [stdout] --> src/parser.rs:1316:36 [INFO] [stdout] | [INFO] [stdout] 1316 | ... if name.split('#').last().unwrap().trim() == function_token.trim() { [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] help: try [INFO] [stdout] | [INFO] [stdout] 1316 - if name.split('#').last().unwrap().trim() == function_token.trim() { [INFO] [stdout] 1316 + if name.split('#').next_back().unwrap().trim() == function_token.trim() { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: field `unparsed` is never read [INFO] [stdout] --> src/read.rs:24:9 [INFO] [stdout] | [INFO] [stdout] 22 | pub struct GreteaFileData { [INFO] [stdout] | -------------- field in this struct [INFO] [stdout] 23 | pub raw_data : String, [INFO] [stdout] 24 | pub unparsed : Vec, [INFO] [stdout] | ^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: `GreteaFileData` has a derived impl for the trait `Clone`, but this is intentionally ignored during dead code analysis [INFO] [stdout] = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: variant `Info` is never constructed [INFO] [stdout] --> src/log.rs:10:5 [INFO] [stdout] | [INFO] [stdout] 9 | pub enum LogTypes { [INFO] [stdout] | -------- variant in this enum [INFO] [stdout] 10 | Info, [INFO] [stdout] | ^^^^ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: called `Iterator::last` on a `DoubleEndedIterator`; this will needlessly iterate the entire iterator [INFO] [stdout] --> src/parser.rs:1383:40 [INFO] [stdout] | [INFO] [stdout] 1383 | ... || token.split('.').last().unwrap() == variable.__name { [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] help: try [INFO] [stdout] | [INFO] [stdout] 1383 - || token.split('.').last().unwrap() == variable.__name { [INFO] [stdout] 1383 + || token.split('.').next_back().unwrap() == variable.__name { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: useless use of `format!` [INFO] [stdout] --> src/parser.rs:1385:51 [INFO] [stdout] | [INFO] [stdout] 1385 | ... line.push_str(format!("{}", token.clone()).as_str()); break; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `token.clone().to_string()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_format [INFO] [stdout] = note: `#[warn(clippy::useless_format)]` 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/read.rs:47:13 [INFO] [stdout] | [INFO] [stdout] 47 | / for line in lines { [INFO] [stdout] 48 | | if let Ok(ip) = line { [INFO] [stdout] 49 | | if is_comment(&ip.as_str()) { continue; } [INFO] [stdout] ... | [INFO] [stdout] 54 | | } [INFO] [stdout] | |_____________^ [INFO] [stdout] | [INFO] [stdout] help: try `.flatten()` and remove the `if let` statement in the for loop [INFO] [stdout] --> src/read.rs:48:17 [INFO] [stdout] | [INFO] [stdout] 48 | / if let Ok(ip) = line { [INFO] [stdout] 49 | | if is_comment(&ip.as_str()) { continue; } [INFO] [stdout] 50 | | [INFO] [stdout] 51 | | raw_data.push(' '); raw_data.push_str(&ip); raw_data.push('\n'); [INFO] [stdout] 52 | | self.lines.push(ip); [INFO] [stdout] 53 | | } [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] 47 ~ for ip in lines.flatten() { [INFO] [stdout] 48 + if is_comment(&ip.as_str()) { continue; } [INFO] [stdout] 49 + [INFO] [stdout] 50 + raw_data.push(' '); raw_data.push_str(&ip); raw_data.push('\n'); [INFO] [stdout] 51 + self.lines.push(ip); [INFO] [stdout] 52 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: deref which would be done by auto-deref [INFO] [stdout] --> src/cg.rs:40:17 [INFO] [stdout] | [INFO] [stdout] 40 | &*format!("#{} {}\n", "include", subdirectory)); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&format!("#{} {}\n", "include", subdirectory)` [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/cg.rs:59:13 [INFO] [stdout] | [INFO] [stdout] 59 | / ... &*format!("#{}{}{}.hpp{}\n", "include", [INFO] [stdout] 60 | | ... if is_stl { '"' } else { '"' }, dir.replace('\n', "").split('/').last().unwrap(), if is_stl { '"' } else { '"' })); [INFO] [stdout] | |_________________________________________________________________________________________________________________________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 59 ~ &format!("#{}{}{}.hpp{}\n", "include", [INFO] [stdout] 60 ~ if is_stl { '"' } else { '"' }, dir.replace('\n', "").split('/').last().unwrap(), if is_stl { '"' } else { '"' })); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` has identical blocks [INFO] [stdout] --> src/cg.rs:60:33 [INFO] [stdout] | [INFO] [stdout] 60 | ... if is_stl { '"' } else { '"' }, dir.replace('\n', "").split('/').last().unwrap(), if is_stl { '"' } else { '"' })); [INFO] [stdout] | ^^^^^^^ [INFO] [stdout] | [INFO] [stdout] note: same as this [INFO] [stdout] --> src/cg.rs:60:46 [INFO] [stdout] | [INFO] [stdout] 60 | ... if is_stl { '"' } else { '"' }, dir.replace('\n', "").split('/').last().unwrap(), if is_stl { '"' } 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: called `Iterator::last` on a `DoubleEndedIterator`; this will needlessly iterate the entire iterator [INFO] [stdout] --> src/cg.rs:60:55 [INFO] [stdout] | [INFO] [stdout] 60 | ... if is_stl { '"' } else { '"' }, dir.replace('\n', "").split('/').last().unwrap(), if is_stl { '"' } else { '"' })); [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] help: try [INFO] [stdout] | [INFO] [stdout] 60 - if is_stl { '"' } else { '"' }, dir.replace('\n', "").split('/').last().unwrap(), if is_stl { '"' } else { '"' })); [INFO] [stdout] 60 + if is_stl { '"' } else { '"' }, dir.replace('\n', "").split('/').next_back().unwrap(), if is_stl { '"' } else { '"' })); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` has identical blocks [INFO] [stdout] --> src/cg.rs:60:115 [INFO] [stdout] | [INFO] [stdout] 60 | ... if is_stl { '"' } else { '"' }, dir.replace('\n', "").split('/').last().unwrap(), if is_stl { '"' } else { '"' })); [INFO] [stdout] | ^^^^^^^ [INFO] [stdout] | [INFO] [stdout] note: same as this [INFO] [stdout] --> src/cg.rs:60:128 [INFO] [stdout] | [INFO] [stdout] 60 | ... if is_stl { '"' } else { '"' }, dir.replace('\n', "").split('/').last().unwrap(), if is_stl { '"' } else { '"' })); [INFO] [stdout] | ^^^^^^^ [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#if_same_then_else [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this function has too many arguments (8/7) [INFO] [stdout] --> src/cg.rs:63:5 [INFO] [stdout] | [INFO] [stdout] 63 | / pub fn function(&mut self, [INFO] [stdout] 64 | | parser : &mut GreteaParser, [INFO] [stdout] 65 | | args : &Vec, [INFO] [stdout] 66 | | name : &String, [INFO] [stdout] ... | [INFO] [stdout] 71 | | is_void : bool) { [INFO] [stdout] | |_____________________________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments [INFO] [stdout] = note: `#[warn(clippy::too_many_arguments)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do [INFO] [stdout] --> src/cg.rs:65:33 [INFO] [stdout] | [INFO] [stdout] 65 | args : &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] 65 ~ args : &[GreteaFunctionArgument], [INFO] [stdout] 66 | name : &String, [INFO] [stdout] ... [INFO] [stdout] 80 | __function_return_type: return_val.clone(), [INFO] [stdout] 81 ~ __function_arguments : args.to_owned() [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: useless use of `format!` [INFO] [stdout] --> src/cg.rs:87:25 [INFO] [stdout] | [INFO] [stdout] 87 | arguments = format!("int argc, char** argv"); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `"int argc, char** argv".to_string()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_format [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: deref which would be done by auto-deref [INFO] [stdout] --> src/cg.rs:91:36 [INFO] [stdout] | [INFO] [stdout] 91 | arguments.push_str(&*format!("{} {},", map.__arg_type.clone(), map.__arg_name.clone())); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&format!("{} {},", map.__arg_type.clone(), map.__arg_name.clone())` [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/cg.rs:96:33 [INFO] [stdout] | [INFO] [stdout] 96 | self.generated.push_str(&*format!("{} {}({}) {}\n", [INFO] [stdout] | _________________________________^ [INFO] [stdout] 97 | | return_val, name, arguments, if is_void { [INFO] [stdout] 98 | | "{" [INFO] [stdout] 99 | | } else { "" })); [INFO] [stdout] | |__________________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 96 ~ self.generated.push_str(&format!("{} {}({}) {}\n", [INFO] [stdout] 97 + return_val, name, arguments, if is_void { [INFO] [stdout] 98 + "{" [INFO] [stdout] 99 ~ } else { "" })); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do [INFO] [stdout] --> src/cg.rs:102:43 [INFO] [stdout] | [INFO] [stdout] 102 | pub fn function_call(&mut self, args: &Vec, name: &String, is_unpack: bool) { [INFO] [stdout] | ^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg [INFO] [stdout] help: change this to [INFO] [stdout] | [INFO] [stdout] 102 - pub fn function_call(&mut self, args: &Vec, name: &String, is_unpack: bool) { [INFO] [stdout] 102 + pub fn function_call(&mut self, args: &[String], name: &String, is_unpack: bool) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: taken reference of right operand [INFO] [stdout] --> src/cg.rs:105:12 [INFO] [stdout] | [INFO] [stdout] 105 | if name != &"main" { [INFO] [stdout] | ^^^^^^^^------- [INFO] [stdout] | | [INFO] [stdout] | help: use the right value directly: `"main"` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#op_ref [INFO] [stdout] = note: `#[warn(clippy::op_ref)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` can be collapsed into the outer `match` [INFO] [stdout] --> src/cg.rs:116:31 [INFO] [stdout] | [INFO] [stdout] 116 | "]" => { if arguments.chars().last().unwrap() == ',' { arguments.pop(); } }, [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] 116 - "]" => { if arguments.chars().last().unwrap() == ',' { arguments.pop(); } }, [INFO] [stdout] 116 + "]" if arguments.chars().last().unwrap() == ',' => { arguments.pop(); }, [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you should use the `ends_with` method [INFO] [stdout] --> src/cg.rs:116:34 [INFO] [stdout] | [INFO] [stdout] 116 | "]" => { if arguments.chars().last().unwrap() == ',' { arguments.pop(); } }, [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `arguments.ends_with(',')` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#chars_last_cmp [INFO] [stdout] = note: `#[warn(clippy::chars_last_cmp)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: deref which would be done by auto-deref [INFO] [stdout] --> src/cg.rs:120:36 [INFO] [stdout] | [INFO] [stdout] 120 | arguments.push_str(&*format!("{},", arg)); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^ help: try: `&format!("{},", arg)` [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 `if` can be collapsed into the outer `match` [INFO] [stdout] --> src/cg.rs:131:30 [INFO] [stdout] | [INFO] [stdout] 131 | "]" => { if arguments.chars().last().unwrap() == ',' { arguments.pop(); } }, [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] 131 - "]" => { if arguments.chars().last().unwrap() == ',' { arguments.pop(); } }, [INFO] [stdout] 131 + "]" if arguments.chars().last().unwrap() == ',' => { arguments.pop(); }, [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you should use the `ends_with` method [INFO] [stdout] --> src/cg.rs:131:33 [INFO] [stdout] | [INFO] [stdout] 131 | "]" => { if arguments.chars().last().unwrap() == ',' { arguments.pop(); } }, [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `arguments.ends_with(',')` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#chars_last_cmp [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you should use the `ends_with` method [INFO] [stdout] --> src/cg.rs:134:43 [INFO] [stdout] | [INFO] [stdout] 134 | } if !arguments.is_empty() && arguments.chars().last().unwrap() == ',' { arguments.pop(); } [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `arguments.ends_with(',')` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#chars_last_cmp [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: deref which would be done by auto-deref [INFO] [stdout] --> src/cg.rs:137:33 [INFO] [stdout] | [INFO] [stdout] 137 | self.generated.push_str(&*format!("{}{}({}){};\n", if is_unpack { [INFO] [stdout] | _________________________________^ [INFO] [stdout] 138 | | "(" [INFO] [stdout] 139 | | } else { "" }, name, arguments, if is_unpack { [INFO] [stdout] 140 | | ", ...)" [INFO] [stdout] 141 | | } else { "" })); [INFO] [stdout] | |______________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 137 ~ self.generated.push_str(&format!("{}{}({}){};\n", if is_unpack { [INFO] [stdout] 138 + "(" [INFO] [stdout] 139 + } else { "" }, name, arguments, if is_unpack { [INFO] [stdout] 140 + ", ...)" [INFO] [stdout] 141 ~ } else { "" })); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: deref which would be done by auto-deref [INFO] [stdout] --> src/cg.rs:147:33 [INFO] [stdout] | [INFO] [stdout] 147 | self.generated.push_str(&*format!("{} {} {} {}\n", if !is_mut { [INFO] [stdout] | _________________________________^ [INFO] [stdout] 148 | | "const" [INFO] [stdout] 149 | | } else { "" }, if var_type.is_empty() { [INFO] [stdout] 150 | | "auto" [INFO] [stdout] ... | [INFO] [stdout] 154 | | __data.as_str() [INFO] [stdout] 155 | | })); [INFO] [stdout] | |__________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 147 ~ self.generated.push_str(&format!("{} {} {} {}\n", if !is_mut { [INFO] [stdout] 148 + "const" [INFO] [stdout] 149 + } else { "" }, if var_type.is_empty() { [INFO] [stdout] 150 + "auto" [INFO] [stdout] 151 + } else { var_type }, name, if data.is_empty() { [INFO] [stdout] 152 + ";" [INFO] [stdout] 153 + } else { [INFO] [stdout] 154 + __data.as_str() [INFO] [stdout] 155 ~ })); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: deref which would be done by auto-deref [INFO] [stdout] --> src/cg.rs:159:33 [INFO] [stdout] | [INFO] [stdout] 159 | self.generated.push_str(&*format!("#define {} {}\n", name, if !data.is_empty() { [INFO] [stdout] | _________________________________^ [INFO] [stdout] 160 | | data [INFO] [stdout] 161 | | } else { "0" })); [INFO] [stdout] | |_______________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 159 ~ self.generated.push_str(&format!("#define {} {}\n", name, if !data.is_empty() { [INFO] [stdout] 160 + data [INFO] [stdout] 161 ~ } else { "0" })); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: useless conversion to the same type: `std::string::String` [INFO] [stdout] --> src/cg.rs:170:33 [INFO] [stdout] | [INFO] [stdout] 170 | let mut statement = String::from( [INFO] [stdout] | _________________________________^ [INFO] [stdout] 171 | | format!("{} {}", tokens.get(0).unwrap(), if !is_while && tokens.get(1).unwrap() == "if" { [INFO] [stdout] 172 | | is_else_if = true; [INFO] [stdout] 173 | | "if(" [INFO] [stdout] 174 | | } else { "(" })); [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] help: consider removing `String::from()` [INFO] [stdout] | [INFO] [stdout] 170 ~ let mut statement = format!("{} {}", tokens.get(0).unwrap(), if !is_while && tokens.get(1).unwrap() == "if" { [INFO] [stdout] 171 + is_else_if = true; [INFO] [stdout] 172 + "if(" [INFO] [stdout] 173 ~ } else { "(" }); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: accessing first element with `tokens.get(0)` [INFO] [stdout] --> src/cg.rs:171:34 [INFO] [stdout] | [INFO] [stdout] 171 | format!("{} {}", tokens.get(0).unwrap(), if !is_while && tokens.get(1).unwrap() == "if" { [INFO] [stdout] | ^^^^^^^^^^^^^ help: try: `tokens.first()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#get_first [INFO] [stdout] = note: `#[warn(clippy::get_first)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: useless use of `format!` [INFO] [stdout] --> src/cg.rs:180:36 [INFO] [stdout] | [INFO] [stdout] 180 | statement.push_str(format!("{}", from_module(token)).as_str()); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `from_module(token).to_string()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_format [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: useless conversion to the same type: `std::string::String` [INFO] [stdout] --> src/tokenizer.rs:117:37 [INFO] [stdout] | [INFO] [stdout] 117 | let token = String::from(replace(&temporary_tokens[i].to_string())); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `String::from()`: `replace(&temporary_tokens[i].to_string())` [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] [INFO] [stdout] [INFO] [stdout] warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do [INFO] [stdout] --> src/cg.rs:187:51 [INFO] [stdout] | [INFO] [stdout] 187 | pub fn statement_directive(&mut self, tokens: &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] 187 - pub fn statement_directive(&mut self, tokens: &Vec) { [INFO] [stdout] 187 + pub fn statement_directive(&mut self, tokens: &[String]) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: useless conversion to the same type: `std::string::String` [INFO] [stdout] --> src/cg.rs:193:33 [INFO] [stdout] | [INFO] [stdout] 193 | let mut statement = String::from( [INFO] [stdout] | _________________________________^ [INFO] [stdout] 194 | | format!("#{} ", if tokens.get(1).unwrap() == "if" { [INFO] [stdout] 195 | | is_else_if = true; [INFO] [stdout] 196 | | "elif" [INFO] [stdout] 197 | | } else { "if" })); [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] help: consider removing `String::from()` [INFO] [stdout] | [INFO] [stdout] 193 ~ let mut statement = format!("#{} ", if tokens.get(1).unwrap() == "if" { [INFO] [stdout] 194 + is_else_if = true; [INFO] [stdout] 195 + "elif" [INFO] [stdout] 196 ~ } else { "if" }); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: useless use of `format!` [INFO] [stdout] --> src/cg.rs:200:36 [INFO] [stdout] | [INFO] [stdout] 200 | statement.push_str(format!("{}", token).as_str()); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `token.to_string()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_format [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: deref which would be done by auto-deref [INFO] [stdout] --> src/tokenizer.rs:147:39 [INFO] [stdout] | [INFO] [stdout] 147 | data.push_str(&*format!("{}{}", tokens.clone(), if is_seq { [INFO] [stdout] | _______________________________________^ [INFO] [stdout] 148 | | if tokens == "[" { is_seq = false; } [INFO] [stdout] 149 | | "" [INFO] [stdout] 150 | | } else { " " })); [INFO] [stdout] | |_______________________________________^ [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] help: try [INFO] [stdout] | [INFO] [stdout] 147 ~ data.push_str(&format!("{}{}", tokens.clone(), if is_seq { [INFO] [stdout] 148 + if tokens == "[" { is_seq = false; } [INFO] [stdout] 149 + "" [INFO] [stdout] 150 ~ } else { " " })); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: deref which would be done by auto-deref [INFO] [stdout] --> src/tokenizer.rs:156:35 [INFO] [stdout] | [INFO] [stdout] 156 | data.push_str(&*format!("{}{}", tokens.clone(), if tokens[1..] != *ESC { [INFO] [stdout] | ___________________________________^ [INFO] [stdout] 157 | | " " [INFO] [stdout] 158 | | } else { is_seq = true; "" })); continue; [INFO] [stdout] | |_________________________________________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 156 ~ data.push_str(&format!("{}{}", tokens.clone(), if tokens[1..] != *ESC { [INFO] [stdout] 157 + " " [INFO] [stdout] 158 ~ } else { is_seq = true; "" })); continue; [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/tokenizer.rs:179:9 [INFO] [stdout] | [INFO] [stdout] 179 | / return if is_start_of_data(token) || is_end_of_data(token) { [INFO] [stdout] 180 | | true [INFO] [stdout] 181 | | } else { false }; [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] 179 ~ if is_start_of_data(token) || is_end_of_data(token) { [INFO] [stdout] 180 + true [INFO] [stdout] 181 ~ } else { false } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this if-then-else expression returns a bool literal [INFO] [stdout] --> src/tokenizer.rs:179:16 [INFO] [stdout] | [INFO] [stdout] 179 | return if is_start_of_data(token) || is_end_of_data(token) { [INFO] [stdout] | ________________^ [INFO] [stdout] 180 | | true [INFO] [stdout] 181 | | } else { false }; [INFO] [stdout] | |________________________^ help: you can reduce it to: `is_start_of_data(token) || is_end_of_data(token)` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_bool [INFO] [stdout] = note: `#[warn(clippy::needless_bool)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/tokenizer.rs:185:9 [INFO] [stdout] | [INFO] [stdout] 185 | / return if token.trim_start().starts_with('"') { [INFO] [stdout] 186 | | true [INFO] [stdout] 187 | | } else { false }; [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] 185 ~ if token.trim_start().starts_with('"') { [INFO] [stdout] 186 + true [INFO] [stdout] 187 ~ } else { false } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this if-then-else expression returns a bool literal [INFO] [stdout] --> src/tokenizer.rs:185:16 [INFO] [stdout] | [INFO] [stdout] 185 | return if token.trim_start().starts_with('"') { [INFO] [stdout] | ________________^ [INFO] [stdout] 186 | | true [INFO] [stdout] 187 | | } else { false }; [INFO] [stdout] | |________________________^ help: you can reduce it to: `token.trim_start().starts_with('"')` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_bool [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/tokenizer.rs:195:9 [INFO] [stdout] | [INFO] [stdout] 195 | / return if token.ends_with('"') { [INFO] [stdout] 196 | | true [INFO] [stdout] 197 | | } else { false }; [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] 195 ~ if token.ends_with('"') { [INFO] [stdout] 196 + true [INFO] [stdout] 197 ~ } else { false } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this if-then-else expression returns a bool literal [INFO] [stdout] --> src/tokenizer.rs:195:16 [INFO] [stdout] | [INFO] [stdout] 195 | return if token.ends_with('"') { [INFO] [stdout] | ________________^ [INFO] [stdout] 196 | | true [INFO] [stdout] 197 | | } else { false }; [INFO] [stdout] | |________________________^ help: you can reduce it to: `token.ends_with('"')` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_bool [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: writing `&String` instead of `&str` involves a new object where a slice will do [INFO] [stdout] --> src/cg.rs:245:56 [INFO] [stdout] | [INFO] [stdout] 245 | pub fn return_variable(&mut self, return_variable: &String) { [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] 245 ~ pub fn return_variable(&mut self, return_variable: &str) { [INFO] [stdout] 246 | self.generated.push_str(format!("return {};", if return_variable.is_empty() { [INFO] [stdout] 247 | "" [INFO] [stdout] 248 ~ } else { return_variable }).as_str()) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/tokenizer.rs:205:9 [INFO] [stdout] | [INFO] [stdout] 205 | / return if token.starts_with('/') && token.chars().nth(1).unwrap() == '/' { [INFO] [stdout] 206 | | true [INFO] [stdout] 207 | | } else { false }; [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] 205 ~ if token.starts_with('/') && token.chars().nth(1).unwrap() == '/' { [INFO] [stdout] 206 + true [INFO] [stdout] 207 ~ } else { false } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this if-then-else expression returns a bool literal [INFO] [stdout] --> src/tokenizer.rs:205:16 [INFO] [stdout] | [INFO] [stdout] 205 | return if token.starts_with('/') && token.chars().nth(1).unwrap() == '/' { [INFO] [stdout] | ________________^ [INFO] [stdout] 206 | | true [INFO] [stdout] 207 | | } else { false }; [INFO] [stdout] | |________________________^ help: you can reduce it to: `token.starts_with('/') && token.chars().nth(1).unwrap() == '/'` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_bool [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: writing `&String` instead of `&str` involves a new object where a slice will do [INFO] [stdout] --> src/tokenizer.rs:210:32 [INFO] [stdout] | [INFO] [stdout] 210 | pub fn replace_with(token: &String, character: char) -> String { [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] 210 - pub fn replace_with(token: &String, character: char) -> String { [INFO] [stdout] 210 + pub fn replace_with(token: &str, character: char) -> String { [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/cg.rs:255:38 [INFO] [stdout] | [INFO] [stdout] 255 | pub fn assembly(&mut self, data: &String) { [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] 255 - pub fn assembly(&mut self, data: &String) { [INFO] [stdout] 255 + pub fn assembly(&mut self, data: &str) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: deref which would be done by auto-deref [INFO] [stdout] --> src/cg.rs:281:33 [INFO] [stdout] | [INFO] [stdout] 281 | self.generated.push_str(&*format!("std::vector<{}>", __type)); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&format!("std::vector<{}>", __type)` [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/cg.rs:289:33 [INFO] [stdout] | [INFO] [stdout] 289 | self.generated.push_str(&*format!("{}\n", character)); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&format!("{}\n", character)` [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: writing `&Vec` instead of `&[_]` involves a new object where a slice will do [INFO] [stdout] --> src/optimize.rs:18:27 [INFO] [stdout] | [INFO] [stdout] 18 | pub fn optimize(data: &Vec, optimize_type: OptimizeBlocks) -> 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] 18 ~ pub fn optimize(data: &[String], optimize_type: OptimizeBlocks) -> Vec { [INFO] [stdout] 19 ~ let mut data = data.to_owned(); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/optimize.rs:64:9 [INFO] [stdout] | [INFO] [stdout] 64 | / return if data == "!" || data == "=" { [INFO] [stdout] 65 | | true [INFO] [stdout] 66 | | } else { false }; [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] 64 ~ if data == "!" || data == "=" { [INFO] [stdout] 65 + true [INFO] [stdout] 66 ~ } else { false } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this if-then-else expression returns a bool literal [INFO] [stdout] --> src/optimize.rs:64:16 [INFO] [stdout] | [INFO] [stdout] 64 | return if data == "!" || data == "=" { [INFO] [stdout] | ________________^ [INFO] [stdout] 65 | | true [INFO] [stdout] 66 | | } else { false }; [INFO] [stdout] | |________________________^ help: you can reduce it to: `data == "!" || data == "="` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_bool [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/optimize.rs:70:9 [INFO] [stdout] | [INFO] [stdout] 70 | / return if data == "true" || data == "false" { [INFO] [stdout] 71 | | true [INFO] [stdout] 72 | | } else { false }; [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] 70 ~ if data == "true" || data == "false" { [INFO] [stdout] 71 + true [INFO] [stdout] 72 ~ } else { false } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this if-then-else expression returns a bool literal [INFO] [stdout] --> src/optimize.rs:70:16 [INFO] [stdout] | [INFO] [stdout] 70 | return if data == "true" || data == "false" { [INFO] [stdout] | ________________^ [INFO] [stdout] 71 | | true [INFO] [stdout] 72 | | } else { false }; [INFO] [stdout] | |________________________^ help: you can reduce it to: `data == "true" || data == "false"` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_bool [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: module has the same name as its containing module [INFO] [stdout] --> src/log.rs:16:1 [INFO] [stdout] | [INFO] [stdout] 16 | / pub mod log { [INFO] [stdout] 17 | | use crate::{ [INFO] [stdout] 18 | | log::{LogTypes}, [INFO] [stdout] 19 | | read::{GreteaFileData} [INFO] [stdout] ... | [INFO] [stdout] 47 | | } [INFO] [stdout] | |_^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_inception [INFO] [stdout] = note: `#[warn(clippy::module_inception)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `impl` can be derived [INFO] [stdout] --> src/ast.rs:282:1 [INFO] [stdout] | [INFO] [stdout] 282 | / impl Default for GreteaVariableList { [INFO] [stdout] 283 | | fn default() -> Self { [INFO] [stdout] 284 | | GreteaVariableList { [INFO] [stdout] 285 | | variable_list: vec![] [INFO] [stdout] ... | [INFO] [stdout] 288 | | } [INFO] [stdout] | |_^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derivable_impls [INFO] [stdout] = note: `#[warn(clippy::derivable_impls)]` on by default [INFO] [stdout] help: replace the manual implementation with a derive attribute [INFO] [stdout] | [INFO] [stdout] 161 + #[derive(Default)] [INFO] [stdout] 162 | pub struct GreteaVariableList { [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/ast.rs:313:30 [INFO] [stdout] | [INFO] [stdout] 313 | pub fn from_module(data: &String) -> String { [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] 313 - pub fn from_module(data: &String) -> String { [INFO] [stdout] 313 + pub fn from_module(data: &str) -> String { [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/main.rs:59:5 [INFO] [stdout] | [INFO] [stdout] 59 | / match std::fs::remove_file(filename) { [INFO] [stdout] 60 | | Err(_) => panic!("gretea: failed to remove {}", filename), [INFO] [stdout] 61 | | _ => {} [INFO] [stdout] 62 | | } [INFO] [stdout] | |_____^ help: try: `if let Err(_) = std::fs::remove_file(filename) { panic!("gretea: failed to remove {}", filename) }` [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] [INFO] [stdout] [INFO] [stdout] warning: this boolean expression can be simplified [INFO] [stdout] --> src/parser.rs:213:20 [INFO] [stdout] | [INFO] [stdout] 213 | if !get_alias_data.is_none() { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `get_alias_data.is_some()` [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: called `Iterator::last` on a `DoubleEndedIterator`; this will needlessly iterate the entire iterator [INFO] [stdout] --> src/main.rs:103:56 [INFO] [stdout] | [INFO] [stdout] 103 | let object_name = header(normalize(file.0.split('/').last().unwrap().parse().unwrap())); [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] help: try [INFO] [stdout] | [INFO] [stdout] 103 - let object_name = header(normalize(file.0.split('/').last().unwrap().parse().unwrap())); [INFO] [stdout] 103 + let object_name = header(normalize(file.0.split('/').next_back().unwrap().parse().unwrap())); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unnecessary use of `to_owned` [INFO] [stdout] --> src/main.rs:132:21 [INFO] [stdout] | [INFO] [stdout] 132 | for file in files.to_owned() { [INFO] [stdout] | ^^^^^^^^^^^^^^^^ help: use: `files.iter().cloned()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_to_owned [INFO] [stdout] = note: `#[warn(clippy::unnecessary_to_owned)]` 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/main.rs:133:47 [INFO] [stdout] | [INFO] [stdout] 133 | remove_and_check(header(normalize(file.0.split('/') [INFO] [stdout] | _______________________________________________^ [INFO] [stdout] 134 | | .last() [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] help: try [INFO] [stdout] | [INFO] [stdout] 134 - .last() [INFO] [stdout] 134 + .next_back() [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: call to `.clone()` on a reference in this situation does nothing [INFO] [stdout] --> src/tokenizer.rs:147:63 [INFO] [stdout] | [INFO] [stdout] 147 | data.push_str(&*format!("{}{}", tokens.clone(), if is_seq { [INFO] [stdout] | ^^^^^^^^ help: remove this redundant call [INFO] [stdout] | [INFO] [stdout] = note: the type `str` does not implement `Clone`, so calling `clone` on `&str` copies the reference, which does not do anything and can be removed [INFO] [stdout] = note: `#[warn(noop_method_call)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: call to `.clone()` on a reference in this situation does nothing [INFO] [stdout] --> src/tokenizer.rs:156:59 [INFO] [stdout] | [INFO] [stdout] 156 | data.push_str(&*format!("{}{}", tokens.clone(), if tokens[1..] != *ESC { [INFO] [stdout] | ^^^^^^^^ help: remove this redundant call [INFO] [stdout] | [INFO] [stdout] = note: the type `str` does not implement `Clone`, so calling `clone` on `&str` copies the reference, which does not do anything and can be removed [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: called `unwrap` on `get_alias_data` after checking its variant with `is_none` [INFO] [stdout] --> src/parser.rs:214:29 [INFO] [stdout] | [INFO] [stdout] 213 | if !get_alias_data.is_none() { [INFO] [stdout] | ------------------------ the check is happening here [INFO] [stdout] 214 | token = get_alias_data.unwrap().clone(); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: try using `match` [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_unwrap [INFO] [stdout] = note: `#[warn(clippy::unnecessary_unwrap)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do [INFO] [stdout] --> src/parser.rs:57:37 [INFO] [stdout] | [INFO] [stdout] 57 | pub fn parse(&mut self, tokens: &Vec) -> GreteaCodegen { [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] 57 ~ pub fn parse(&mut self, tokens: &[String]) -> GreteaCodegen { [INFO] [stdout] 58 | let mut codegen = GreteaCodegen { [INFO] [stdout] ... [INFO] [stdout] 186 | [INFO] [stdout] 187 ~ for mut token in tokens.to_owned() { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/parser.rs:204:18 [INFO] [stdout] | [INFO] [stdout] 204 | else if token.starts_with('"') { [INFO] [stdout] | __________________^ [INFO] [stdout] 205 | | if !token.trim_end().ends_with('"') { [INFO] [stdout] 206 | | is_get_data = true; get_data.push_str(token.clone().as_str()); continue; [INFO] [stdout] 207 | | } [INFO] [stdout] 208 | | } [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] 204 ~ else if token.starts_with('"') [INFO] [stdout] 205 ~ && !token.trim_end().ends_with('"') { [INFO] [stdout] 206 | is_get_data = true; get_data.push_str(token.clone().as_str()); continue; [INFO] [stdout] 207 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/parser.rs:250:13 [INFO] [stdout] | [INFO] [stdout] 250 | / if matched_type == GreteaKeywords::Type { [INFO] [stdout] 251 | | if !is_fn_call && !is_var_data { [INFO] [stdout] 252 | | matched_type = GreteaKeywords::Undefined; [INFO] [stdout] 253 | | } [INFO] [stdout] 254 | | } [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] 250 ~ if matched_type == GreteaKeywords::Type [INFO] [stdout] 251 ~ && !is_fn_call && !is_var_data { [INFO] [stdout] 252 | matched_type = GreteaKeywords::Undefined; [INFO] [stdout] 253 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: deref which would be done by auto-deref [INFO] [stdout] --> src/parser.rs:380:52 [INFO] [stdout] | [INFO] [stdout] 380 | ... variable_type.push_str(&*token.clone()); [INFO] [stdout] | ^^^^^^^^^^^^^^^ help: try: `&token.clone()` [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/parser.rs:383:47 [INFO] [stdout] | [INFO] [stdout] 383 | ... var_data.push_str(&*token.clone()); [INFO] [stdout] | ^^^^^^^^^^^^^^^ help: try: `&token.clone()` [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: calling `push_str()` using a single-character string literal [INFO] [stdout] --> src/parser.rs:424:25 [INFO] [stdout] | [INFO] [stdout] 424 | return_val.push_str("["); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `push` with a character literal: `return_val.push('[')` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_char_add_str [INFO] [stdout] = note: `#[warn(clippy::single_char_add_str)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: calling `push_str()` using a single-character string literal [INFO] [stdout] --> src/parser.rs:442:25 [INFO] [stdout] | [INFO] [stdout] 442 | return_val.push_str("]"); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `push` with a character literal: `return_val.push(']')` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_char_add_str [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `GreteaCompileType` which implements the `Copy` trait [INFO] [stdout] --> src/parser.rs:471:45 [INFO] [stdout] | [INFO] [stdout] 471 | ... __type: compile_config.clone(), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `compile_config` [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 `if` statement can be collapsed [INFO] [stdout] --> src/parser.rs:574:21 [INFO] [stdout] | [INFO] [stdout] 574 | / if !is_runtime || !is_cpp_linker { [INFO] [stdout] 575 | | if is_preprocessor { [INFO] [stdout] 576 | | is_set = true; continue; [INFO] [stdout] 577 | | } [INFO] [stdout] 578 | | } [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] 574 ~ if (!is_runtime || !is_cpp_linker) { [INFO] [stdout] 575 ~ && is_preprocessor { [INFO] [stdout] 576 | is_set = true; continue; [INFO] [stdout] 577 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: deref which would be done by auto-deref [INFO] [stdout] --> src/parser.rs:621:55 [INFO] [stdout] | [INFO] [stdout] 621 | ... compile_data.push_str(&*format!("{} ", from_module(&token))); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&format!("{} ", from_module(&token))` [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/parser.rs:702:45 [INFO] [stdout] | [INFO] [stdout] 702 | ... &*token, [INFO] [stdout] | ^^^^^^^ help: try: `&token` [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/parser.rs:709:45 [INFO] [stdout] | [INFO] [stdout] 709 | ... &*token, [INFO] [stdout] | ^^^^^^^ help: try: `&token` [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 `if` statement can be collapsed [INFO] [stdout] --> src/parser.rs:719:25 [INFO] [stdout] | [INFO] [stdout] 719 | / if is_unsafe || is_safe { [INFO] [stdout] 720 | | if token == "{" { continue; } [INFO] [stdout] 721 | | } [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] 719 ~ if (is_unsafe || is_safe) { [INFO] [stdout] 720 ~ && token == "{" { continue; } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this if-then-else expression will always return false [INFO] [stdout] --> src/parser.rs:778:57 [INFO] [stdout] | [INFO] [stdout] 778 | ... is_struct_generic = if is_struct_generic { false } else { false }; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_bool [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` has identical blocks [INFO] [stdout] --> src/parser.rs:778:78 [INFO] [stdout] | [INFO] [stdout] 778 | ... is_struct_generic = if is_struct_generic { false } else { false }; [INFO] [stdout] | ^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] note: same as this [INFO] [stdout] --> src/parser.rs:778:93 [INFO] [stdout] | [INFO] [stdout] 778 | ... is_struct_generic = if is_struct_generic { false } else { false }; [INFO] [stdout] | ^^^^^^^^^ [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#if_same_then_else [INFO] [stdout] = note: `#[warn(clippy::if_same_then_else)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/parser.rs:803:37 [INFO] [stdout] | [INFO] [stdout] 803 | / ... if !struct_member_type.is_empty() { [INFO] [stdout] 804 | | ... if token.ends_with('\n') || token.ends_with(',') || token.ends_with('\\') { [INFO] [stdout] 805 | | ... codegen.variable_definition(&struct_member_default, &struct_member_type, [INFO] [stdout] 806 | | ... &struct_member_name, struct_member_immutable); [INFO] [stdout] ... | [INFO] [stdout] 822 | | ... } [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] 803 ~ if !struct_member_type.is_empty() [INFO] [stdout] 804 ~ && (token.ends_with('\n') || token.ends_with(',') || token.ends_with('\\')) { [INFO] [stdout] 805 | codegen.variable_definition(&struct_member_default, &struct_member_type, [INFO] [stdout] ... [INFO] [stdout] 820 | continue; [INFO] [stdout] 821 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: called `Iterator::last` on a `DoubleEndedIterator`; this will needlessly iterate the entire iterator [INFO] [stdout] --> src/parser.rs:932:51 [INFO] [stdout] | [INFO] [stdout] 932 | ... let __token = token.split('#').last().unwrap().trim().to_string(); [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] 932 - let __token = token.split('#').last().unwrap().trim().to_string(); [INFO] [stdout] 932 + let __token = token.split('#').next_back().unwrap().trim().to_string(); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: deref which would be done by auto-deref [INFO] [stdout] --> src/parser.rs:1000:49 [INFO] [stdout] | [INFO] [stdout] 1000 | ... &*token, [INFO] [stdout] | ^^^^^^^ help: try: `&token` [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 `if` statement can be collapsed [INFO] [stdout] --> src/parser.rs:1060:45 [INFO] [stdout] | [INFO] [stdout] 1060 | / ... if is_expandable { [INFO] [stdout] 1061 | | ... if argument_value == fn_generic { [INFO] [stdout] 1062 | | ... argument_value.push_str("..."); [INFO] [stdout] 1063 | | ... } [INFO] [stdout] 1064 | | ... } [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] 1060 ~ if is_expandable [INFO] [stdout] 1061 ~ && argument_value == fn_generic { [INFO] [stdout] 1062 | argument_value.push_str("..."); [INFO] [stdout] 1063 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: called `Iterator::last` on a `DoubleEndedIterator`; this will needlessly iterate the entire iterator [INFO] [stdout] --> src/parser.rs:1095:39 [INFO] [stdout] | [INFO] [stdout] 1095 | ... fn_name = token.split('#').last().unwrap().to_string(); [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] help: try [INFO] [stdout] | [INFO] [stdout] 1095 - fn_name = token.split('#').last().unwrap().to_string(); [INFO] [stdout] 1095 + fn_name = token.split('#').next_back().unwrap().to_string(); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/parser.rs:1139:49 [INFO] [stdout] | [INFO] [stdout] 1139 | / ... if !var_struct_init_data.is_empty() { [INFO] [stdout] 1140 | | ... if token == "," || token.ends_with('\n') { [INFO] [stdout] 1141 | | ... var_data.push_str(format!(".{}={},", var_struct_init_name, [INFO] [stdout] 1142 | | ... var_struct_init_data).as_str()); [INFO] [stdout] ... | [INFO] [stdout] 1147 | | ... } [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] 1139 ~ if !var_struct_init_data.is_empty() [INFO] [stdout] 1140 ~ && (token == "," || token.ends_with('\n')) { [INFO] [stdout] 1141 | var_data.push_str(format!(".{}={},", var_struct_init_name, [INFO] [stdout] ... [INFO] [stdout] 1145 | continue; [INFO] [stdout] 1146 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/parser.rs:1225:29 [INFO] [stdout] | [INFO] [stdout] 1225 | / ... if is_for_variable { [INFO] [stdout] 1226 | | ... if is_for_in { [INFO] [stdout] 1227 | | ... for_iter = token.clone(); [INFO] [stdout] 1228 | | ... codegen.for_iter(&for_var, &for_iter); [INFO] [stdout] ... | [INFO] [stdout] 1238 | | ... } [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] 1225 ~ if is_for_variable [INFO] [stdout] 1226 ~ && is_for_in { [INFO] [stdout] 1227 | for_iter = token.clone(); [INFO] [stdout] ... [INFO] [stdout] 1236 | continue; [INFO] [stdout] 1237 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: called `Iterator::last` on a `DoubleEndedIterator`; this will needlessly iterate the entire iterator [INFO] [stdout] --> src/parser.rs:1303:46 [INFO] [stdout] | [INFO] [stdout] 1303 | let function_token = token.clone().split('#').last().unwrap().to_string(); [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] help: try [INFO] [stdout] | [INFO] [stdout] 1303 - let function_token = token.clone().split('#').last().unwrap().to_string(); [INFO] [stdout] 1303 + let function_token = token.clone().split('#').next_back().unwrap().to_string(); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: called `Iterator::last` on a `DoubleEndedIterator`; this will needlessly iterate the entire iterator [INFO] [stdout] --> src/parser.rs:1307:54 [INFO] [stdout] | [INFO] [stdout] 1307 | ... let function_token = token.clone().split('.').last().unwrap().to_string(); [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] help: try [INFO] [stdout] | [INFO] [stdout] 1307 - let function_token = token.clone().split('.').last().unwrap().to_string(); [INFO] [stdout] 1307 + let function_token = token.clone().split('.').next_back().unwrap().to_string(); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: called `Iterator::last` on a `DoubleEndedIterator`; this will needlessly iterate the entire iterator [INFO] [stdout] --> src/parser.rs:1316:36 [INFO] [stdout] | [INFO] [stdout] 1316 | ... if name.split('#').last().unwrap().trim() == function_token.trim() { [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] help: try [INFO] [stdout] | [INFO] [stdout] 1316 - if name.split('#').last().unwrap().trim() == function_token.trim() { [INFO] [stdout] 1316 + if name.split('#').next_back().unwrap().trim() == function_token.trim() { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: called `Iterator::last` on a `DoubleEndedIterator`; this will needlessly iterate the entire iterator [INFO] [stdout] --> src/parser.rs:1383:40 [INFO] [stdout] | [INFO] [stdout] 1383 | ... || token.split('.').last().unwrap() == variable.__name { [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] help: try [INFO] [stdout] | [INFO] [stdout] 1383 - || token.split('.').last().unwrap() == variable.__name { [INFO] [stdout] 1383 + || token.split('.').next_back().unwrap() == variable.__name { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: useless use of `format!` [INFO] [stdout] --> src/parser.rs:1385:51 [INFO] [stdout] | [INFO] [stdout] 1385 | ... line.push_str(format!("{}", token.clone()).as_str()); break; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `token.clone().to_string()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_format [INFO] [stdout] = note: `#[warn(clippy::useless_format)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: deref which would be done by auto-deref [INFO] [stdout] --> src/cg.rs:40:17 [INFO] [stdout] | [INFO] [stdout] 40 | &*format!("#{} {}\n", "include", subdirectory)); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&format!("#{} {}\n", "include", subdirectory)` [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/cg.rs:59:13 [INFO] [stdout] | [INFO] [stdout] 59 | / ... &*format!("#{}{}{}.hpp{}\n", "include", [INFO] [stdout] 60 | | ... if is_stl { '"' } else { '"' }, dir.replace('\n', "").split('/').last().unwrap(), if is_stl { '"' } else { '"' })); [INFO] [stdout] | |_________________________________________________________________________________________________________________________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 59 ~ &format!("#{}{}{}.hpp{}\n", "include", [INFO] [stdout] 60 ~ if is_stl { '"' } else { '"' }, dir.replace('\n', "").split('/').last().unwrap(), if is_stl { '"' } else { '"' })); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` has identical blocks [INFO] [stdout] --> src/cg.rs:60:33 [INFO] [stdout] | [INFO] [stdout] 60 | ... if is_stl { '"' } else { '"' }, dir.replace('\n', "").split('/').last().unwrap(), if is_stl { '"' } else { '"' })); [INFO] [stdout] | ^^^^^^^ [INFO] [stdout] | [INFO] [stdout] note: same as this [INFO] [stdout] --> src/cg.rs:60:46 [INFO] [stdout] | [INFO] [stdout] 60 | ... if is_stl { '"' } else { '"' }, dir.replace('\n', "").split('/').last().unwrap(), if is_stl { '"' } 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: called `Iterator::last` on a `DoubleEndedIterator`; this will needlessly iterate the entire iterator [INFO] [stdout] --> src/cg.rs:60:55 [INFO] [stdout] | [INFO] [stdout] 60 | ... if is_stl { '"' } else { '"' }, dir.replace('\n', "").split('/').last().unwrap(), if is_stl { '"' } else { '"' })); [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] help: try [INFO] [stdout] | [INFO] [stdout] 60 - if is_stl { '"' } else { '"' }, dir.replace('\n', "").split('/').last().unwrap(), if is_stl { '"' } else { '"' })); [INFO] [stdout] 60 + if is_stl { '"' } else { '"' }, dir.replace('\n', "").split('/').next_back().unwrap(), if is_stl { '"' } else { '"' })); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` has identical blocks [INFO] [stdout] --> src/cg.rs:60:115 [INFO] [stdout] | [INFO] [stdout] 60 | ... if is_stl { '"' } else { '"' }, dir.replace('\n', "").split('/').last().unwrap(), if is_stl { '"' } else { '"' })); [INFO] [stdout] | ^^^^^^^ [INFO] [stdout] | [INFO] [stdout] note: same as this [INFO] [stdout] --> src/cg.rs:60:128 [INFO] [stdout] | [INFO] [stdout] 60 | ... if is_stl { '"' } else { '"' }, dir.replace('\n', "").split('/').last().unwrap(), if is_stl { '"' } else { '"' })); [INFO] [stdout] | ^^^^^^^ [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#if_same_then_else [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this function has too many arguments (8/7) [INFO] [stdout] --> src/cg.rs:63:5 [INFO] [stdout] | [INFO] [stdout] 63 | / pub fn function(&mut self, [INFO] [stdout] 64 | | parser : &mut GreteaParser, [INFO] [stdout] 65 | | args : &Vec, [INFO] [stdout] 66 | | name : &String, [INFO] [stdout] ... | [INFO] [stdout] 71 | | is_void : bool) { [INFO] [stdout] | |_____________________________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments [INFO] [stdout] = note: `#[warn(clippy::too_many_arguments)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do [INFO] [stdout] --> src/cg.rs:65:33 [INFO] [stdout] | [INFO] [stdout] 65 | args : &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] 65 ~ args : &[GreteaFunctionArgument], [INFO] [stdout] 66 | name : &String, [INFO] [stdout] ... [INFO] [stdout] 80 | __function_return_type: return_val.clone(), [INFO] [stdout] 81 ~ __function_arguments : args.to_owned() [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: useless use of `format!` [INFO] [stdout] --> src/cg.rs:87:25 [INFO] [stdout] | [INFO] [stdout] 87 | arguments = format!("int argc, char** argv"); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `"int argc, char** argv".to_string()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_format [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: deref which would be done by auto-deref [INFO] [stdout] --> src/cg.rs:91:36 [INFO] [stdout] | [INFO] [stdout] 91 | arguments.push_str(&*format!("{} {},", map.__arg_type.clone(), map.__arg_name.clone())); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&format!("{} {},", map.__arg_type.clone(), map.__arg_name.clone())` [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/cg.rs:96:33 [INFO] [stdout] | [INFO] [stdout] 96 | self.generated.push_str(&*format!("{} {}({}) {}\n", [INFO] [stdout] | _________________________________^ [INFO] [stdout] 97 | | return_val, name, arguments, if is_void { [INFO] [stdout] 98 | | "{" [INFO] [stdout] 99 | | } else { "" })); [INFO] [stdout] | |__________________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 96 ~ self.generated.push_str(&format!("{} {}({}) {}\n", [INFO] [stdout] 97 + return_val, name, arguments, if is_void { [INFO] [stdout] 98 + "{" [INFO] [stdout] 99 ~ } else { "" })); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do [INFO] [stdout] --> src/cg.rs:102:43 [INFO] [stdout] | [INFO] [stdout] 102 | pub fn function_call(&mut self, args: &Vec, name: &String, is_unpack: bool) { [INFO] [stdout] | ^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg [INFO] [stdout] help: change this to [INFO] [stdout] | [INFO] [stdout] 102 - pub fn function_call(&mut self, args: &Vec, name: &String, is_unpack: bool) { [INFO] [stdout] 102 + pub fn function_call(&mut self, args: &[String], name: &String, is_unpack: bool) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: taken reference of right operand [INFO] [stdout] --> src/cg.rs:105:12 [INFO] [stdout] | [INFO] [stdout] 105 | if name != &"main" { [INFO] [stdout] | ^^^^^^^^------- [INFO] [stdout] | | [INFO] [stdout] | help: use the right value directly: `"main"` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#op_ref [INFO] [stdout] = note: `#[warn(clippy::op_ref)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` can be collapsed into the outer `match` [INFO] [stdout] --> src/cg.rs:116:31 [INFO] [stdout] | [INFO] [stdout] 116 | "]" => { if arguments.chars().last().unwrap() == ',' { arguments.pop(); } }, [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] 116 - "]" => { if arguments.chars().last().unwrap() == ',' { arguments.pop(); } }, [INFO] [stdout] 116 + "]" if arguments.chars().last().unwrap() == ',' => { arguments.pop(); }, [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you should use the `ends_with` method [INFO] [stdout] --> src/cg.rs:116:34 [INFO] [stdout] | [INFO] [stdout] 116 | "]" => { if arguments.chars().last().unwrap() == ',' { arguments.pop(); } }, [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `arguments.ends_with(',')` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#chars_last_cmp [INFO] [stdout] = note: `#[warn(clippy::chars_last_cmp)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: deref which would be done by auto-deref [INFO] [stdout] --> src/cg.rs:120:36 [INFO] [stdout] | [INFO] [stdout] 120 | arguments.push_str(&*format!("{},", arg)); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^ help: try: `&format!("{},", arg)` [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 `if` can be collapsed into the outer `match` [INFO] [stdout] --> src/cg.rs:131:30 [INFO] [stdout] | [INFO] [stdout] 131 | "]" => { if arguments.chars().last().unwrap() == ',' { arguments.pop(); } }, [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] 131 - "]" => { if arguments.chars().last().unwrap() == ',' { arguments.pop(); } }, [INFO] [stdout] 131 + "]" if arguments.chars().last().unwrap() == ',' => { arguments.pop(); }, [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you should use the `ends_with` method [INFO] [stdout] --> src/cg.rs:131:33 [INFO] [stdout] | [INFO] [stdout] 131 | "]" => { if arguments.chars().last().unwrap() == ',' { arguments.pop(); } }, [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `arguments.ends_with(',')` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#chars_last_cmp [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you should use the `ends_with` method [INFO] [stdout] --> src/cg.rs:134:43 [INFO] [stdout] | [INFO] [stdout] 134 | } if !arguments.is_empty() && arguments.chars().last().unwrap() == ',' { arguments.pop(); } [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: like this: `arguments.ends_with(',')` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#chars_last_cmp [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: deref which would be done by auto-deref [INFO] [stdout] --> src/cg.rs:137:33 [INFO] [stdout] | [INFO] [stdout] 137 | self.generated.push_str(&*format!("{}{}({}){};\n", if is_unpack { [INFO] [stdout] | _________________________________^ [INFO] [stdout] 138 | | "(" [INFO] [stdout] 139 | | } else { "" }, name, arguments, if is_unpack { [INFO] [stdout] 140 | | ", ...)" [INFO] [stdout] 141 | | } else { "" })); [INFO] [stdout] | |______________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 137 ~ self.generated.push_str(&format!("{}{}({}){};\n", if is_unpack { [INFO] [stdout] 138 + "(" [INFO] [stdout] 139 + } else { "" }, name, arguments, if is_unpack { [INFO] [stdout] 140 + ", ...)" [INFO] [stdout] 141 ~ } else { "" })); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: deref which would be done by auto-deref [INFO] [stdout] --> src/cg.rs:147:33 [INFO] [stdout] | [INFO] [stdout] 147 | self.generated.push_str(&*format!("{} {} {} {}\n", if !is_mut { [INFO] [stdout] | _________________________________^ [INFO] [stdout] 148 | | "const" [INFO] [stdout] 149 | | } else { "" }, if var_type.is_empty() { [INFO] [stdout] 150 | | "auto" [INFO] [stdout] ... | [INFO] [stdout] 154 | | __data.as_str() [INFO] [stdout] 155 | | })); [INFO] [stdout] | |__________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 147 ~ self.generated.push_str(&format!("{} {} {} {}\n", if !is_mut { [INFO] [stdout] 148 + "const" [INFO] [stdout] 149 + } else { "" }, if var_type.is_empty() { [INFO] [stdout] 150 + "auto" [INFO] [stdout] 151 + } else { var_type }, name, if data.is_empty() { [INFO] [stdout] 152 + ";" [INFO] [stdout] 153 + } else { [INFO] [stdout] 154 + __data.as_str() [INFO] [stdout] 155 ~ })); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: deref which would be done by auto-deref [INFO] [stdout] --> src/cg.rs:159:33 [INFO] [stdout] | [INFO] [stdout] 159 | self.generated.push_str(&*format!("#define {} {}\n", name, if !data.is_empty() { [INFO] [stdout] | _________________________________^ [INFO] [stdout] 160 | | data [INFO] [stdout] 161 | | } else { "0" })); [INFO] [stdout] | |_______________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_auto_deref [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 159 ~ self.generated.push_str(&format!("#define {} {}\n", name, if !data.is_empty() { [INFO] [stdout] 160 + data [INFO] [stdout] 161 ~ } else { "0" })); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: useless conversion to the same type: `std::string::String` [INFO] [stdout] --> src/cg.rs:170:33 [INFO] [stdout] | [INFO] [stdout] 170 | let mut statement = String::from( [INFO] [stdout] | _________________________________^ [INFO] [stdout] 171 | | format!("{} {}", tokens.get(0).unwrap(), if !is_while && tokens.get(1).unwrap() == "if" { [INFO] [stdout] 172 | | is_else_if = true; [INFO] [stdout] 173 | | "if(" [INFO] [stdout] 174 | | } else { "(" })); [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] help: consider removing `String::from()` [INFO] [stdout] | [INFO] [stdout] 170 ~ let mut statement = format!("{} {}", tokens.get(0).unwrap(), if !is_while && tokens.get(1).unwrap() == "if" { [INFO] [stdout] 171 + is_else_if = true; [INFO] [stdout] 172 + "if(" [INFO] [stdout] 173 ~ } else { "(" }); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: accessing first element with `tokens.get(0)` [INFO] [stdout] --> src/cg.rs:171:34 [INFO] [stdout] | [INFO] [stdout] 171 | format!("{} {}", tokens.get(0).unwrap(), if !is_while && tokens.get(1).unwrap() == "if" { [INFO] [stdout] | ^^^^^^^^^^^^^ help: try: `tokens.first()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#get_first [INFO] [stdout] = note: `#[warn(clippy::get_first)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: useless use of `format!` [INFO] [stdout] --> src/cg.rs:180:36 [INFO] [stdout] | [INFO] [stdout] 180 | statement.push_str(format!("{}", from_module(token)).as_str()); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `from_module(token).to_string()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_format [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do [INFO] [stdout] --> src/cg.rs:187:51 [INFO] [stdout] | [INFO] [stdout] 187 | pub fn statement_directive(&mut self, tokens: &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] 187 - pub fn statement_directive(&mut self, tokens: &Vec) { [INFO] [stdout] 187 + pub fn statement_directive(&mut self, tokens: &[String]) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: useless conversion to the same type: `std::string::String` [INFO] [stdout] --> src/cg.rs:193:33 [INFO] [stdout] | [INFO] [stdout] 193 | let mut statement = String::from( [INFO] [stdout] | _________________________________^ [INFO] [stdout] 194 | | format!("#{} ", if tokens.get(1).unwrap() == "if" { [INFO] [stdout] 195 | | is_else_if = true; [INFO] [stdout] 196 | | "elif" [INFO] [stdout] 197 | | } else { "if" })); [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] help: consider removing `String::from()` [INFO] [stdout] | [INFO] [stdout] 193 ~ let mut statement = format!("#{} ", if tokens.get(1).unwrap() == "if" { [INFO] [stdout] 194 + is_else_if = true; [INFO] [stdout] 195 + "elif" [INFO] [stdout] 196 ~ } else { "if" }); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: useless use of `format!` [INFO] [stdout] --> src/cg.rs:200:36 [INFO] [stdout] | [INFO] [stdout] 200 | statement.push_str(format!("{}", token).as_str()); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `token.to_string()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_format [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: writing `&String` instead of `&str` involves a new object where a slice will do [INFO] [stdout] --> src/cg.rs:245:56 [INFO] [stdout] | [INFO] [stdout] 245 | pub fn return_variable(&mut self, return_variable: &String) { [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] 245 ~ pub fn return_variable(&mut self, return_variable: &str) { [INFO] [stdout] 246 | self.generated.push_str(format!("return {};", if return_variable.is_empty() { [INFO] [stdout] 247 | "" [INFO] [stdout] 248 ~ } else { return_variable }).as_str()) [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/cg.rs:255:38 [INFO] [stdout] | [INFO] [stdout] 255 | pub fn assembly(&mut self, data: &String) { [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] 255 - pub fn assembly(&mut self, data: &String) { [INFO] [stdout] 255 + pub fn assembly(&mut self, data: &str) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: deref which would be done by auto-deref [INFO] [stdout] --> src/cg.rs:281:33 [INFO] [stdout] | [INFO] [stdout] 281 | self.generated.push_str(&*format!("std::vector<{}>", __type)); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&format!("std::vector<{}>", __type)` [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/cg.rs:289:33 [INFO] [stdout] | [INFO] [stdout] 289 | self.generated.push_str(&*format!("{}\n", character)); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `&format!("{}\n", character)` [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: writing `&Vec` instead of `&[_]` involves a new object where a slice will do [INFO] [stdout] --> src/optimize.rs:18:27 [INFO] [stdout] | [INFO] [stdout] 18 | pub fn optimize(data: &Vec, optimize_type: OptimizeBlocks) -> 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] 18 ~ pub fn optimize(data: &[String], optimize_type: OptimizeBlocks) -> Vec { [INFO] [stdout] 19 ~ let mut data = data.to_owned(); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/optimize.rs:64:9 [INFO] [stdout] | [INFO] [stdout] 64 | / return if data == "!" || data == "=" { [INFO] [stdout] 65 | | true [INFO] [stdout] 66 | | } else { false }; [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] 64 ~ if data == "!" || data == "=" { [INFO] [stdout] 65 + true [INFO] [stdout] 66 ~ } else { false } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this if-then-else expression returns a bool literal [INFO] [stdout] --> src/optimize.rs:64:16 [INFO] [stdout] | [INFO] [stdout] 64 | return if data == "!" || data == "=" { [INFO] [stdout] | ________________^ [INFO] [stdout] 65 | | true [INFO] [stdout] 66 | | } else { false }; [INFO] [stdout] | |________________________^ help: you can reduce it to: `data == "!" || data == "="` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_bool [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/optimize.rs:70:9 [INFO] [stdout] | [INFO] [stdout] 70 | / return if data == "true" || data == "false" { [INFO] [stdout] 71 | | true [INFO] [stdout] 72 | | } else { false }; [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] 70 ~ if data == "true" || data == "false" { [INFO] [stdout] 71 + true [INFO] [stdout] 72 ~ } else { false } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this if-then-else expression returns a bool literal [INFO] [stdout] --> src/optimize.rs:70:16 [INFO] [stdout] | [INFO] [stdout] 70 | return if data == "true" || data == "false" { [INFO] [stdout] | ________________^ [INFO] [stdout] 71 | | true [INFO] [stdout] 72 | | } else { false }; [INFO] [stdout] | |________________________^ help: you can reduce it to: `data == "true" || data == "false"` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_bool [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: module has the same name as its containing module [INFO] [stdout] --> src/log.rs:16:1 [INFO] [stdout] | [INFO] [stdout] 16 | / pub mod log { [INFO] [stdout] 17 | | use crate::{ [INFO] [stdout] 18 | | log::{LogTypes}, [INFO] [stdout] 19 | | read::{GreteaFileData} [INFO] [stdout] ... | [INFO] [stdout] 47 | | } [INFO] [stdout] | |_^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#module_inception [INFO] [stdout] = note: `#[warn(clippy::module_inception)]` 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/main.rs:59:5 [INFO] [stdout] | [INFO] [stdout] 59 | / match std::fs::remove_file(filename) { [INFO] [stdout] 60 | | Err(_) => panic!("gretea: failed to remove {}", filename), [INFO] [stdout] 61 | | _ => {} [INFO] [stdout] 62 | | } [INFO] [stdout] | |_____^ help: try: `if let Err(_) = std::fs::remove_file(filename) { panic!("gretea: failed to remove {}", filename) }` [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] [INFO] [stdout] [INFO] [stdout] warning: called `Iterator::last` on a `DoubleEndedIterator`; this will needlessly iterate the entire iterator [INFO] [stdout] --> src/main.rs:103:56 [INFO] [stdout] | [INFO] [stdout] 103 | let object_name = header(normalize(file.0.split('/').last().unwrap().parse().unwrap())); [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] help: try [INFO] [stdout] | [INFO] [stdout] 103 - let object_name = header(normalize(file.0.split('/').last().unwrap().parse().unwrap())); [INFO] [stdout] 103 + let object_name = header(normalize(file.0.split('/').next_back().unwrap().parse().unwrap())); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unnecessary use of `to_owned` [INFO] [stdout] --> src/main.rs:132:21 [INFO] [stdout] | [INFO] [stdout] 132 | for file in files.to_owned() { [INFO] [stdout] | ^^^^^^^^^^^^^^^^ help: use: `files.iter().cloned()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_to_owned [INFO] [stdout] = note: `#[warn(clippy::unnecessary_to_owned)]` 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/main.rs:133:47 [INFO] [stdout] | [INFO] [stdout] 133 | remove_and_check(header(normalize(file.0.split('/') [INFO] [stdout] | _______________________________________________^ [INFO] [stdout] 134 | | .last() [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] help: try [INFO] [stdout] | [INFO] [stdout] 134 - .last() [INFO] [stdout] 134 + .next_back() [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: call to `.clone()` on a reference in this situation does nothing [INFO] [stdout] --> src/tokenizer.rs:147:63 [INFO] [stdout] | [INFO] [stdout] 147 | data.push_str(&*format!("{}{}", tokens.clone(), if is_seq { [INFO] [stdout] | ^^^^^^^^ help: remove this redundant call [INFO] [stdout] | [INFO] [stdout] = note: the type `str` does not implement `Clone`, so calling `clone` on `&str` copies the reference, which does not do anything and can be removed [INFO] [stdout] = note: `#[warn(noop_method_call)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: call to `.clone()` on a reference in this situation does nothing [INFO] [stdout] --> src/tokenizer.rs:156:59 [INFO] [stdout] | [INFO] [stdout] 156 | data.push_str(&*format!("{}{}", tokens.clone(), if tokens[1..] != *ESC { [INFO] [stdout] | ^^^^^^^^ help: remove this redundant call [INFO] [stdout] | [INFO] [stdout] = note: the type `str` does not implement `Clone`, so calling `clone` on `&str` copies the reference, which does not do anything and can be removed [INFO] [stdout] [INFO] [stdout] [INFO] [stderr] Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.08s [INFO] running `Command { std: "docker" "inspect" "10699001bb65bf3a0ce2322da4521d9d9a1e52b982678c7b1d1190b5472aab83", kill_on_drop: false }` [INFO] running `Command { std: "docker" "rm" "-f" "10699001bb65bf3a0ce2322da4521d9d9a1e52b982678c7b1d1190b5472aab83", kill_on_drop: false }` [INFO] [stdout] 10699001bb65bf3a0ce2322da4521d9d9a1e52b982678c7b1d1190b5472aab83