[INFO] cloning repository https://github.com/akneni/kiln [INFO] running `Command { std: "git" "-c" "credential.helper=" "-c" "credential.helper=/workspace/cargo-home/bin/git-credential-null" "clone" "--bare" "https://github.com/akneni/kiln" "/workspace/cache/git-repos/https%3A%2F%2Fgithub.com%2Fakneni%2Fkiln", kill_on_drop: false }` [INFO] [stderr] Cloning into bare repository '/workspace/cache/git-repos/https%3A%2F%2Fgithub.com%2Fakneni%2Fkiln'... [INFO] running `Command { std: "git" "rev-parse" "HEAD", kill_on_drop: false }` [INFO] [stdout] e44fbfcbeea910e860d81ec3cfbc1446fc7d7886 [INFO] linting akneni/kiln against nightly for clippy-nonminimal_bool-denied [INFO] running `Command { std: "git" "clone" "/workspace/cache/git-repos/https%3A%2F%2Fgithub.com%2Fakneni%2Fkiln" "/workspace/builds/worker-3-tc1/source", kill_on_drop: false }` [INFO] [stderr] Cloning into '/workspace/builds/worker-3-tc1/source'... [INFO] [stderr] done. [INFO] started tweaking git repo https://github.com/akneni/kiln [INFO] finished tweaking git repo https://github.com/akneni/kiln [INFO] tweaked toml for git repo https://github.com/akneni/kiln written to /workspace/builds/worker-3-tc1/source/Cargo.toml [INFO] validating manifest of git repo https://github.com/akneni/kiln 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/akneni/kiln already has a lockfile, it will not be regenerated [INFO] running `Command { std: CARGO_HOME="/workspace/cargo-home" RUSTUP_HOME="/workspace/rustup-home" "/workspace/cargo-home/bin/cargo" "+nightly" "fetch" "--manifest-path" "Cargo.toml", kill_on_drop: false }` [INFO] [stderr] Downloading crates ... [INFO] [stderr] Downloaded xattr v1.4.0 [INFO] [stderr] Downloaded windows-link v0.1.2 [INFO] [stderr] Downloaded bitflags v2.7.0 [INFO] [stderr] Downloaded tar v0.4.43 [INFO] [stderr] Downloaded serde_json v1.0.135 [INFO] [stderr] Downloaded cc v1.2.9 [INFO] [stderr] Downloaded rustix v0.38.43 [INFO] running `Command { std: "docker" "create" "-v" "/var/lib/crater-agent-workspace/builds/worker-3-tc1/target:/opt/rustwide/target:rw,Z" "-v" "/var/lib/crater-agent-workspace/builds/worker-3-tc1/source:/opt/rustwide/workdir:ro,Z" "-v" "/var/lib/crater-agent-workspace/cargo-home:/opt/rustwide/cargo-home:ro,Z" "-v" "/var/lib/crater-agent-workspace/rustup-home:/opt/rustwide/rustup-home:ro,Z" "-e" "SOURCE_DIR=/opt/rustwide/workdir" "-e" "CARGO_TARGET_DIR=/opt/rustwide/target" "-e" "CARGO_HOME=/opt/rustwide/cargo-home" "-e" "RUSTUP_HOME=/opt/rustwide/rustup-home" "-w" "/opt/rustwide/workdir" "-m" "1610612736" "--user" "0:0" "--network" "none" "ghcr.io/rust-lang/crates-build-env/linux@sha256:d429b63d4308055ea97f60fb1d3dfca48854a00942f1bd2ad806beaf015945ec" "/opt/rustwide/cargo-home/bin/cargo" "+nightly" "metadata" "--no-deps" "--format-version=1", kill_on_drop: false }` [INFO] [stdout] bb60cad7ff6b0868c3e1f8ba216b2975adad5232c35144f416ba08e73f219ac3 [INFO] running `Command { std: "docker" "start" "-a" "bb60cad7ff6b0868c3e1f8ba216b2975adad5232c35144f416ba08e73f219ac3", kill_on_drop: false }` [INFO] running `Command { std: "docker" "inspect" "bb60cad7ff6b0868c3e1f8ba216b2975adad5232c35144f416ba08e73f219ac3", kill_on_drop: false }` [INFO] running `Command { std: "docker" "rm" "-f" "bb60cad7ff6b0868c3e1f8ba216b2975adad5232c35144f416ba08e73f219ac3", kill_on_drop: false }` [INFO] [stdout] bb60cad7ff6b0868c3e1f8ba216b2975adad5232c35144f416ba08e73f219ac3 [INFO] running `Command { std: "docker" "create" "-v" "/var/lib/crater-agent-workspace/builds/worker-3-tc1/target:/opt/rustwide/target:rw,Z" "-v" "/var/lib/crater-agent-workspace/builds/worker-3-tc1/source:/opt/rustwide/workdir:ro,Z" "-v" "/var/lib/crater-agent-workspace/cargo-home:/opt/rustwide/cargo-home:ro,Z" "-v" "/var/lib/crater-agent-workspace/rustup-home:/opt/rustwide/rustup-home:ro,Z" "-e" "SOURCE_DIR=/opt/rustwide/workdir" "-e" "CARGO_TARGET_DIR=/opt/rustwide/target" "-e" "CARGO_INCREMENTAL=0" "-e" "RUST_BACKTRACE=full" "-e" "RUSTFLAGS=--cap-lints=forbid" "-e" "RUSTDOCFLAGS=--cap-lints=forbid" "-e" "CARGO_HOME=/opt/rustwide/cargo-home" "-e" "RUSTUP_HOME=/opt/rustwide/rustup-home" "-w" "/opt/rustwide/workdir" "-m" "1610612736" "--user" "0:0" "--network" "none" "ghcr.io/rust-lang/crates-build-env/linux@sha256:d429b63d4308055ea97f60fb1d3dfca48854a00942f1bd2ad806beaf015945ec" "/opt/rustwide/cargo-home/bin/cargo" "+nightly" "clippy" "--frozen" "--all" "--all-targets" "--message-format=json", kill_on_drop: false }` [INFO] [stdout] abc5fc21ed41d6cf23e87965b1ddd59f34b5cea9547e2b166c9a53728f60c509 [INFO] running `Command { std: "docker" "start" "-a" "abc5fc21ed41d6cf23e87965b1ddd59f34b5cea9547e2b166c9a53728f60c509", kill_on_drop: false }` [INFO] [stderr] Compiling proc-macro2 v1.0.93 [INFO] [stderr] Compiling unicode-ident v1.0.14 [INFO] [stderr] Checking smallvec v1.13.2 [INFO] [stderr] Checking bytes v1.9.0 [INFO] [stderr] Checking itoa v1.0.14 [INFO] [stderr] Compiling cc v1.2.9 [INFO] [stderr] Checking bitflags v2.7.0 [INFO] [stderr] Compiling pkg-config v0.3.31 [INFO] [stderr] Checking litemap v0.7.4 [INFO] [stderr] Checking writeable v0.5.5 [INFO] [stderr] Checking signal-hook-registry v1.4.2 [INFO] [stderr] Checking socket2 v0.5.10 [INFO] [stderr] Checking indexmap v2.7.0 [INFO] [stderr] Checking icu_locid_transform_data v1.5.0 [INFO] [stderr] Compiling openssl v0.10.68 [INFO] [stderr] Compiling httparse v1.9.5 [INFO] [stderr] Checking icu_properties_data v1.5.0 [INFO] [stderr] Checking tracing v0.1.41 [INFO] [stderr] Checking utf16_iter v1.0.5 [INFO] [stderr] Checking parking_lot_core v0.9.10 [INFO] [stderr] Compiling rustix v0.38.43 [INFO] [stderr] Checking log v0.4.22 [INFO] [stderr] Compiling native-tls v0.2.12 [INFO] [stderr] Checking write16 v1.0.0 [INFO] [stderr] Checking icu_normalizer_data v1.5.0 [INFO] [stderr] Checking linux-raw-sys v0.4.15 [INFO] [stderr] Compiling rustversion v1.0.19 [INFO] [stderr] Checking ipnet v2.10.1 [INFO] [stderr] Checking adler2 v2.0.0 [INFO] [stderr] Checking parking_lot v0.12.3 [INFO] [stderr] Checking iri-string v0.7.8 [INFO] [stderr] Checking winnow v0.6.24 [INFO] [stderr] Compiling serde_json v1.0.135 [INFO] [stderr] Compiling thiserror v2.0.11 [INFO] [stderr] Checking miniz_oxide v0.8.9 [INFO] [stderr] Checking clap_builder v4.5.40 [INFO] [stderr] Checking getrandom v0.2.15 [INFO] [stderr] Checking http v1.2.0 [INFO] [stderr] Checking encoding_rs v0.8.35 [INFO] [stderr] Checking xml-rs v0.8.25 [INFO] [stderr] Checking memchr v2.7.4 [INFO] [stderr] Checking rustls-pki-types v1.10.1 [INFO] [stderr] Checking flate2 v1.1.2 [INFO] [stderr] Checking colored v2.2.0 [INFO] [stderr] Checking home v0.5.11 [INFO] [stderr] Checking strum v0.27.1 [INFO] [stderr] Compiling quote v1.0.38 [INFO] [stderr] Compiling syn v2.0.96 [INFO] [stderr] Compiling openssl-sys v0.9.104 [INFO] [stderr] Checking http-body v1.0.1 [INFO] [stderr] Checking http-body-util v0.1.2 [INFO] [stderr] Checking xattr v1.4.0 [INFO] [stderr] Checking tempfile v3.15.0 [INFO] [stderr] Checking tar v0.4.43 [INFO] [stderr] Compiling synstructure v0.13.1 [INFO] [stderr] Compiling zerofrom-derive v0.1.5 [INFO] [stderr] Compiling yoke-derive v0.7.5 [INFO] [stderr] Compiling zerovec-derive v0.10.3 [INFO] [stderr] Compiling displaydoc v0.2.5 [INFO] [stderr] Compiling serde_derive v1.0.219 [INFO] [stderr] Compiling tokio-macros v2.5.0 [INFO] [stderr] Compiling icu_provider_macros v1.5.0 [INFO] [stderr] Compiling openssl-macros v0.1.1 [INFO] [stderr] Compiling thiserror-impl v1.0.69 [INFO] [stderr] Compiling clap_derive v4.5.40 [INFO] [stderr] Compiling thiserror-impl v2.0.11 [INFO] [stderr] Compiling strum_macros v0.27.1 [INFO] [stderr] Checking zerofrom v0.1.5 [INFO] [stderr] Checking tokio v1.43.0 [INFO] [stderr] Checking thiserror v1.0.69 [INFO] [stderr] Checking yoke v0.7.5 [INFO] [stderr] Checking zerovec v0.10.4 [INFO] [stderr] Checking tinystr v0.7.6 [INFO] [stderr] Checking icu_collections v1.5.0 [INFO] [stderr] Checking clap v4.5.40 [INFO] [stderr] Checking icu_locid v1.5.0 [INFO] [stderr] Checking icu_provider v1.5.0 [INFO] [stderr] Checking serde v1.0.219 [INFO] [stderr] Checking icu_locid_transform v1.5.0 [INFO] [stderr] Checking icu_properties v1.5.1 [INFO] [stderr] Checking serde_spanned v0.6.8 [INFO] [stderr] Checking toml_datetime v0.6.8 [INFO] [stderr] Checking serde_urlencoded v0.7.1 [INFO] [stderr] Checking serde-xml-rs v0.6.0 [INFO] [stderr] Checking serde_yaml v0.9.34+deprecated [INFO] [stderr] Checking toml_edit v0.22.22 [INFO] [stderr] Checking tokio-util v0.7.13 [INFO] [stderr] Checking tokio-native-tls v0.3.1 [INFO] [stderr] Checking tower v0.5.2 [INFO] [stderr] Checking icu_normalizer v1.5.0 [INFO] [stderr] Checking h2 v0.4.7 [INFO] [stderr] Checking tower-http v0.6.6 [INFO] [stderr] Checking idna_adapter v1.2.0 [INFO] [stderr] Checking idna v1.0.3 [INFO] [stderr] Checking url v2.5.4 [INFO] [stderr] Checking toml v0.8.19 [INFO] [stderr] Checking hyper v1.6.0 [INFO] [stderr] Checking hyper-util v0.1.14 [INFO] [stderr] Checking hyper-tls v0.6.0 [INFO] [stderr] Checking reqwest v0.12.20 [INFO] [stderr] Checking kiln v0.1.6 (/opt/rustwide/workdir) [INFO] [stdout] warning: this import is redundant [INFO] [stdout] --> src/config.rs:7:1 [INFO] [stdout] | [INFO] [stdout] 7 | use toml; [INFO] [stdout] | ^^^^^^^^^ help: remove it entirely [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_component_path_imports [INFO] [stdout] = note: `#[warn(clippy::single_component_path_imports)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this import is redundant [INFO] [stdout] --> src/config.rs:7:1 [INFO] [stdout] | [INFO] [stdout] 7 | use toml; [INFO] [stdout] | ^^^^^^^^^ help: remove it entirely [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_component_path_imports [INFO] [stdout] = note: `#[warn(clippy::single_component_path_imports)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: enum `DepType` is never used [INFO] [stdout] --> src/packaging/package_manager.rs:57:10 [INFO] [stdout] | [INFO] [stdout] 57 | pub enum DepType { [INFO] [stdout] | ^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the borrowed expression implements the required traits [INFO] [stdout] --> src/build_sys.rs:29:20 [INFO] [stdout] | [INFO] [stdout] 29 | fs::create_dir(&path.join("src"))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^ help: change this to: `path.join("src")` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args [INFO] [stdout] = note: `#[warn(clippy::needless_borrows_for_generic_args)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the borrowed expression implements the required traits [INFO] [stdout] --> src/build_sys.rs:34:23 [INFO] [stdout] | [INFO] [stdout] 34 | fs::write(&source_dir.join("main.c"), starter_code)?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `source_dir.join("main.c")` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the borrowed expression implements the required traits [INFO] [stdout] --> src/build_sys.rs:38:23 [INFO] [stdout] | [INFO] [stdout] 38 | fs::write(&source_dir.join("main.cpp"), starter_code)?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `source_dir.join("main.cpp")` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unnecessary `if let` since only the `Ok` variant of the iterator element is used [INFO] [stdout] --> src/build_sys.rs:63:5 [INFO] [stdout] | [INFO] [stdout] 63 | / for file in source_dir_iter { [INFO] [stdout] 64 | | if let Ok(file) = file { [INFO] [stdout] 65 | | let file = file.file_name(); [INFO] [stdout] 66 | | let filename = file.to_str().unwrap(); [INFO] [stdout] ... | [INFO] [stdout] 74 | | } [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] help: try `.flatten()` and remove the `if let` statement in the for loop [INFO] [stdout] --> src/build_sys.rs:64:9 [INFO] [stdout] | [INFO] [stdout] 64 | / if let Ok(file) = file { [INFO] [stdout] 65 | | let file = file.file_name(); [INFO] [stdout] 66 | | let filename = file.to_str().unwrap(); [INFO] [stdout] 67 | | if filename.ends_with(language.file_ext()) { [INFO] [stdout] ... | [INFO] [stdout] 73 | | } [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] 63 ~ for file in source_dir_iter.flatten() { [INFO] [stdout] 64 + let file = file.file_name(); [INFO] [stdout] 65 + let filename = file.to_str().unwrap(); [INFO] [stdout] 66 + if filename.ends_with(language.file_ext()) { [INFO] [stdout] 67 + let filepath = source_dir.join(filename); [INFO] [stdout] 68 + let filepath = filepath.to_str().unwrap().to_string(); [INFO] [stdout] 69 + [INFO] [stdout] 70 + out_buffer.push(filepath); [INFO] [stdout] 71 + } [INFO] [stdout] 72 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this function has too many arguments (8/7) [INFO] [stdout] --> src/build_sys.rs:171:1 [INFO] [stdout] | [INFO] [stdout] 171 | / pub fn full_compilation_cmd( [INFO] [stdout] 172 | | config: &Config, [INFO] [stdout] 173 | | profile: &str, [INFO] [stdout] 174 | | link_file: &Vec, [INFO] [stdout] ... | [INFO] [stdout] 179 | | build_type: config::BuildType, [INFO] [stdout] 180 | | ) -> Result> { [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/build_sys.rs:174:16 [INFO] [stdout] | [INFO] [stdout] 174 | link_file: &Vec, [INFO] [stdout] | ^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg [INFO] [stdout] = note: `#[warn(clippy::ptr_arg)]` on by default [INFO] [stdout] help: change this to [INFO] [stdout] | [INFO] [stdout] 174 - link_file: &Vec, [INFO] [stdout] 174 + link_file: &[String], [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/build_sys.rs:175:15 [INFO] [stdout] | [INFO] [stdout] 175 | link_lib: &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] 175 - link_lib: &Vec, [INFO] [stdout] 175 + link_lib: &[String], [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/build_sys.rs:178:12 [INFO] [stdout] | [INFO] [stdout] 178 | flags: &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] 178 - flags: &Vec, [INFO] [stdout] 178 + flags: &[String], [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant pattern matching, consider using `is_some()` [INFO] [stdout] --> src/build_sys.rs:302:12 [INFO] [stdout] | [INFO] [stdout] 302 | if let Some(_) = packages.get(&dep_id) { [INFO] [stdout] | -------^^^^^^^------------------------ help: try: `if packages.get(&dep_id).is_some()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pattern_matching [INFO] [stdout] = note: `#[warn(clippy::redundant_pattern_matching)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: enum `DepType` is never used [INFO] [stdout] --> src/packaging/package_manager.rs:57:10 [INFO] [stdout] | [INFO] [stdout] 57 | pub enum DepType { [INFO] [stdout] | ^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the borrowed expression implements the required traits [INFO] [stdout] --> src/build_sys.rs:29:20 [INFO] [stdout] | [INFO] [stdout] 29 | fs::create_dir(&path.join("src"))?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^ help: change this to: `path.join("src")` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args [INFO] [stdout] = note: `#[warn(clippy::needless_borrows_for_generic_args)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the borrowed expression implements the required traits [INFO] [stdout] --> src/build_sys.rs:34:23 [INFO] [stdout] | [INFO] [stdout] 34 | fs::write(&source_dir.join("main.c"), starter_code)?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `source_dir.join("main.c")` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the borrowed expression implements the required traits [INFO] [stdout] --> src/build_sys.rs:38:23 [INFO] [stdout] | [INFO] [stdout] 38 | fs::write(&source_dir.join("main.cpp"), starter_code)?; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `source_dir.join("main.cpp")` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unnecessary `if let` since only the `Ok` variant of the iterator element is used [INFO] [stdout] --> src/build_sys.rs:63:5 [INFO] [stdout] | [INFO] [stdout] 63 | / for file in source_dir_iter { [INFO] [stdout] 64 | | if let Ok(file) = file { [INFO] [stdout] 65 | | let file = file.file_name(); [INFO] [stdout] 66 | | let filename = file.to_str().unwrap(); [INFO] [stdout] ... | [INFO] [stdout] 74 | | } [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] help: try `.flatten()` and remove the `if let` statement in the for loop [INFO] [stdout] --> src/build_sys.rs:64:9 [INFO] [stdout] | [INFO] [stdout] 64 | / if let Ok(file) = file { [INFO] [stdout] 65 | | let file = file.file_name(); [INFO] [stdout] 66 | | let filename = file.to_str().unwrap(); [INFO] [stdout] 67 | | if filename.ends_with(language.file_ext()) { [INFO] [stdout] ... | [INFO] [stdout] 73 | | } [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] 63 ~ for file in source_dir_iter.flatten() { [INFO] [stdout] 64 + let file = file.file_name(); [INFO] [stdout] 65 + let filename = file.to_str().unwrap(); [INFO] [stdout] 66 + if filename.ends_with(language.file_ext()) { [INFO] [stdout] 67 + let filepath = source_dir.join(filename); [INFO] [stdout] 68 + let filepath = filepath.to_str().unwrap().to_string(); [INFO] [stdout] 69 + [INFO] [stdout] 70 + out_buffer.push(filepath); [INFO] [stdout] 71 + } [INFO] [stdout] 72 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this function has too many arguments (8/7) [INFO] [stdout] --> src/build_sys.rs:171:1 [INFO] [stdout] | [INFO] [stdout] 171 | / pub fn full_compilation_cmd( [INFO] [stdout] 172 | | config: &Config, [INFO] [stdout] 173 | | profile: &str, [INFO] [stdout] 174 | | link_file: &Vec, [INFO] [stdout] ... | [INFO] [stdout] 179 | | build_type: config::BuildType, [INFO] [stdout] 180 | | ) -> Result> { [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/build_sys.rs:174:16 [INFO] [stdout] | [INFO] [stdout] 174 | link_file: &Vec, [INFO] [stdout] | ^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg [INFO] [stdout] = note: `#[warn(clippy::ptr_arg)]` on by default [INFO] [stdout] help: change this to [INFO] [stdout] | [INFO] [stdout] 174 - link_file: &Vec, [INFO] [stdout] 174 + link_file: &[String], [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/build_sys.rs:175:15 [INFO] [stdout] | [INFO] [stdout] 175 | link_lib: &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] 175 - link_lib: &Vec, [INFO] [stdout] 175 + link_lib: &[String], [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/build_sys.rs:178:12 [INFO] [stdout] | [INFO] [stdout] 178 | flags: &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] 178 - flags: &Vec, [INFO] [stdout] 178 + flags: &[String], [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: length comparison to zero [INFO] [stdout] --> src/config.rs:48:12 [INFO] [stdout] | [INFO] [stdout] 48 | if build_types.len() == 0 { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `build_types.is_empty()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero [INFO] [stdout] = note: `#[warn(clippy::len_zero)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant pattern matching, consider using `is_some()` [INFO] [stdout] --> src/build_sys.rs:302:12 [INFO] [stdout] | [INFO] [stdout] 302 | if let Some(_) = packages.get(&dep_id) { [INFO] [stdout] | -------^^^^^^^------------------------ help: try: `if packages.get(&dep_id).is_some()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pattern_matching [INFO] [stdout] = note: `#[warn(clippy::redundant_pattern_matching)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/config.rs:231:53 [INFO] [stdout] | [INFO] [stdout] 231 | return Ok(Some(utils::join_rel_path(&p, &include_dir))); [INFO] [stdout] | ^^^^^^^^^^^^ help: change this to: `include_dir` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow [INFO] [stdout] = note: `#[warn(clippy::needless_borrow)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the borrowed expression implements the required traits [INFO] [stdout] --> src/config.rs:237:35 [INFO] [stdout] | [INFO] [stdout] 237 | return Ok(Some(p.join(&config.get_include_dir()))); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `config.get_include_dir()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/config.rs:253:53 [INFO] [stdout] | [INFO] [stdout] 253 | return Ok(Some(utils::join_rel_path(&p, &source_dir))); [INFO] [stdout] | ^^^^^^^^^^^ help: change this to: `source_dir` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the borrowed expression implements the required traits [INFO] [stdout] --> src/config.rs:259:35 [INFO] [stdout] | [INFO] [stdout] 259 | return Ok(Some(p.join(&config.get_src_dir()))); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^ help: change this to: `config.get_src_dir()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/constants.rs:30:43 [INFO] [stdout] | [INFO] [stdout] 30 | let user_path_s = expand_user(&user_path); [INFO] [stdout] | ^^^^^^^^^^ help: change this to: `user_path` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is used to index `TOKEN_MAPPING` [INFO] [stdout] --> src/header_gen/lexer_c.rs:59:26 [INFO] [stdout] | [INFO] [stdout] 59 | for i in 0..TOKEN_MAPPING.len() { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] = note: `#[warn(clippy::needless_range_loop)]` on by default [INFO] [stdout] help: consider using an iterator and enumerate() [INFO] [stdout] | [INFO] [stdout] 59 - for i in 0..TOKEN_MAPPING.len() { [INFO] [stdout] 59 + for (i, ) in TOKEN_MAPPING.iter().enumerate() { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: length comparison to zero [INFO] [stdout] --> src/config.rs:48:12 [INFO] [stdout] | [INFO] [stdout] 48 | if build_types.len() == 0 { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `build_types.is_empty()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero [INFO] [stdout] = note: `#[warn(clippy::len_zero)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/header_gen/lexer_c.rs:155:5 [INFO] [stdout] | [INFO] [stdout] 155 | return curr_idx; [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] 155 - return curr_idx; [INFO] [stdout] 155 + curr_idx [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/header_gen/lexer_c.rs:148:9 [INFO] [stdout] | [INFO] [stdout] 148 | / if ascii_char < TOKEN_MAPPING.len() { [INFO] [stdout] 149 | | if TOKEN_MAPPING[ascii_char].is_some() || ascii_char == ' ' as usize { [INFO] [stdout] 150 | | return curr_idx; [INFO] [stdout] 151 | | } [INFO] [stdout] 152 | | } [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] 148 ~ if ascii_char < TOKEN_MAPPING.len() [INFO] [stdout] 149 ~ && (TOKEN_MAPPING[ascii_char].is_some() || ascii_char == ' ' as usize) { [INFO] [stdout] 150 | return curr_idx; [INFO] [stdout] 151 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: casting a character literal to `u8` truncates [INFO] [stdout] --> src/header_gen/lexer_c.rs:162:31 [INFO] [stdout] | [INFO] [stdout] 162 | if code_bytes[idx] == '\n' as u8 { [INFO] [stdout] | ^^^^^^^^^^ help: use a byte literal instead: `b'\n'` [INFO] [stdout] | [INFO] [stdout] = note: `char` is four bytes wide, but `u8` is a single byte [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#char_lit_as_u8 [INFO] [stdout] = note: `#[warn(clippy::char_lit_as_u8)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/header_gen/lexer_c.rs:165:9 [INFO] [stdout] | [INFO] [stdout] 165 | / if code_bytes[idx] == '"' as u8 { [INFO] [stdout] 166 | | if code_bytes[idx] != '\\' as u8 { [INFO] [stdout] 167 | | idx += 1; [INFO] [stdout] 168 | | return Ok(idx); [INFO] [stdout] 169 | | } [INFO] [stdout] 170 | | } [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] 165 ~ if code_bytes[idx] == '"' as u8 [INFO] [stdout] 166 ~ && code_bytes[idx] != '\\' as u8 { [INFO] [stdout] 167 | idx += 1; [INFO] [stdout] 168 | return Ok(idx); [INFO] [stdout] 169 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: casting a character literal to `u8` truncates [INFO] [stdout] --> src/header_gen/lexer_c.rs:165:31 [INFO] [stdout] | [INFO] [stdout] 165 | if code_bytes[idx] == '"' as u8 { [INFO] [stdout] | ^^^^^^^^^ help: use a byte literal instead: `b'"'` [INFO] [stdout] | [INFO] [stdout] = note: `char` is four bytes wide, but `u8` is a single byte [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#char_lit_as_u8 [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: casting a character literal to `u8` truncates [INFO] [stdout] --> src/header_gen/lexer_c.rs:166:35 [INFO] [stdout] | [INFO] [stdout] 166 | if code_bytes[idx] != '\\' as u8 { [INFO] [stdout] | ^^^^^^^^^^ help: use a byte literal instead: `b'\\'` [INFO] [stdout] | [INFO] [stdout] = note: `char` is four bytes wide, but `u8` is a single byte [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#char_lit_as_u8 [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: casting a character literal to `u8` truncates [INFO] [stdout] --> src/header_gen/lexer_c.rs:179:29 [INFO] [stdout] | [INFO] [stdout] 179 | if code_bytes[0] != '/' as u8 || !(matches!(code_bytes[1] as char, '*' | '/')){ [INFO] [stdout] | ^^^^^^^^^ help: use a byte literal instead: `b'/'` [INFO] [stdout] | [INFO] [stdout] = note: `char` is four bytes wide, but `u8` is a single byte [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#char_lit_as_u8 [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: casting a character literal to `u8` truncates [INFO] [stdout] --> src/header_gen/lexer_c.rs:188:39 [INFO] [stdout] | [INFO] [stdout] 188 | if code_bytes[idx] == '*' as u8 && code_bytes[idx+1] == '/' as u8 { [INFO] [stdout] | ^^^^^^^^^ help: use a byte literal instead: `b'*'` [INFO] [stdout] | [INFO] [stdout] = note: `char` is four bytes wide, but `u8` is a single byte [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#char_lit_as_u8 [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: casting a character literal to `u8` truncates [INFO] [stdout] --> src/header_gen/lexer_c.rs:188:73 [INFO] [stdout] | [INFO] [stdout] 188 | if code_bytes[idx] == '*' as u8 && code_bytes[idx+1] == '/' as u8 { [INFO] [stdout] | ^^^^^^^^^ help: use a byte literal instead: `b'/'` [INFO] [stdout] | [INFO] [stdout] = note: `char` is four bytes wide, but `u8` is a single byte [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#char_lit_as_u8 [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: casting a character literal to `u8` truncates [INFO] [stdout] --> src/header_gen/lexer_c.rs:196:64 [INFO] [stdout] | [INFO] [stdout] 196 | while idx < code_bytes.len() && code_bytes[idx] != '\n' as u8 { [INFO] [stdout] | ^^^^^^^^^^ help: use a byte literal instead: `b'\n'` [INFO] [stdout] | [INFO] [stdout] = note: `char` is four bytes wide, but `u8` is a single byte [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#char_lit_as_u8 [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` can be collapsed into the outer `match` [INFO] [stdout] --> src/header_gen/lexer_c.rs:561:33 [INFO] [stdout] | [INFO] [stdout] 561 | / ... if curlybrace_stack == 0 { [INFO] [stdout] 562 | | ... if conditions.iter().all(|&i| i) { [INFO] [stdout] 563 | | ... let x = &tokens[start_idx..=idx]; [INFO] [stdout] 564 | | ... udts.push(x); [INFO] [stdout] 565 | | ... } [INFO] [stdout] 566 | | ... break; [INFO] [stdout] 567 | | ... } [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] 560 ~ Token::Semicolon [INFO] [stdout] 561 ~ if curlybrace_stack == 0 => { [INFO] [stdout] 562 | if conditions.iter().all(|&i| i) { [INFO] [stdout] ... [INFO] [stdout] 566 | break; [INFO] [stdout] 567 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the following explicit lifetimes could be elided: 'a [INFO] [stdout] --> src/header_gen/lexer_c.rs:714:25 [INFO] [stdout] | [INFO] [stdout] 714 | pub fn get_include_name<'a>(tokens: &'a [Token]) -> String { [INFO] [stdout] | ^^ ^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes [INFO] [stdout] = note: `#[warn(clippy::needless_lifetimes)]` on by default [INFO] [stdout] help: elide the lifetimes [INFO] [stdout] | [INFO] [stdout] 714 - pub fn get_include_name<'a>(tokens: &'a [Token]) -> String { [INFO] [stdout] 714 + pub fn get_include_name(tokens: &[Token]) -> String { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/header_gen/lexer_c.rs:730:13 [INFO] [stdout] | [INFO] [stdout] 730 | return Token::tokens_to_string(&tokens[(idx+1)..end_idx]); [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] 730 - return Token::tokens_to_string(&tokens[(idx+1)..end_idx]); [INFO] [stdout] 730 + Token::tokens_to_string(&tokens[(idx+1)..end_idx]) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/header_gen/lexer_c.rs:733:13 [INFO] [stdout] | [INFO] [stdout] 733 | return s.trim_end_matches('"').to_string(); [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] 733 - return s.trim_end_matches('"').to_string(); [INFO] [stdout] 733 + s.trim_end_matches('"').to_string() [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is used to index `tokens` [INFO] [stdout] --> src/header_gen/lexer_c.rs:742:14 [INFO] [stdout] | [INFO] [stdout] 742 | for i in (*idx + 1)..tokens.len() { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator and enumerate() [INFO] [stdout] | [INFO] [stdout] 742 - for i in (*idx + 1)..tokens.len() { [INFO] [stdout] 742 + for (i, ) in tokens.iter().enumerate().skip((*idx + 1)) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is used to index `tokens` [INFO] [stdout] --> src/header_gen/lexer_c.rs:756:14 [INFO] [stdout] | [INFO] [stdout] 756 | for i in (*idx + 1)..tokens.len() { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator and enumerate() [INFO] [stdout] | [INFO] [stdout] 756 - for i in (*idx + 1)..tokens.len() { [INFO] [stdout] 756 + for (i, ) in tokens.iter().enumerate().skip((*idx + 1)) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: useless use of `format!` [INFO] [stdout] --> src/header_gen/lexer_c.rs:819:55 [INFO] [stdout] | [INFO] [stdout] 819 | fs::write("tests/lexer.test_get_defines.log", format!("{}", log_dump)).unwrap(); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `log_dump.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: useless use of `format!` [INFO] [stdout] --> src/header_gen/lexer_c.rs:840:52 [INFO] [stdout] | [INFO] [stdout] 840 | fs::write("tests/lexer.test_get_udts.log", format!("{}", log_dump)).unwrap(); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `log_dump.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 use of `format!` [INFO] [stdout] --> src/header_gen/lexer_c.rs:885:56 [INFO] [stdout] | [INFO] [stdout] 885 | fs::write("tests/lexer.test_get_udt_name.log", format!("{}", dump)).unwrap(); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `dump.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: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/config.rs:231:53 [INFO] [stdout] | [INFO] [stdout] 231 | return Ok(Some(utils::join_rel_path(&p, &include_dir))); [INFO] [stdout] | ^^^^^^^^^^^^ help: change this to: `include_dir` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow [INFO] [stdout] = note: `#[warn(clippy::needless_borrow)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the borrowed expression implements the required traits [INFO] [stdout] --> src/config.rs:237:35 [INFO] [stdout] | [INFO] [stdout] 237 | return Ok(Some(p.join(&config.get_include_dir()))); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `config.get_include_dir()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/config.rs:253:53 [INFO] [stdout] | [INFO] [stdout] 253 | return Ok(Some(utils::join_rel_path(&p, &source_dir))); [INFO] [stdout] | ^^^^^^^^^^^ help: change this to: `source_dir` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the borrowed expression implements the required traits [INFO] [stdout] --> src/config.rs:259:35 [INFO] [stdout] | [INFO] [stdout] 259 | return Ok(Some(p.join(&config.get_src_dir()))); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^ help: change this to: `config.get_src_dir()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/constants.rs:30:43 [INFO] [stdout] | [INFO] [stdout] 30 | let user_path_s = expand_user(&user_path); [INFO] [stdout] | ^^^^^^^^^^ help: change this to: `user_path` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: length comparison to zero [INFO] [stdout] --> src/header_gen/mod.rs:106:8 [INFO] [stdout] | [INFO] [stdout] 106 | if code_lines.len() == 0 { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `code_lines.is_empty()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do [INFO] [stdout] --> src/header_gen/mod.rs:117:15 [INFO] [stdout] | [INFO] [stdout] 117 | includes: &Vec<&'a [lexer_c::Token]>, [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg [INFO] [stdout] help: change this to [INFO] [stdout] | [INFO] [stdout] 117 ~ includes: &[&'a [lexer_c::Token]], [INFO] [stdout] 118 | file_name: &str, [INFO] [stdout] ... [INFO] [stdout] 125 | [INFO] [stdout] 126 ~ includes.to_owned() [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` has identical blocks [INFO] [stdout] --> src/header_gen/mod.rs:131:46 [INFO] [stdout] | [INFO] [stdout] 131 | if s == &include_str_name[0] { [INFO] [stdout] | ______________________________________________^ [INFO] [stdout] 132 | | return false; [INFO] [stdout] 133 | | } else if include_str_name[1..] [INFO] [stdout] | |_________________^ [INFO] [stdout] | [INFO] [stdout] note: same as this [INFO] [stdout] --> src/header_gen/mod.rs:136:17 [INFO] [stdout] | [INFO] [stdout] 136 | / { [INFO] [stdout] 137 | | return false; [INFO] [stdout] 138 | | } [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: the loop variable `i` is used to index `TOKEN_MAPPING` [INFO] [stdout] --> src/header_gen/lexer_c.rs:59:26 [INFO] [stdout] | [INFO] [stdout] 59 | for i in 0..TOKEN_MAPPING.len() { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] = note: `#[warn(clippy::needless_range_loop)]` on by default [INFO] [stdout] help: consider using an iterator and enumerate() [INFO] [stdout] | [INFO] [stdout] 59 - for i in 0..TOKEN_MAPPING.len() { [INFO] [stdout] 59 + for (i, ) in TOKEN_MAPPING.iter().enumerate() { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/header_gen/lexer_c.rs:155:5 [INFO] [stdout] | [INFO] [stdout] 155 | return curr_idx; [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] 155 - return curr_idx; [INFO] [stdout] 155 + curr_idx [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/header_gen/lexer_c.rs:148:9 [INFO] [stdout] | [INFO] [stdout] 148 | / if ascii_char < TOKEN_MAPPING.len() { [INFO] [stdout] 149 | | if TOKEN_MAPPING[ascii_char].is_some() || ascii_char == ' ' as usize { [INFO] [stdout] 150 | | return curr_idx; [INFO] [stdout] 151 | | } [INFO] [stdout] 152 | | } [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] 148 ~ if ascii_char < TOKEN_MAPPING.len() [INFO] [stdout] 149 ~ && (TOKEN_MAPPING[ascii_char].is_some() || ascii_char == ' ' as usize) { [INFO] [stdout] 150 | return curr_idx; [INFO] [stdout] 151 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: casting a character literal to `u8` truncates [INFO] [stdout] --> src/header_gen/lexer_c.rs:162:31 [INFO] [stdout] | [INFO] [stdout] 162 | if code_bytes[idx] == '\n' as u8 { [INFO] [stdout] | ^^^^^^^^^^ help: use a byte literal instead: `b'\n'` [INFO] [stdout] | [INFO] [stdout] = note: `char` is four bytes wide, but `u8` is a single byte [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#char_lit_as_u8 [INFO] [stdout] = note: `#[warn(clippy::char_lit_as_u8)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/header_gen/lexer_c.rs:165:9 [INFO] [stdout] | [INFO] [stdout] 165 | / if code_bytes[idx] == '"' as u8 { [INFO] [stdout] 166 | | if code_bytes[idx] != '\\' as u8 { [INFO] [stdout] 167 | | idx += 1; [INFO] [stdout] 168 | | return Ok(idx); [INFO] [stdout] 169 | | } [INFO] [stdout] 170 | | } [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] 165 ~ if code_bytes[idx] == '"' as u8 [INFO] [stdout] 166 ~ && code_bytes[idx] != '\\' as u8 { [INFO] [stdout] 167 | idx += 1; [INFO] [stdout] 168 | return Ok(idx); [INFO] [stdout] 169 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: casting a character literal to `u8` truncates [INFO] [stdout] --> src/header_gen/lexer_c.rs:165:31 [INFO] [stdout] | [INFO] [stdout] 165 | if code_bytes[idx] == '"' as u8 { [INFO] [stdout] | ^^^^^^^^^ help: use a byte literal instead: `b'"'` [INFO] [stdout] | [INFO] [stdout] = note: `char` is four bytes wide, but `u8` is a single byte [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#char_lit_as_u8 [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: casting a character literal to `u8` truncates [INFO] [stdout] --> src/header_gen/lexer_c.rs:166:35 [INFO] [stdout] | [INFO] [stdout] 166 | if code_bytes[idx] != '\\' as u8 { [INFO] [stdout] | ^^^^^^^^^^ help: use a byte literal instead: `b'\\'` [INFO] [stdout] | [INFO] [stdout] = note: `char` is four bytes wide, but `u8` is a single byte [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#char_lit_as_u8 [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: casting a character literal to `u8` truncates [INFO] [stdout] --> src/header_gen/lexer_c.rs:179:29 [INFO] [stdout] | [INFO] [stdout] 179 | if code_bytes[0] != '/' as u8 || !(matches!(code_bytes[1] as char, '*' | '/')){ [INFO] [stdout] | ^^^^^^^^^ help: use a byte literal instead: `b'/'` [INFO] [stdout] | [INFO] [stdout] = note: `char` is four bytes wide, but `u8` is a single byte [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#char_lit_as_u8 [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: casting a character literal to `u8` truncates [INFO] [stdout] --> src/header_gen/lexer_c.rs:188:39 [INFO] [stdout] | [INFO] [stdout] 188 | if code_bytes[idx] == '*' as u8 && code_bytes[idx+1] == '/' as u8 { [INFO] [stdout] | ^^^^^^^^^ help: use a byte literal instead: `b'*'` [INFO] [stdout] | [INFO] [stdout] = note: `char` is four bytes wide, but `u8` is a single byte [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#char_lit_as_u8 [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: casting a character literal to `u8` truncates [INFO] [stdout] --> src/header_gen/lexer_c.rs:188:73 [INFO] [stdout] | [INFO] [stdout] 188 | if code_bytes[idx] == '*' as u8 && code_bytes[idx+1] == '/' as u8 { [INFO] [stdout] | ^^^^^^^^^ help: use a byte literal instead: `b'/'` [INFO] [stdout] | [INFO] [stdout] = note: `char` is four bytes wide, but `u8` is a single byte [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#char_lit_as_u8 [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: casting a character literal to `u8` truncates [INFO] [stdout] --> src/header_gen/lexer_c.rs:196:64 [INFO] [stdout] | [INFO] [stdout] 196 | while idx < code_bytes.len() && code_bytes[idx] != '\n' as u8 { [INFO] [stdout] | ^^^^^^^^^^ help: use a byte literal instead: `b'\n'` [INFO] [stdout] | [INFO] [stdout] = note: `char` is four bytes wide, but `u8` is a single byte [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#char_lit_as_u8 [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: accessing first element with `default_configs.get(0)` [INFO] [stdout] --> src/local_dev/editors.rs:120:49 [INFO] [stdout] | [INFO] [stdout] 120 | if let Some(default_name) = default_configs [INFO] [stdout] | _________________________________________________^ [INFO] [stdout] 121 | | .get(0) [INFO] [stdout] | |_______________________________^ help: try: `default_configs.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: this `if` can be collapsed into the outer `match` [INFO] [stdout] --> src/header_gen/lexer_c.rs:561:33 [INFO] [stdout] | [INFO] [stdout] 561 | / ... if curlybrace_stack == 0 { [INFO] [stdout] 562 | | ... if conditions.iter().all(|&i| i) { [INFO] [stdout] 563 | | ... let x = &tokens[start_idx..=idx]; [INFO] [stdout] 564 | | ... udts.push(x); [INFO] [stdout] 565 | | ... } [INFO] [stdout] 566 | | ... break; [INFO] [stdout] 567 | | ... } [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] 560 ~ Token::Semicolon [INFO] [stdout] 561 ~ if curlybrace_stack == 0 => { [INFO] [stdout] 562 | if conditions.iter().all(|&i| i) { [INFO] [stdout] ... [INFO] [stdout] 566 | break; [INFO] [stdout] 567 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the following explicit lifetimes could be elided: 'a [INFO] [stdout] --> src/header_gen/lexer_c.rs:714:25 [INFO] [stdout] | [INFO] [stdout] 714 | pub fn get_include_name<'a>(tokens: &'a [Token]) -> String { [INFO] [stdout] | ^^ ^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes [INFO] [stdout] = note: `#[warn(clippy::needless_lifetimes)]` on by default [INFO] [stdout] help: elide the lifetimes [INFO] [stdout] | [INFO] [stdout] 714 - pub fn get_include_name<'a>(tokens: &'a [Token]) -> String { [INFO] [stdout] 714 + pub fn get_include_name(tokens: &[Token]) -> String { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/header_gen/lexer_c.rs:730:13 [INFO] [stdout] | [INFO] [stdout] 730 | return Token::tokens_to_string(&tokens[(idx+1)..end_idx]); [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] 730 - return Token::tokens_to_string(&tokens[(idx+1)..end_idx]); [INFO] [stdout] 730 + Token::tokens_to_string(&tokens[(idx+1)..end_idx]) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/header_gen/lexer_c.rs:733:13 [INFO] [stdout] | [INFO] [stdout] 733 | return s.trim_end_matches('"').to_string(); [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] 733 - return s.trim_end_matches('"').to_string(); [INFO] [stdout] 733 + s.trim_end_matches('"').to_string() [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is used to index `tokens` [INFO] [stdout] --> src/header_gen/lexer_c.rs:742:14 [INFO] [stdout] | [INFO] [stdout] 742 | for i in (*idx + 1)..tokens.len() { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator and enumerate() [INFO] [stdout] | [INFO] [stdout] 742 - for i in (*idx + 1)..tokens.len() { [INFO] [stdout] 742 + for (i, ) in tokens.iter().enumerate().skip((*idx + 1)) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is used to index `tokens` [INFO] [stdout] --> src/header_gen/lexer_c.rs:756:14 [INFO] [stdout] | [INFO] [stdout] 756 | for i in (*idx + 1)..tokens.len() { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator and enumerate() [INFO] [stdout] | [INFO] [stdout] 756 - for i in (*idx + 1)..tokens.len() { [INFO] [stdout] 756 + for (i, ) in tokens.iter().enumerate().skip((*idx + 1)) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: length comparison to zero [INFO] [stdout] --> src/header_gen/mod.rs:106:8 [INFO] [stdout] | [INFO] [stdout] 106 | if code_lines.len() == 0 { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `code_lines.is_empty()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do [INFO] [stdout] --> src/header_gen/mod.rs:117:15 [INFO] [stdout] | [INFO] [stdout] 117 | includes: &Vec<&'a [lexer_c::Token]>, [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg [INFO] [stdout] help: change this to [INFO] [stdout] | [INFO] [stdout] 117 ~ includes: &[&'a [lexer_c::Token]], [INFO] [stdout] 118 | file_name: &str, [INFO] [stdout] ... [INFO] [stdout] 125 | [INFO] [stdout] 126 ~ includes.to_owned() [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` has identical blocks [INFO] [stdout] --> src/header_gen/mod.rs:131:46 [INFO] [stdout] | [INFO] [stdout] 131 | if s == &include_str_name[0] { [INFO] [stdout] | ______________________________________________^ [INFO] [stdout] 132 | | return false; [INFO] [stdout] 133 | | } else if include_str_name[1..] [INFO] [stdout] | |_________________^ [INFO] [stdout] | [INFO] [stdout] note: same as this [INFO] [stdout] --> src/header_gen/mod.rs:136:17 [INFO] [stdout] | [INFO] [stdout] 136 | / { [INFO] [stdout] 137 | | return false; [INFO] [stdout] 138 | | } [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: an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true [INFO] [stdout] --> src/packaging/package_manager.rs:76:1 [INFO] [stdout] | [INFO] [stdout] 76 | impl Into<&str> for DepType { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: `impl From for Foreign` is allowed by the orphan rules, for more information see [INFO] [stdout] https://doc.rust-lang.org/reference/items/implementations.html#trait-implementation-coherence [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#from_over_into [INFO] [stdout] = note: `#[warn(clippy::from_over_into)]` on by default [INFO] [stdout] help: replace the `Into` implementation with `From` [INFO] [stdout] | [INFO] [stdout] 76 ~ impl From for &str { [INFO] [stdout] 77 ~ fn from(val: DepType) -> Self { [INFO] [stdout] 78 ~ match val { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: accessing first element with `default_configs.get(0)` [INFO] [stdout] --> src/local_dev/editors.rs:120:49 [INFO] [stdout] | [INFO] [stdout] 120 | if let Some(default_name) = default_configs [INFO] [stdout] | _________________________________________________^ [INFO] [stdout] 121 | | .get(0) [INFO] [stdout] | |_______________________________^ help: try: `default_configs.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/packaging/package_manager.rs:174:13 [INFO] [stdout] | [INFO] [stdout] 174 | format!("Github returned a non 200 status code when trying to download the tarball\n"); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `"Github returned a non 200 status code when trying to download the tarball\n".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: redundant pattern matching, consider using `is_none()` [INFO] [stdout] --> src/packaging/package_manager.rs:207:12 [INFO] [stdout] | [INFO] [stdout] 207 | if let None = config.dependency { [INFO] [stdout] | -------^^^^-------------------- help: try: `if config.dependency.is_none()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pattern_matching [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: length comparison to zero [INFO] [stdout] --> src/packaging/package_manager.rs:219:11 [INFO] [stdout] | [INFO] [stdout] 219 | while deps.len() > 0 { [INFO] [stdout] | ^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!deps.is_empty()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: comparison to empty slice [INFO] [stdout] --> src/packaging/package_manager.rs:225:30 [INFO] [stdout] | [INFO] [stdout] 225 | let version = if dep[2] == "" { [INFO] [stdout] | ^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `dep[2].is_empty()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#comparison_to_empty [INFO] [stdout] = note: `#[warn(clippy::comparison_to_empty)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: length comparison to zero [INFO] [stdout] --> src/packaging/package_manager.rs:265:8 [INFO] [stdout] | [INFO] [stdout] 265 | if tags.len() == 0 { [INFO] [stdout] | ^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `tags.is_empty()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/packaging/package_manager.rs:294:28 [INFO] [stdout] | [INFO] [stdout] 294 | install_globally(&pkg, &tag).await?; [INFO] [stdout] | ^^^^ help: change this to: `tag` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant pattern matching, consider using `is_none()` [INFO] [stdout] --> src/packaging/package_manager.rs:296:12 [INFO] [stdout] | [INFO] [stdout] 296 | if let None = pkg.get_include_dir()? { [INFO] [stdout] | -------^^^^------------------------- help: try: `if pkg.get_include_dir()?.is_none()` [INFO] [stdout] | [INFO] [stdout] = note: this will change drop order of the result, as well as all temporaries [INFO] [stdout] = note: add `#[allow(clippy::redundant_pattern_matching)]` if this is important [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pattern_matching [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded late initialization [INFO] [stdout] --> src/packaging/package_manager.rs:298:9 [INFO] [stdout] | [INFO] [stdout] 298 | let include_dir: String; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^ created here [INFO] [stdout] ... [INFO] [stdout] 309 | include_dir = stdin_buf.trim().trim_matches('/').to_string(); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ initialised here [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_late_init [INFO] [stdout] = note: `#[warn(clippy::needless_late_init)]` on by default [INFO] [stdout] help: move the declaration `include_dir` here [INFO] [stdout] | [INFO] [stdout] 298 ~ [INFO] [stdout] 299 | let source_dir: String; [INFO] [stdout] ... [INFO] [stdout] 308 | std::io::stdin().read_line(&mut stdin_buf)?; [INFO] [stdout] 309 ~ let include_dir: String = stdin_buf.trim().trim_matches('/').to_string(); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded late initialization [INFO] [stdout] --> src/packaging/package_manager.rs:299:9 [INFO] [stdout] | [INFO] [stdout] 299 | let source_dir: String; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^ created here [INFO] [stdout] ... [INFO] [stdout] 304 | source_dir = stdin_buf.trim().trim_matches('/').to_string(); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ initialised here [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_late_init [INFO] [stdout] help: move the declaration `source_dir` here [INFO] [stdout] | [INFO] [stdout] 299 ~ [INFO] [stdout] 300 | [INFO] [stdout] ... [INFO] [stdout] 303 | std::io::stdin().read_line(&mut stdin_buf)?; [INFO] [stdout] 304 ~ let source_dir: String = stdin_buf.trim().trim_matches('/').to_string(); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant pattern matching, consider using `is_none()` [INFO] [stdout] --> src/packaging/package_manager.rs:338:16 [INFO] [stdout] | [INFO] [stdout] 338 | if let None = cfg.dependency { [INFO] [stdout] | -------^^^^----------------- help: try: `if cfg.dependency.is_none()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pattern_matching [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the following explicit lifetimes could be elided: 'a [INFO] [stdout] --> src/packaging/package_manager.rs:359:19 [INFO] [stdout] | [INFO] [stdout] 359 | pub fn check_pkgs<'a>(config: &'a Config) -> Vec<[String; 3]> { [INFO] [stdout] | ^^ ^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes [INFO] [stdout] help: elide the lifetimes [INFO] [stdout] | [INFO] [stdout] 359 - pub fn check_pkgs<'a>(config: &'a Config) -> Vec<[String; 3]> { [INFO] [stdout] 359 + pub fn check_pkgs(config: &Config) -> Vec<[String; 3]> { [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/testing/safety.rs:74:5 [INFO] [stdout] | [INFO] [stdout] 74 | / for path in fs::read_dir(source_dir)? { [INFO] [stdout] 75 | | if let Ok(path) = path { [INFO] [stdout] 76 | | let path = path.path(); [INFO] [stdout] 77 | | let name = path.file_name().unwrap().to_str().unwrap().to_string(); [INFO] [stdout] ... | [INFO] [stdout] 87 | | } [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] help: try `.flatten()` and remove the `if let` statement in the for loop [INFO] [stdout] --> src/testing/safety.rs:75:9 [INFO] [stdout] | [INFO] [stdout] 75 | / if let Ok(path) = path { [INFO] [stdout] 76 | | let path = path.path(); [INFO] [stdout] 77 | | let name = path.file_name().unwrap().to_str().unwrap().to_string(); [INFO] [stdout] 78 | | if !name.ends_with(source_type) { [INFO] [stdout] ... | [INFO] [stdout] 85 | | warnings.append(&mut curr_warnings); [INFO] [stdout] 86 | | } [INFO] [stdout] | |_________^ [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_flatten [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 74 ~ for path in fs::read_dir(source_dir)?.flatten() { [INFO] [stdout] 75 + let path = path.path(); [INFO] [stdout] 76 + let name = path.file_name().unwrap().to_str().unwrap().to_string(); [INFO] [stdout] 77 + if !name.ends_with(source_type) { [INFO] [stdout] 78 + continue; [INFO] [stdout] 79 + } [INFO] [stdout] 80 + [INFO] [stdout] 81 + let source_code = fs::read_to_string(path)?; [INFO] [stdout] 82 + let mut curr_warnings = scan_file(&name, &source_code, &func_map); [INFO] [stdout] 83 + [INFO] [stdout] 84 + warnings.append(&mut curr_warnings); [INFO] [stdout] 85 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: an implementation of `From` is preferred since it gives you `Into<_>` for free where the reverse isn't true [INFO] [stdout] --> src/packaging/package_manager.rs:76:1 [INFO] [stdout] | [INFO] [stdout] 76 | impl Into<&str> for DepType { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: `impl From for Foreign` is allowed by the orphan rules, for more information see [INFO] [stdout] https://doc.rust-lang.org/reference/items/implementations.html#trait-implementation-coherence [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#from_over_into [INFO] [stdout] = note: `#[warn(clippy::from_over_into)]` on by default [INFO] [stdout] help: replace the `Into` implementation with `From` [INFO] [stdout] | [INFO] [stdout] 76 ~ impl From for &str { [INFO] [stdout] 77 ~ fn from(val: DepType) -> Self { [INFO] [stdout] 78 ~ match val { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: useless use of `format!` [INFO] [stdout] --> src/packaging/package_manager.rs:174:13 [INFO] [stdout] | [INFO] [stdout] 174 | format!("Github returned a non 200 status code when trying to download the tarball\n"); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `"Github returned a non 200 status code when trying to download the tarball\n".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: redundant pattern matching, consider using `is_none()` [INFO] [stdout] --> src/packaging/package_manager.rs:207:12 [INFO] [stdout] | [INFO] [stdout] 207 | if let None = config.dependency { [INFO] [stdout] | -------^^^^-------------------- help: try: `if config.dependency.is_none()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pattern_matching [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: length comparison to zero [INFO] [stdout] --> src/packaging/package_manager.rs:219:11 [INFO] [stdout] | [INFO] [stdout] 219 | while deps.len() > 0 { [INFO] [stdout] | ^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!deps.is_empty()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: comparison to empty slice [INFO] [stdout] --> src/packaging/package_manager.rs:225:30 [INFO] [stdout] | [INFO] [stdout] 225 | let version = if dep[2] == "" { [INFO] [stdout] | ^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `dep[2].is_empty()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#comparison_to_empty [INFO] [stdout] = note: `#[warn(clippy::comparison_to_empty)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: stripping a prefix manually [INFO] [stdout] --> src/utils.rs:140:38 [INFO] [stdout] | [INFO] [stdout] 140 | let path_without_tilde = &path[2..]; // Remove "~/" prefix [INFO] [stdout] | ^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] note: the prefix was tested here [INFO] [stdout] --> src/utils.rs:138:5 [INFO] [stdout] | [INFO] [stdout] 138 | if path.starts_with("~/") { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_strip [INFO] [stdout] = note: `#[warn(clippy::manual_strip)]` on by default [INFO] [stdout] help: try using the `strip_prefix` method [INFO] [stdout] | [INFO] [stdout] 138 ~ if let Some(path_without_tilde) = path.strip_prefix("~/") { [INFO] [stdout] 139 | if let Some(home_dir) = std::env::var_os("HOME") { [INFO] [stdout] 140 ~ // Remove "~/" prefix [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: length comparison to zero [INFO] [stdout] --> src/packaging/package_manager.rs:265:8 [INFO] [stdout] | [INFO] [stdout] 265 | if tags.len() == 0 { [INFO] [stdout] | ^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `tags.is_empty()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/packaging/package_manager.rs:294:28 [INFO] [stdout] | [INFO] [stdout] 294 | install_globally(&pkg, &tag).await?; [INFO] [stdout] | ^^^^ help: change this to: `tag` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this boolean expression can be simplified [INFO] [stdout] --> src/main.rs:48:16 [INFO] [stdout] | [INFO] [stdout] 48 | if !(raw_cli_args.len() <= 3) { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(raw_cli_args.len() > 3)` [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: redundant pattern matching, consider using `is_none()` [INFO] [stdout] --> src/packaging/package_manager.rs:296:12 [INFO] [stdout] | [INFO] [stdout] 296 | if let None = pkg.get_include_dir()? { [INFO] [stdout] | -------^^^^------------------------- help: try: `if pkg.get_include_dir()?.is_none()` [INFO] [stdout] | [INFO] [stdout] = note: this will change drop order of the result, as well as all temporaries [INFO] [stdout] = note: add `#[allow(clippy::redundant_pattern_matching)]` if this is important [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pattern_matching [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded late initialization [INFO] [stdout] --> src/packaging/package_manager.rs:298:9 [INFO] [stdout] | [INFO] [stdout] 298 | let include_dir: String; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^ created here [INFO] [stdout] ... [INFO] [stdout] 309 | include_dir = stdin_buf.trim().trim_matches('/').to_string(); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ initialised here [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_late_init [INFO] [stdout] = note: `#[warn(clippy::needless_late_init)]` on by default [INFO] [stdout] help: move the declaration `include_dir` here [INFO] [stdout] | [INFO] [stdout] 298 ~ [INFO] [stdout] 299 | let source_dir: String; [INFO] [stdout] ... [INFO] [stdout] 308 | std::io::stdin().read_line(&mut stdin_buf)?; [INFO] [stdout] 309 ~ let include_dir: String = stdin_buf.trim().trim_matches('/').to_string(); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded late initialization [INFO] [stdout] --> src/packaging/package_manager.rs:299:9 [INFO] [stdout] | [INFO] [stdout] 299 | let source_dir: String; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^ created here [INFO] [stdout] ... [INFO] [stdout] 304 | source_dir = stdin_buf.trim().trim_matches('/').to_string(); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ initialised here [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_late_init [INFO] [stdout] help: move the declaration `source_dir` here [INFO] [stdout] | [INFO] [stdout] 299 ~ [INFO] [stdout] 300 | [INFO] [stdout] ... [INFO] [stdout] 303 | std::io::stdin().read_line(&mut stdin_buf)?; [INFO] [stdout] 304 ~ let source_dir: String = stdin_buf.trim().trim_matches('/').to_string(); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant pattern matching, consider using `is_none()` [INFO] [stdout] --> src/packaging/package_manager.rs:338:16 [INFO] [stdout] | [INFO] [stdout] 338 | if let None = cfg.dependency { [INFO] [stdout] | -------^^^^----------------- help: try: `if cfg.dependency.is_none()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pattern_matching [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the following explicit lifetimes could be elided: 'a [INFO] [stdout] --> src/packaging/package_manager.rs:359:19 [INFO] [stdout] | [INFO] [stdout] 359 | pub fn check_pkgs<'a>(config: &'a Config) -> Vec<[String; 3]> { [INFO] [stdout] | ^^ ^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes [INFO] [stdout] help: elide the lifetimes [INFO] [stdout] | [INFO] [stdout] 359 - pub fn check_pkgs<'a>(config: &'a Config) -> Vec<[String; 3]> { [INFO] [stdout] 359 + pub fn check_pkgs(config: &Config) -> Vec<[String; 3]> { [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/testing/safety.rs:74:5 [INFO] [stdout] | [INFO] [stdout] 74 | / for path in fs::read_dir(source_dir)? { [INFO] [stdout] 75 | | if let Ok(path) = path { [INFO] [stdout] 76 | | let path = path.path(); [INFO] [stdout] 77 | | let name = path.file_name().unwrap().to_str().unwrap().to_string(); [INFO] [stdout] ... | [INFO] [stdout] 87 | | } [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] help: try `.flatten()` and remove the `if let` statement in the for loop [INFO] [stdout] --> src/testing/safety.rs:75:9 [INFO] [stdout] | [INFO] [stdout] 75 | / if let Ok(path) = path { [INFO] [stdout] 76 | | let path = path.path(); [INFO] [stdout] 77 | | let name = path.file_name().unwrap().to_str().unwrap().to_string(); [INFO] [stdout] 78 | | if !name.ends_with(source_type) { [INFO] [stdout] ... | [INFO] [stdout] 85 | | warnings.append(&mut curr_warnings); [INFO] [stdout] 86 | | } [INFO] [stdout] | |_________^ [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_flatten [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 74 ~ for path in fs::read_dir(source_dir)?.flatten() { [INFO] [stdout] 75 + let path = path.path(); [INFO] [stdout] 76 + let name = path.file_name().unwrap().to_str().unwrap().to_string(); [INFO] [stdout] 77 + if !name.ends_with(source_type) { [INFO] [stdout] 78 + continue; [INFO] [stdout] 79 + } [INFO] [stdout] 80 + [INFO] [stdout] 81 + let source_code = fs::read_to_string(path)?; [INFO] [stdout] 82 + let mut curr_warnings = scan_file(&name, &source_code, &func_map); [INFO] [stdout] 83 + [INFO] [stdout] 84 + warnings.append(&mut curr_warnings); [INFO] [stdout] 85 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/main.rs:244:49 [INFO] [stdout] | [INFO] [stdout] 244 | files_to_test.extend_from_slice(&tests); [INFO] [stdout] | ^^^^^^ help: change this to: `tests` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unnecessary `if let` since only the `Ok` variant of the iterator element is used [INFO] [stdout] --> src/main.rs:247:17 [INFO] [stdout] | [INFO] [stdout] 247 | / for file in test_dir { [INFO] [stdout] 248 | | if let Ok(file) = file { [INFO] [stdout] 249 | | let filepath = file.path(); [INFO] [stdout] 250 | | let filepath = filepath.to_str() [INFO] [stdout] ... | [INFO] [stdout] 254 | | } [INFO] [stdout] | |_________________^ [INFO] [stdout] | [INFO] [stdout] help: try `.flatten()` and remove the `if let` statement in the for loop [INFO] [stdout] --> src/main.rs:248:21 [INFO] [stdout] | [INFO] [stdout] 248 | / if let Ok(file) = file { [INFO] [stdout] 249 | | let filepath = file.path(); [INFO] [stdout] 250 | | let filepath = filepath.to_str() [INFO] [stdout] 251 | | .unwrap(); [INFO] [stdout] 252 | | files_to_test.push(filepath.to_string()); [INFO] [stdout] 253 | | } [INFO] [stdout] | |_____________________^ [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_flatten [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 247 ~ for file in test_dir.flatten() { [INFO] [stdout] 248 + let filepath = file.path(); [INFO] [stdout] 249 + let filepath = filepath.to_str() [INFO] [stdout] 250 + .unwrap(); [INFO] [stdout] 251 + files_to_test.push(filepath.to_string()); [INFO] [stdout] 252 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: stripping a prefix manually [INFO] [stdout] --> src/utils.rs:140:38 [INFO] [stdout] | [INFO] [stdout] 140 | let path_without_tilde = &path[2..]; // Remove "~/" prefix [INFO] [stdout] | ^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] note: the prefix was tested here [INFO] [stdout] --> src/utils.rs:138:5 [INFO] [stdout] | [INFO] [stdout] 138 | if path.starts_with("~/") { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_strip [INFO] [stdout] = note: `#[warn(clippy::manual_strip)]` on by default [INFO] [stdout] help: try using the `strip_prefix` method [INFO] [stdout] | [INFO] [stdout] 138 ~ if let Some(path_without_tilde) = path.strip_prefix("~/") { [INFO] [stdout] 139 | if let Some(home_dir) = std::env::var_os("HOME") { [INFO] [stdout] 140 ~ // Remove "~/" prefix [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this boolean expression can be simplified [INFO] [stdout] --> src/main.rs:48:16 [INFO] [stdout] | [INFO] [stdout] 48 | if !(raw_cli_args.len() <= 3) { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(raw_cli_args.len() > 3)` [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: length comparison to zero [INFO] [stdout] --> src/main.rs:350:8 [INFO] [stdout] | [INFO] [stdout] 350 | if warnings.len() > 0 { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!warnings.is_empty()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/main.rs:372:31 [INFO] [stdout] | [INFO] [stdout] 372 | build_sys::link_dep_files(&config, lang, &mut link_file)?; [INFO] [stdout] | ^^^^^^^ help: change this to: `config` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/main.rs:373:32 [INFO] [stdout] | [INFO] [stdout] 373 | build_sys::link_proj_files(&config, &cwd, lang, &mut link_file) [INFO] [stdout] | ^^^^^^^ help: change this to: `config` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/main.rs:377:42 [INFO] [stdout] | [INFO] [stdout] 377 | let opt_flags = build_sys::opt_flags(&profile, config).unwrap(); [INFO] [stdout] | ^^^^^^^^ help: change this to: `profile` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/main.rs:379:51 [INFO] [stdout] | [INFO] [stdout] 379 | let header_dirs = build_sys::link_dep_headers(&config)?; [INFO] [stdout] | ^^^^^^^ help: change this to: `config` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/main.rs:384:9 [INFO] [stdout] | [INFO] [stdout] 384 | &profile, [INFO] [stdout] | ^^^^^^^^ help: change this to: `profile` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()` [INFO] [stdout] --> src/main.rs:490:5 [INFO] [stdout] | [INFO] [stdout] 490 | / files.as_mut().map(|v| { [INFO] [stdout] 491 | | for i in 0..v.len() { [INFO] [stdout] 492 | | let idx = v[i].rfind('/'); [INFO] [stdout] 493 | | if let Some(idx) = idx { [INFO] [stdout] ... | [INFO] [stdout] 498 | | }); [INFO] [stdout] | |______^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#option_map_unit_fn [INFO] [stdout] = note: `#[warn(clippy::option_map_unit_fn)]` on by default [INFO] [stdout] help: use `if let` instead [INFO] [stdout] | [INFO] [stdout] 490 - files.as_mut().map(|v| { [INFO] [stdout] 491 - for i in 0..v.len() { [INFO] [stdout] 492 - let idx = v[i].rfind('/'); [INFO] [stdout] 493 - if let Some(idx) = idx { [INFO] [stdout] 494 - v[i] = v[i][(idx+1)..].to_string(); [INFO] [stdout] 495 - } [INFO] [stdout] 496 - [INFO] [stdout] 497 - } [INFO] [stdout] 498 - }); [INFO] [stdout] 490 + if let Some(v) = files.as_mut() { ... } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is only used to index `v` [INFO] [stdout] --> src/main.rs:491:18 [INFO] [stdout] | [INFO] [stdout] 491 | for i in 0..v.len() { [INFO] [stdout] | ^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 491 - for i in 0..v.len() { [INFO] [stdout] 491 + for in &mut v { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/main.rs:244:49 [INFO] [stdout] | [INFO] [stdout] 244 | files_to_test.extend_from_slice(&tests); [INFO] [stdout] | ^^^^^^ help: change this to: `tests` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unnecessary `if let` since only the `Ok` variant of the iterator element is used [INFO] [stdout] --> src/main.rs:247:17 [INFO] [stdout] | [INFO] [stdout] 247 | / for file in test_dir { [INFO] [stdout] 248 | | if let Ok(file) = file { [INFO] [stdout] 249 | | let filepath = file.path(); [INFO] [stdout] 250 | | let filepath = filepath.to_str() [INFO] [stdout] ... | [INFO] [stdout] 254 | | } [INFO] [stdout] | |_________________^ [INFO] [stdout] | [INFO] [stdout] help: try `.flatten()` and remove the `if let` statement in the for loop [INFO] [stdout] --> src/main.rs:248:21 [INFO] [stdout] | [INFO] [stdout] 248 | / if let Ok(file) = file { [INFO] [stdout] 249 | | let filepath = file.path(); [INFO] [stdout] 250 | | let filepath = filepath.to_str() [INFO] [stdout] 251 | | .unwrap(); [INFO] [stdout] 252 | | files_to_test.push(filepath.to_string()); [INFO] [stdout] 253 | | } [INFO] [stdout] | |_____________________^ [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_flatten [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 247 ~ for file in test_dir.flatten() { [INFO] [stdout] 248 + let filepath = file.path(); [INFO] [stdout] 249 + let filepath = filepath.to_str() [INFO] [stdout] 250 + .unwrap(); [INFO] [stdout] 251 + files_to_test.push(filepath.to_string()); [INFO] [stdout] 252 + } [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/main.rs:500:5 [INFO] [stdout] | [INFO] [stdout] 500 | / for file in fs::read_dir(&src_dir).unwrap() { [INFO] [stdout] 501 | | if let Ok(file) = file { [INFO] [stdout] 502 | | let raw_name = file.file_name(); [INFO] [stdout] 503 | | let (raw_name, file_ext) = raw_name.to_str().unwrap().rsplit_once(".").unwrap(); [INFO] [stdout] ... | [INFO] [stdout] 620 | | } [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] help: try `.flatten()` and remove the `if let` statement in the for loop [INFO] [stdout] --> src/main.rs:501:9 [INFO] [stdout] | [INFO] [stdout] 501 | / if let Ok(file) = file { [INFO] [stdout] 502 | | let raw_name = file.file_name(); [INFO] [stdout] 503 | | let (raw_name, file_ext) = raw_name.to_str().unwrap().rsplit_once(".").unwrap(); [INFO] [stdout] 504 | | if raw_name == "main" || file_ext != "c" { [INFO] [stdout] ... | [INFO] [stdout] 618 | | fs::write(new_filepath, new_code).unwrap(); [INFO] [stdout] 619 | | } [INFO] [stdout] | |_________^ [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_flatten [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 500 ~ for file in fs::read_dir(&src_dir).unwrap().flatten() { [INFO] [stdout] 501 + let raw_name = file.file_name(); [INFO] [stdout] 502 + let (raw_name, file_ext) = raw_name.to_str().unwrap().rsplit_once(".").unwrap(); [INFO] [stdout] 503 + if raw_name == "main" || file_ext != "c" { [INFO] [stdout] 504 + continue; [INFO] [stdout] 505 + } [INFO] [stdout] 506 + [INFO] [stdout] 507 + if let Some(files) = &files { [INFO] [stdout] 508 + let full_name = format!("{}.{}", raw_name, file_ext); [INFO] [stdout] 509 + if !files.contains(&full_name) { [INFO] [stdout] 510 + continue; [INFO] [stdout] 511 + } [INFO] [stdout] 512 + } [INFO] [stdout] 513 + [INFO] [stdout] 514 + let header_name = format!("{}.h", raw_name); [INFO] [stdout] 515 + [INFO] [stdout] 516 + let code = fs::read_to_string(file.path())?; [INFO] [stdout] 517 + let tokens = lexer_c::tokenize(&code)?; [INFO] [stdout] 518 + [INFO] [stdout] 519 + let code_h = fs::read_to_string(inc_dir.join(&header_name)).unwrap_or("".to_string()); [INFO] [stdout] 520 + let tokens_h = lexer_c::tokenize(&code_h)?; [INFO] [stdout] 521 + [INFO] [stdout] 522 + let mut defines_h = lexer_c::get_defines(&tokens_h); [INFO] [stdout] 523 + let mut udts_h = lexer_c::get_udts(&tokens_h); [INFO] [stdout] 524 + let mut includes_h = lexer_c::get_includes(&tokens_h); [INFO] [stdout] 525 + [INFO] [stdout] 526 + let fn_defs = lexer_c::get_fn_def(&tokens); [INFO] [stdout] 527 + let includes = lexer_c::get_includes(&tokens); [INFO] [stdout] 528 + let defines = lexer_c::get_defines(&tokens); [INFO] [stdout] 529 + let udts = lexer_c::get_udts(&tokens); [INFO] [stdout] 530 + [INFO] [stdout] 531 + // Ensure headerfiles don't include themselves [INFO] [stdout] 532 + let includes = header_gen::filter_out_includes(&includes, raw_name); [INFO] [stdout] 533 + [INFO] [stdout] 534 + // Skip the first definition to skip the #ifndef NAME_H #define NAME_H [INFO] [stdout] 535 + if defines_h.len() > 0 { [INFO] [stdout] 536 + defines_h.remove(0); [INFO] [stdout] 537 + } [INFO] [stdout] 538 + [INFO] [stdout] 539 + let res = header_gen::merge_defines(&mut defines_h, &defines); [INFO] [stdout] 540 + if let Err(e) = res { [INFO] [stdout] 541 + eprintln!("Error: {}", e); [INFO] [stdout] 542 + process::exit(1); [INFO] [stdout] 543 + } [INFO] [stdout] 544 + [INFO] [stdout] 545 + let res = header_gen::merge_udts(&mut udts_h, &udts); [INFO] [stdout] 546 + if let Err(e) = res { [INFO] [stdout] 547 + eprintln!("Error: {}", e); [INFO] [stdout] 548 + process::exit(1); [INFO] [stdout] 549 + } [INFO] [stdout] 550 + [INFO] [stdout] 551 + header_gen::merge_includes(&mut includes_h, &includes); [INFO] [stdout] 552 + [INFO] [stdout] 553 + let mut headers = String::new(); [INFO] [stdout] 554 + [INFO] [stdout] 555 + headers.push_str(&format!("#ifndef {}_H\n", raw_name.to_uppercase())); [INFO] [stdout] 556 + headers.push_str(&format!("#define {}_H\n\n", raw_name.to_uppercase())); [INFO] [stdout] 557 + [INFO] [stdout] 558 + for &inc in &includes { [INFO] [stdout] 559 + let s = lexer_c::Token::tokens_to_string(inc); [INFO] [stdout] 560 + headers.push_str(s.trim()); [INFO] [stdout] 561 + headers.push('\n'); [INFO] [stdout] 562 + } [INFO] [stdout] 563 + headers.push('\n'); [INFO] [stdout] 564 + [INFO] [stdout] 565 + for &def in &defines_h { [INFO] [stdout] 566 + let s = lexer_c::Token::tokens_to_string(def); [INFO] [stdout] 567 + headers.push_str(&s); [INFO] [stdout] 568 + headers.push('\n'); [INFO] [stdout] 569 + } [INFO] [stdout] 570 + headers.push('\n'); [INFO] [stdout] 571 + [INFO] [stdout] 572 + for &struc in &udts_h { [INFO] [stdout] 573 + headers.push_str(&lexer_c::Token::tokens_to_string(struc).trim()); [INFO] [stdout] 574 + headers.push_str("\n\n"); [INFO] [stdout] 575 + } [INFO] [stdout] 576 + headers.push('\n'); [INFO] [stdout] 577 + [INFO] [stdout] 578 + for &func in &fn_defs { [INFO] [stdout] 579 + let inline_idx = func.iter() [INFO] [stdout] 580 + .enumerate() [INFO] [stdout] 581 + .find(|&i| *(i.1) == lexer_c::Token::Object("inline")); [INFO] [stdout] 582 + [INFO] [stdout] 583 + if let Some((inline_idx, _)) = inline_idx { [INFO] [stdout] 584 + // turn `inline void XXX() {}` in .c into `extern inline void XXX();` in .h [INFO] [stdout] 585 + let mut func = func.to_vec(); [INFO] [stdout] 586 + func.insert(inline_idx, lexer_c::Token::Space); [INFO] [stdout] 587 + func.insert(inline_idx, lexer_c::Token::Object("extern")); [INFO] [stdout] 588 + [INFO] [stdout] 589 + let s = lexer_c::Token::tokens_to_string(&func); [INFO] [stdout] 590 + headers.push_str(s.trim()); [INFO] [stdout] 591 + headers.push_str(";\n\n"); [INFO] [stdout] 592 + } else { [INFO] [stdout] 593 + let s = lexer_c::Token::tokens_to_string(func); [INFO] [stdout] 594 + headers.push_str(s.trim()); [INFO] [stdout] 595 + headers.push_str(";\n\n"); [INFO] [stdout] 596 + } [INFO] [stdout] 597 + } [INFO] [stdout] 598 + headers.push('\n'); [INFO] [stdout] 599 + headers.push_str(&format!("#endif // {}_H", raw_name.to_uppercase())); [INFO] [stdout] 600 + [INFO] [stdout] 601 + fs::write(inc_dir.join(&header_name), headers)?; [INFO] [stdout] 602 + [INFO] [stdout] 603 + // Remove definitions from original C file to avoid duplicates [INFO] [stdout] 604 + let mut exclude_tokens = udts; [INFO] [stdout] 605 + exclude_tokens.extend_from_slice(&defines); [INFO] [stdout] 606 + [INFO] [stdout] 607 + let mut new_code = lexer_c::reconstruct_source(&tokens, &exclude_tokens); [INFO] [stdout] 608 + [INFO] [stdout] 609 + let header_inc_path = format!("\"../include/{}\"", &header_name); [INFO] [stdout] 610 + [INFO] [stdout] 611 + new_code = header_gen::insert_self_include(new_code, &header_inc_path); [INFO] [stdout] 612 + [INFO] [stdout] 613 + // let new_file = format!("{}.c.tmp", raw_name); [INFO] [stdout] 614 + let new_file = format!("{}.c", raw_name); [INFO] [stdout] 615 + let new_filepath = src_dir.join(&new_file); [INFO] [stdout] 616 + [INFO] [stdout] 617 + fs::write(new_filepath, new_code).unwrap(); [INFO] [stdout] 618 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: length comparison to zero [INFO] [stdout] --> src/main.rs:536:16 [INFO] [stdout] | [INFO] [stdout] 536 | if defines_h.len() > 0 { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!defines_h.is_empty()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/main.rs:574:34 [INFO] [stdout] | [INFO] [stdout] 574 | headers.push_str(&lexer_c::Token::tokens_to_string(struc).trim()); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `lexer_c::Token::tokens_to_string(struc).trim()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: length comparison to zero [INFO] [stdout] --> src/main.rs:350:8 [INFO] [stdout] | [INFO] [stdout] 350 | if warnings.len() > 0 { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!warnings.is_empty()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/main.rs:372:31 [INFO] [stdout] | [INFO] [stdout] 372 | build_sys::link_dep_files(&config, lang, &mut link_file)?; [INFO] [stdout] | ^^^^^^^ help: change this to: `config` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/main.rs:373:32 [INFO] [stdout] | [INFO] [stdout] 373 | build_sys::link_proj_files(&config, &cwd, lang, &mut link_file) [INFO] [stdout] | ^^^^^^^ help: change this to: `config` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/main.rs:377:42 [INFO] [stdout] | [INFO] [stdout] 377 | let opt_flags = build_sys::opt_flags(&profile, config).unwrap(); [INFO] [stdout] | ^^^^^^^^ help: change this to: `profile` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/main.rs:379:51 [INFO] [stdout] | [INFO] [stdout] 379 | let header_dirs = build_sys::link_dep_headers(&config)?; [INFO] [stdout] | ^^^^^^^ help: change this to: `config` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/main.rs:384:9 [INFO] [stdout] | [INFO] [stdout] 384 | &profile, [INFO] [stdout] | ^^^^^^^^ help: change this to: `profile` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/main.rs:662:31 [INFO] [stdout] | [INFO] [stdout] 662 | build_sys::link_dep_files(&config, lang, &mut link_file)?; [INFO] [stdout] | ^^^^^^^ help: change this to: `config` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/main.rs:663:32 [INFO] [stdout] | [INFO] [stdout] 663 | build_sys::link_proj_files(&config, &cwd, lang, &mut link_file) [INFO] [stdout] | ^^^^^^^ help: change this to: `config` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression can be written more simply using `.retain()` [INFO] [stdout] --> src/main.rs:667:5 [INFO] [stdout] | [INFO] [stdout] 667 | / link_file = link_file [INFO] [stdout] 668 | | .into_iter() [INFO] [stdout] 669 | | .filter(|f| !f.ends_with(&main_file)) [INFO] [stdout] 670 | | .collect(); [INFO] [stdout] | |__________________^ help: consider calling `.retain()` instead: `link_file.retain(|f| !f.ends_with(&main_file))` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_retain [INFO] [stdout] = note: `#[warn(clippy::manual_retain)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/main.rs:675:42 [INFO] [stdout] | [INFO] [stdout] 675 | let opt_flags = build_sys::opt_flags(&profile, config).unwrap(); [INFO] [stdout] | ^^^^^^^^ help: change this to: `profile` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/main.rs:677:51 [INFO] [stdout] | [INFO] [stdout] 677 | let header_dirs = build_sys::link_dep_headers(&config)?; [INFO] [stdout] | ^^^^^^^ help: change this to: `config` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/main.rs:682:9 [INFO] [stdout] | [INFO] [stdout] 682 | &profile, [INFO] [stdout] | ^^^^^^^^ help: change this to: `profile` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()` [INFO] [stdout] --> src/main.rs:490:5 [INFO] [stdout] | [INFO] [stdout] 490 | / files.as_mut().map(|v| { [INFO] [stdout] 491 | | for i in 0..v.len() { [INFO] [stdout] 492 | | let idx = v[i].rfind('/'); [INFO] [stdout] 493 | | if let Some(idx) = idx { [INFO] [stdout] ... | [INFO] [stdout] 498 | | }); [INFO] [stdout] | |______^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#option_map_unit_fn [INFO] [stdout] = note: `#[warn(clippy::option_map_unit_fn)]` on by default [INFO] [stdout] help: use `if let` instead [INFO] [stdout] | [INFO] [stdout] 490 - files.as_mut().map(|v| { [INFO] [stdout] 491 - for i in 0..v.len() { [INFO] [stdout] 492 - let idx = v[i].rfind('/'); [INFO] [stdout] 493 - if let Some(idx) = idx { [INFO] [stdout] 494 - v[i] = v[i][(idx+1)..].to_string(); [INFO] [stdout] 495 - } [INFO] [stdout] 496 - [INFO] [stdout] 497 - } [INFO] [stdout] 498 - }); [INFO] [stdout] 490 + if let Some(v) = files.as_mut() { ... } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is only used to index `v` [INFO] [stdout] --> src/main.rs:491:18 [INFO] [stdout] | [INFO] [stdout] 491 | for i in 0..v.len() { [INFO] [stdout] | ^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 491 - for i in 0..v.len() { [INFO] [stdout] 491 + for in &mut v { [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/main.rs:500:5 [INFO] [stdout] | [INFO] [stdout] 500 | / for file in fs::read_dir(&src_dir).unwrap() { [INFO] [stdout] 501 | | if let Ok(file) = file { [INFO] [stdout] 502 | | let raw_name = file.file_name(); [INFO] [stdout] 503 | | let (raw_name, file_ext) = raw_name.to_str().unwrap().rsplit_once(".").unwrap(); [INFO] [stdout] ... | [INFO] [stdout] 620 | | } [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] help: try `.flatten()` and remove the `if let` statement in the for loop [INFO] [stdout] --> src/main.rs:501:9 [INFO] [stdout] | [INFO] [stdout] 501 | / if let Ok(file) = file { [INFO] [stdout] 502 | | let raw_name = file.file_name(); [INFO] [stdout] 503 | | let (raw_name, file_ext) = raw_name.to_str().unwrap().rsplit_once(".").unwrap(); [INFO] [stdout] 504 | | if raw_name == "main" || file_ext != "c" { [INFO] [stdout] ... | [INFO] [stdout] 618 | | fs::write(new_filepath, new_code).unwrap(); [INFO] [stdout] 619 | | } [INFO] [stdout] | |_________^ [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_flatten [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 500 ~ for file in fs::read_dir(&src_dir).unwrap().flatten() { [INFO] [stdout] 501 + let raw_name = file.file_name(); [INFO] [stdout] 502 + let (raw_name, file_ext) = raw_name.to_str().unwrap().rsplit_once(".").unwrap(); [INFO] [stdout] 503 + if raw_name == "main" || file_ext != "c" { [INFO] [stdout] 504 + continue; [INFO] [stdout] 505 + } [INFO] [stdout] 506 + [INFO] [stdout] 507 + if let Some(files) = &files { [INFO] [stdout] 508 + let full_name = format!("{}.{}", raw_name, file_ext); [INFO] [stdout] 509 + if !files.contains(&full_name) { [INFO] [stdout] 510 + continue; [INFO] [stdout] 511 + } [INFO] [stdout] 512 + } [INFO] [stdout] 513 + [INFO] [stdout] 514 + let header_name = format!("{}.h", raw_name); [INFO] [stdout] 515 + [INFO] [stdout] 516 + let code = fs::read_to_string(file.path())?; [INFO] [stdout] 517 + let tokens = lexer_c::tokenize(&code)?; [INFO] [stdout] 518 + [INFO] [stdout] 519 + let code_h = fs::read_to_string(inc_dir.join(&header_name)).unwrap_or("".to_string()); [INFO] [stdout] 520 + let tokens_h = lexer_c::tokenize(&code_h)?; [INFO] [stdout] 521 + [INFO] [stdout] 522 + let mut defines_h = lexer_c::get_defines(&tokens_h); [INFO] [stdout] 523 + let mut udts_h = lexer_c::get_udts(&tokens_h); [INFO] [stdout] 524 + let mut includes_h = lexer_c::get_includes(&tokens_h); [INFO] [stdout] 525 + [INFO] [stdout] 526 + let fn_defs = lexer_c::get_fn_def(&tokens); [INFO] [stdout] 527 + let includes = lexer_c::get_includes(&tokens); [INFO] [stdout] 528 + let defines = lexer_c::get_defines(&tokens); [INFO] [stdout] 529 + let udts = lexer_c::get_udts(&tokens); [INFO] [stdout] 530 + [INFO] [stdout] 531 + // Ensure headerfiles don't include themselves [INFO] [stdout] 532 + let includes = header_gen::filter_out_includes(&includes, raw_name); [INFO] [stdout] 533 + [INFO] [stdout] 534 + // Skip the first definition to skip the #ifndef NAME_H #define NAME_H [INFO] [stdout] 535 + if defines_h.len() > 0 { [INFO] [stdout] 536 + defines_h.remove(0); [INFO] [stdout] 537 + } [INFO] [stdout] 538 + [INFO] [stdout] 539 + let res = header_gen::merge_defines(&mut defines_h, &defines); [INFO] [stdout] 540 + if let Err(e) = res { [INFO] [stdout] 541 + eprintln!("Error: {}", e); [INFO] [stdout] 542 + process::exit(1); [INFO] [stdout] 543 + } [INFO] [stdout] 544 + [INFO] [stdout] 545 + let res = header_gen::merge_udts(&mut udts_h, &udts); [INFO] [stdout] 546 + if let Err(e) = res { [INFO] [stdout] 547 + eprintln!("Error: {}", e); [INFO] [stdout] 548 + process::exit(1); [INFO] [stdout] 549 + } [INFO] [stdout] 550 + [INFO] [stdout] 551 + header_gen::merge_includes(&mut includes_h, &includes); [INFO] [stdout] 552 + [INFO] [stdout] 553 + let mut headers = String::new(); [INFO] [stdout] 554 + [INFO] [stdout] 555 + headers.push_str(&format!("#ifndef {}_H\n", raw_name.to_uppercase())); [INFO] [stdout] 556 + headers.push_str(&format!("#define {}_H\n\n", raw_name.to_uppercase())); [INFO] [stdout] 557 + [INFO] [stdout] 558 + for &inc in &includes { [INFO] [stdout] 559 + let s = lexer_c::Token::tokens_to_string(inc); [INFO] [stdout] 560 + headers.push_str(s.trim()); [INFO] [stdout] 561 + headers.push('\n'); [INFO] [stdout] 562 + } [INFO] [stdout] 563 + headers.push('\n'); [INFO] [stdout] 564 + [INFO] [stdout] 565 + for &def in &defines_h { [INFO] [stdout] 566 + let s = lexer_c::Token::tokens_to_string(def); [INFO] [stdout] 567 + headers.push_str(&s); [INFO] [stdout] 568 + headers.push('\n'); [INFO] [stdout] 569 + } [INFO] [stdout] 570 + headers.push('\n'); [INFO] [stdout] 571 + [INFO] [stdout] 572 + for &struc in &udts_h { [INFO] [stdout] 573 + headers.push_str(&lexer_c::Token::tokens_to_string(struc).trim()); [INFO] [stdout] 574 + headers.push_str("\n\n"); [INFO] [stdout] 575 + } [INFO] [stdout] 576 + headers.push('\n'); [INFO] [stdout] 577 + [INFO] [stdout] 578 + for &func in &fn_defs { [INFO] [stdout] 579 + let inline_idx = func.iter() [INFO] [stdout] 580 + .enumerate() [INFO] [stdout] 581 + .find(|&i| *(i.1) == lexer_c::Token::Object("inline")); [INFO] [stdout] 582 + [INFO] [stdout] 583 + if let Some((inline_idx, _)) = inline_idx { [INFO] [stdout] 584 + // turn `inline void XXX() {}` in .c into `extern inline void XXX();` in .h [INFO] [stdout] 585 + let mut func = func.to_vec(); [INFO] [stdout] 586 + func.insert(inline_idx, lexer_c::Token::Space); [INFO] [stdout] 587 + func.insert(inline_idx, lexer_c::Token::Object("extern")); [INFO] [stdout] 588 + [INFO] [stdout] 589 + let s = lexer_c::Token::tokens_to_string(&func); [INFO] [stdout] 590 + headers.push_str(s.trim()); [INFO] [stdout] 591 + headers.push_str(";\n\n"); [INFO] [stdout] 592 + } else { [INFO] [stdout] 593 + let s = lexer_c::Token::tokens_to_string(func); [INFO] [stdout] 594 + headers.push_str(s.trim()); [INFO] [stdout] 595 + headers.push_str(";\n\n"); [INFO] [stdout] 596 + } [INFO] [stdout] 597 + } [INFO] [stdout] 598 + headers.push('\n'); [INFO] [stdout] 599 + headers.push_str(&format!("#endif // {}_H", raw_name.to_uppercase())); [INFO] [stdout] 600 + [INFO] [stdout] 601 + fs::write(inc_dir.join(&header_name), headers)?; [INFO] [stdout] 602 + [INFO] [stdout] 603 + // Remove definitions from original C file to avoid duplicates [INFO] [stdout] 604 + let mut exclude_tokens = udts; [INFO] [stdout] 605 + exclude_tokens.extend_from_slice(&defines); [INFO] [stdout] 606 + [INFO] [stdout] 607 + let mut new_code = lexer_c::reconstruct_source(&tokens, &exclude_tokens); [INFO] [stdout] 608 + [INFO] [stdout] 609 + let header_inc_path = format!("\"../include/{}\"", &header_name); [INFO] [stdout] 610 + [INFO] [stdout] 611 + new_code = header_gen::insert_self_include(new_code, &header_inc_path); [INFO] [stdout] 612 + [INFO] [stdout] 613 + // let new_file = format!("{}.c.tmp", raw_name); [INFO] [stdout] 614 + let new_file = format!("{}.c", raw_name); [INFO] [stdout] 615 + let new_filepath = src_dir.join(&new_file); [INFO] [stdout] 616 + [INFO] [stdout] 617 + fs::write(new_filepath, new_code).unwrap(); [INFO] [stdout] 618 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: length comparison to zero [INFO] [stdout] --> src/main.rs:536:16 [INFO] [stdout] | [INFO] [stdout] 536 | if defines_h.len() > 0 { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!defines_h.is_empty()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/main.rs:574:34 [INFO] [stdout] | [INFO] [stdout] 574 | headers.push_str(&lexer_c::Token::tokens_to_string(struc).trim()); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `lexer_c::Token::tokens_to_string(struc).trim()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: hiding a lifetime that's elided elsewhere is confusing [INFO] [stdout] --> src/header_gen/lexer_c.rs:73:23 [INFO] [stdout] | [INFO] [stdout] 73 | pub fn tokenize(code: &str) -> Result> { [INFO] [stdout] | ^^^^ ^^^^^ the same lifetime is hidden here [INFO] [stdout] | | [INFO] [stdout] | the lifetime is elided here [INFO] [stdout] | [INFO] [stdout] = help: the same lifetime is referred to in inconsistent ways, making the signature confusing [INFO] [stdout] = note: `#[warn(mismatched_lifetime_syntaxes)]` on by default [INFO] [stdout] help: use `'_` for type paths [INFO] [stdout] | [INFO] [stdout] 73 | pub fn tokenize(code: &str) -> Result>> { [INFO] [stdout] | ++++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: hiding a lifetime that's elided elsewhere is confusing [INFO] [stdout] --> src/header_gen/lexer_c.rs:132:20 [INFO] [stdout] | [INFO] [stdout] 132 | fn is_symbol(code: &str) -> Option { [INFO] [stdout] | ^^^^ ^^^^^ the same lifetime is hidden here [INFO] [stdout] | | [INFO] [stdout] | the lifetime is elided here [INFO] [stdout] | [INFO] [stdout] = help: the same lifetime is referred to in inconsistent ways, making the signature confusing [INFO] [stdout] help: use `'_` for type paths [INFO] [stdout] | [INFO] [stdout] 132 | fn is_symbol(code: &str) -> Option> { [INFO] [stdout] | ++++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/main.rs:662:31 [INFO] [stdout] | [INFO] [stdout] 662 | build_sys::link_dep_files(&config, lang, &mut link_file)?; [INFO] [stdout] | ^^^^^^^ help: change this to: `config` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/main.rs:663:32 [INFO] [stdout] | [INFO] [stdout] 663 | build_sys::link_proj_files(&config, &cwd, lang, &mut link_file) [INFO] [stdout] | ^^^^^^^ help: change this to: `config` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression can be written more simply using `.retain()` [INFO] [stdout] --> src/main.rs:667:5 [INFO] [stdout] | [INFO] [stdout] 667 | / link_file = link_file [INFO] [stdout] 668 | | .into_iter() [INFO] [stdout] 669 | | .filter(|f| !f.ends_with(&main_file)) [INFO] [stdout] 670 | | .collect(); [INFO] [stdout] | |__________________^ help: consider calling `.retain()` instead: `link_file.retain(|f| !f.ends_with(&main_file))` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_retain [INFO] [stdout] = note: `#[warn(clippy::manual_retain)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/main.rs:675:42 [INFO] [stdout] | [INFO] [stdout] 675 | let opt_flags = build_sys::opt_flags(&profile, config).unwrap(); [INFO] [stdout] | ^^^^^^^^ help: change this to: `profile` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/main.rs:677:51 [INFO] [stdout] | [INFO] [stdout] 677 | let header_dirs = build_sys::link_dep_headers(&config)?; [INFO] [stdout] | ^^^^^^^ help: change this to: `config` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/main.rs:682:9 [INFO] [stdout] | [INFO] [stdout] 682 | &profile, [INFO] [stdout] | ^^^^^^^^ help: change this to: `profile` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: hiding a lifetime that's elided elsewhere is confusing [INFO] [stdout] --> src/header_gen/lexer_c.rs:73:23 [INFO] [stdout] | [INFO] [stdout] 73 | pub fn tokenize(code: &str) -> Result> { [INFO] [stdout] | ^^^^ ^^^^^ the same lifetime is hidden here [INFO] [stdout] | | [INFO] [stdout] | the lifetime is elided here [INFO] [stdout] | [INFO] [stdout] = help: the same lifetime is referred to in inconsistent ways, making the signature confusing [INFO] [stdout] = note: `#[warn(mismatched_lifetime_syntaxes)]` on by default [INFO] [stdout] help: use `'_` for type paths [INFO] [stdout] | [INFO] [stdout] 73 | pub fn tokenize(code: &str) -> Result>> { [INFO] [stdout] | ++++ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: hiding a lifetime that's elided elsewhere is confusing [INFO] [stdout] --> src/header_gen/lexer_c.rs:132:20 [INFO] [stdout] | [INFO] [stdout] 132 | fn is_symbol(code: &str) -> Option { [INFO] [stdout] | ^^^^ ^^^^^ the same lifetime is hidden here [INFO] [stdout] | | [INFO] [stdout] | the lifetime is elided here [INFO] [stdout] | [INFO] [stdout] = help: the same lifetime is referred to in inconsistent ways, making the signature confusing [INFO] [stdout] help: use `'_` for type paths [INFO] [stdout] | [INFO] [stdout] 132 | fn is_symbol(code: &str) -> Option> { [INFO] [stdout] | ++++ [INFO] [stdout] [INFO] [stdout] [INFO] [stderr] Finished `dev` profile [unoptimized + debuginfo] target(s) in 39.84s [INFO] running `Command { std: "docker" "inspect" "abc5fc21ed41d6cf23e87965b1ddd59f34b5cea9547e2b166c9a53728f60c509", kill_on_drop: false }` [INFO] running `Command { std: "docker" "rm" "-f" "abc5fc21ed41d6cf23e87965b1ddd59f34b5cea9547e2b166c9a53728f60c509", kill_on_drop: false }` [INFO] [stdout] abc5fc21ed41d6cf23e87965b1ddd59f34b5cea9547e2b166c9a53728f60c509