[INFO] cloning repository https://github.com/caoyfcode/asm [INFO] running `Command { std: "git" "-c" "credential.helper=" "-c" "credential.helper=/workspace/cargo-home/bin/git-credential-null" "clone" "--bare" "https://github.com/caoyfcode/asm" "/workspace/cache/git-repos/https%3A%2F%2Fgithub.com%2Fcaoyfcode%2Fasm", kill_on_drop: false }` [INFO] [stderr] Cloning into bare repository '/workspace/cache/git-repos/https%3A%2F%2Fgithub.com%2Fcaoyfcode%2Fasm'... [INFO] running `Command { std: "git" "rev-parse" "HEAD", kill_on_drop: false }` [INFO] [stdout] 76e7a488c63954723b3392e403db9e4df2e745d1 [INFO] linting caoyfcode/asm against nightly for clippy-nonminimal_bool-denied [INFO] running `Command { std: "git" "clone" "/workspace/cache/git-repos/https%3A%2F%2Fgithub.com%2Fcaoyfcode%2Fasm" "/workspace/builds/worker-4-tc1/source", kill_on_drop: false }` [INFO] [stderr] Cloning into '/workspace/builds/worker-4-tc1/source'... [INFO] [stderr] done. [INFO] started tweaking git repo https://github.com/caoyfcode/asm [INFO] finished tweaking git repo https://github.com/caoyfcode/asm [INFO] tweaked toml for git repo https://github.com/caoyfcode/asm written to /workspace/builds/worker-4-tc1/source/Cargo.toml [INFO] validating manifest of git repo https://github.com/caoyfcode/asm 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/caoyfcode/asm 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] warning: virtual workspace defaulting to `resolver = "1"` despite one or more workspace members being on edition 2021 which implies `resolver = "2"` [INFO] [stderr] | [INFO] [stderr] = note: to keep the current resolver, specify `workspace.resolver = "1"` in the workspace root's manifest [INFO] [stderr] = note: to use the edition 2021 resolver, specify `workspace.resolver = "2"` in the workspace root's manifest [INFO] [stderr] = note: for more details see https://doc.rust-lang.org/cargo/reference/resolver.html#resolver-versions [INFO] [stderr] Downloading crates ... [INFO] [stderr] Downloaded regex v1.7.0 [INFO] running `Command { std: "docker" "create" "-v" "/var/lib/crater-agent-workspace/builds/worker-4-tc1/target:/opt/rustwide/target:rw,Z" "-v" "/var/lib/crater-agent-workspace/builds/worker-4-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] f2dc80d3d56176413e02ff11660ed4ae9602d6136b30f8fb47ce594e06b9bb5f [INFO] running `Command { std: "docker" "start" "-a" "f2dc80d3d56176413e02ff11660ed4ae9602d6136b30f8fb47ce594e06b9bb5f", kill_on_drop: false }` [INFO] running `Command { std: "docker" "inspect" "f2dc80d3d56176413e02ff11660ed4ae9602d6136b30f8fb47ce594e06b9bb5f", kill_on_drop: false }` [INFO] running `Command { std: "docker" "rm" "-f" "f2dc80d3d56176413e02ff11660ed4ae9602d6136b30f8fb47ce594e06b9bb5f", kill_on_drop: false }` [INFO] [stdout] f2dc80d3d56176413e02ff11660ed4ae9602d6136b30f8fb47ce594e06b9bb5f [INFO] running `Command { std: "docker" "create" "-v" "/var/lib/crater-agent-workspace/builds/worker-4-tc1/target:/opt/rustwide/target:rw,Z" "-v" "/var/lib/crater-agent-workspace/builds/worker-4-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] d60cccd917eb279f4980d25791d2920535a05a513a39249202a36bd2eae98e32 [INFO] running `Command { std: "docker" "start" "-a" "d60cccd917eb279f4980d25791d2920535a05a513a39249202a36bd2eae98e32", kill_on_drop: false }` [INFO] [stderr] warning: virtual workspace defaulting to `resolver = "1"` despite one or more workspace members being on edition 2021 which implies `resolver = "2"` [INFO] [stderr] | [INFO] [stderr] = note: to keep the current resolver, specify `workspace.resolver = "1"` in the workspace root's manifest [INFO] [stderr] = note: to use the edition 2021 resolver, specify `workspace.resolver = "2"` in the workspace root's manifest [INFO] [stderr] = note: for more details see https://doc.rust-lang.org/cargo/reference/resolver.html#resolver-versions [INFO] [stderr] Checking elf v0.1.0 (/opt/rustwide/workdir/elf) [INFO] [stderr] Checking aho-corasick v0.7.20 [INFO] [stderr] Checking regex-syntax v0.6.28 [INFO] [stdout] warning: empty lines after doc comment [INFO] [stdout] --> elf/src/lib.rs:28:1 [INFO] [stdout] | [INFO] [stdout] 28 | / /// +----------------------+ [INFO] [stdout] 29 | | [INFO] [stdout] 30 | | /// section header table [INFO] [stdout] 31 | | /// [INFO] [stdout] ... | [INFO] [stdout] 60 | | /// +-----------------------------------+ [INFO] [stdout] 61 | | [INFO] [stdout] | |_^ [INFO] [stdout] 62 | use std::{collections::HashMap, fs::File, mem::size_of, io::Write}; [INFO] [stdout] | - the comment documents this `use` import [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#empty_line_after_doc_comments [INFO] [stdout] = note: `#[warn(clippy::empty_line_after_doc_comments)]` on by default [INFO] [stdout] = help: if the empty lines are unintentional, remove them [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the `sec @ _` pattern can be written as just `sec` [INFO] [stdout] --> elf/src/lib.rs:627:17 [INFO] [stdout] | [INFO] [stdout] 627 | sec @ _ => { [INFO] [stdout] | ^^^^^^^ help: try: `sec` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pattern [INFO] [stdout] = note: `#[warn(clippy::redundant_pattern)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: empty lines after doc comment [INFO] [stdout] --> elf/src/lib.rs:28:1 [INFO] [stdout] | [INFO] [stdout] 28 | / /// +----------------------+ [INFO] [stdout] 29 | | [INFO] [stdout] 30 | | /// section header table [INFO] [stdout] 31 | | /// [INFO] [stdout] ... | [INFO] [stdout] 60 | | /// +-----------------------------------+ [INFO] [stdout] 61 | | [INFO] [stdout] | |_^ [INFO] [stdout] 62 | use std::{collections::HashMap, fs::File, mem::size_of, io::Write}; [INFO] [stdout] | - the comment documents this `use` import [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#empty_line_after_doc_comments [INFO] [stdout] = note: `#[warn(clippy::empty_line_after_doc_comments)]` on by default [INFO] [stdout] = help: if the empty lines are unintentional, remove them [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the `sec @ _` pattern can be written as just `sec` [INFO] [stdout] --> elf/src/lib.rs:627:17 [INFO] [stdout] | [INFO] [stdout] 627 | sec @ _ => { [INFO] [stdout] | ^^^^^^^ help: try: `sec` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pattern [INFO] [stdout] = note: `#[warn(clippy::redundant_pattern)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: casting a character literal to `u8` truncates [INFO] [stdout] --> elf/src/elf_h.rs:52:25 [INFO] [stdout] | [INFO] [stdout] 52 | pub const ELFMAG1: u8 = 'E' as u8; /* Magic number byte 1 */ [INFO] [stdout] | ^^^^^^^^^ help: use a byte literal instead: `b'E'` [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: casting a character literal to `u8` truncates [INFO] [stdout] --> elf/src/elf_h.rs:55:25 [INFO] [stdout] | [INFO] [stdout] 55 | pub const ELFMAG2: u8 = 'L' as u8; /* Magic number byte 2 */ [INFO] [stdout] | ^^^^^^^^^ help: use a byte literal instead: `b'L'` [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] --> elf/src/elf_h.rs:58:25 [INFO] [stdout] | [INFO] [stdout] 58 | pub const ELFMAG3: u8 = 'F' as u8; /* Magic number byte 3 */ [INFO] [stdout] | ^^^^^^^^^ help: use a byte literal instead: `b'F'` [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: you should consider adding a `Default` implementation for `ElfWriter` [INFO] [stdout] --> elf/src/lib.rs:131:5 [INFO] [stdout] | [INFO] [stdout] 131 | / pub fn new() -> Self { [INFO] [stdout] 132 | | Self { [INFO] [stdout] 133 | | text: Vec::new(), [INFO] [stdout] 134 | | data: Vec::new(), [INFO] [stdout] ... | [INFO] [stdout] 140 | | } [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default [INFO] [stdout] = note: `#[warn(clippy::new_without_default)]` on by default [INFO] [stdout] help: try adding this [INFO] [stdout] | [INFO] [stdout] 110 + impl Default for ElfWriter { [INFO] [stdout] 111 + fn default() -> Self { [INFO] [stdout] 112 + Self::new() [INFO] [stdout] 113 + } [INFO] [stdout] 114 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `index` is used to index `symtab` [INFO] [stdout] --> elf/src/lib.rs:181:22 [INFO] [stdout] | [INFO] [stdout] 181 | for index in 0..symtab.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] 181 - for index in 0..symtab.len() { [INFO] [stdout] 181 + for (index, ) in symtab.iter().enumerate() { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `index` is used to index `symtab` [INFO] [stdout] --> elf/src/lib.rs:380:22 [INFO] [stdout] | [INFO] [stdout] 380 | for index in 0..symtab.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] 380 - for index in 0..symtab.len() { [INFO] [stdout] 380 + for (index, ) in symtab.iter().enumerate() { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: length comparison to zero [INFO] [stdout] --> elf/src/lib.rs:388:12 [INFO] [stdout] | [INFO] [stdout] 388 | if self.rel_text.len() != 0 || self.rel_data.len() != 0 { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!self.rel_text.is_empty()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero [INFO] [stdout] = note: `#[warn(clippy::len_zero)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: length comparison to zero [INFO] [stdout] --> elf/src/lib.rs:388:40 [INFO] [stdout] | [INFO] [stdout] 388 | if self.rel_text.len() != 0 || self.rel_data.len() != 0 { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!self.rel_data.is_empty()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> elf/src/lib.rs:703:9 [INFO] [stdout] | [INFO] [stdout] 703 | return index; [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] 703 - return index; [INFO] [stdout] 703 + index [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the variable `end` is used as a loop counter [INFO] [stdout] --> elf/src/lib.rs:713:9 [INFO] [stdout] | [INFO] [stdout] 713 | for ch in &self.content[index..] { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `for (end, ch) in (index..).zip(self.content[index..].iter())` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_counter_loop [INFO] [stdout] = note: `#[warn(clippy::explicit_counter_loop)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual slice size calculation [INFO] [stdout] --> elf/src/lib.rs:803:9 [INFO] [stdout] | [INFO] [stdout] 803 | size_of::() * src.len() [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::mem::size_of_val(src)` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_slice_size_calculation [INFO] [stdout] = note: `#[warn(clippy::manual_slice_size_calculation)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stderr] Checking linker v0.1.0 (/opt/rustwide/workdir/linker) [INFO] [stdout] warning: this `if` can be collapsed into the outer `match` [INFO] [stdout] --> linker/src/obj.rs:62:21 [INFO] [stdout] | [INFO] [stdout] 62 | / if sec_indices.insert(String::from(name), index).is_some() { [INFO] [stdout] 63 | | return Err(format!("duplicate section {}", name)); [INFO] [stdout] 64 | | } [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] 61 ~ )) [INFO] [stdout] 62 ~ if sec_indices.insert(String::from(name), index).is_some() => { [INFO] [stdout] 63 | return Err(format!("duplicate section {}", name)); [INFO] [stdout] 64 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` [INFO] [stdout] --> linker/src/obj.rs:57:13 [INFO] [stdout] | [INFO] [stdout] 57 | / match str_in_table(&shstrtab, sh.sh_name as usize) { [INFO] [stdout] 58 | | Some(name @ ( [INFO] [stdout] 59 | | ".text" | ".data" | ".bss" [INFO] [stdout] 60 | | | ".symtab" | ".strtab" | ".rel.text" | ".rel.data" [INFO] [stdout] ... | [INFO] [stdout] 66 | | _ => (), [INFO] [stdout] 67 | | } [INFO] [stdout] | |_____________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match [INFO] [stdout] = note: `#[warn(clippy::single_match)]` on by default [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 57 ~ if let Some(name @ ( [INFO] [stdout] 58 + ".text" | ".data" | ".bss" [INFO] [stdout] 59 + | ".symtab" | ".strtab" | ".rel.text" | ".rel.data" [INFO] [stdout] 60 + )) = str_in_table(&shstrtab, sh.sh_name as usize) { [INFO] [stdout] 61 + if sec_indices.insert(String::from(name), index).is_some() { [INFO] [stdout] 62 + return Err(format!("duplicate section {}", name)); [INFO] [stdout] 63 + } [INFO] [stdout] 64 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of `.is_multiple_of()` [INFO] [stdout] --> linker/src/obj.rs:108:16 [INFO] [stdout] | [INFO] [stdout] 108 | if symtab_sh.sh_size as usize % size_of::() != 0 { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `!(symtab_sh.sh_size as usize).is_multiple_of(size_of::())` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_is_multiple_of [INFO] [stdout] = note: `#[warn(clippy::manual_is_multiple_of)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of `.is_multiple_of()` [INFO] [stdout] --> linker/src/obj.rs:162:20 [INFO] [stdout] | [INFO] [stdout] 162 | if sh.sh_size as usize % size_of::() != 0 { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `!(sh.sh_size as usize).is_multiple_of(size_of::())` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_is_multiple_of [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of `.is_multiple_of()` [INFO] [stdout] --> linker/src/obj.rs:189:20 [INFO] [stdout] | [INFO] [stdout] 189 | if sh.sh_size as usize % size_of::() != 0 { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `!(sh.sh_size as usize).is_multiple_of(size_of::())` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_is_multiple_of [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the variable `end` is used as a loop counter [INFO] [stdout] --> linker/src/obj.rs:347:5 [INFO] [stdout] | [INFO] [stdout] 347 | for ch in &table[index..] { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `for (end, ch) in (index..).zip(table[index..].iter())` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_counter_loop [INFO] [stdout] = note: `#[warn(clippy::explicit_counter_loop)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: slow zero-filling initialization [INFO] [stdout] --> linker/src/obj.rs:357:32 [INFO] [stdout] | [INFO] [stdout] 357 | let mut content: Vec = Vec::with_capacity(len); [INFO] [stdout] | ________________________________^ [INFO] [stdout] 358 | | content.resize(len, 0); [INFO] [stdout] | |__________________________^ help: consider replacing this with: `vec![0; len]` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#slow_vector_initialization [INFO] [stdout] = note: `#[warn(clippy::slow_vector_initialization)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` can be collapsed into the outer `match` [INFO] [stdout] --> linker/src/obj.rs:62:21 [INFO] [stdout] | [INFO] [stdout] 62 | / if sec_indices.insert(String::from(name), index).is_some() { [INFO] [stdout] 63 | | return Err(format!("duplicate section {}", name)); [INFO] [stdout] 64 | | } [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] 61 ~ )) [INFO] [stdout] 62 ~ if sec_indices.insert(String::from(name), index).is_some() => { [INFO] [stdout] 63 | return Err(format!("duplicate section {}", name)); [INFO] [stdout] 64 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` [INFO] [stdout] --> linker/src/obj.rs:57:13 [INFO] [stdout] | [INFO] [stdout] 57 | / match str_in_table(&shstrtab, sh.sh_name as usize) { [INFO] [stdout] 58 | | Some(name @ ( [INFO] [stdout] 59 | | ".text" | ".data" | ".bss" [INFO] [stdout] 60 | | | ".symtab" | ".strtab" | ".rel.text" | ".rel.data" [INFO] [stdout] ... | [INFO] [stdout] 66 | | _ => (), [INFO] [stdout] 67 | | } [INFO] [stdout] | |_____________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match [INFO] [stdout] = note: `#[warn(clippy::single_match)]` on by default [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 57 ~ if let Some(name @ ( [INFO] [stdout] 58 + ".text" | ".data" | ".bss" [INFO] [stdout] 59 + | ".symtab" | ".strtab" | ".rel.text" | ".rel.data" [INFO] [stdout] 60 + )) = str_in_table(&shstrtab, sh.sh_name as usize) { [INFO] [stdout] 61 + if sec_indices.insert(String::from(name), index).is_some() { [INFO] [stdout] 62 + return Err(format!("duplicate section {}", name)); [INFO] [stdout] 63 + } [INFO] [stdout] 64 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of `.is_multiple_of()` [INFO] [stdout] --> linker/src/obj.rs:398:8 [INFO] [stdout] | [INFO] [stdout] 398 | if len % size != 0 { [INFO] [stdout] | ^^^^^^^^^^^^^^^ help: replace with: `!len.is_multiple_of(size)` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_is_multiple_of [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: length comparison to zero [INFO] [stdout] --> linker/src/main.rs:27:8 [INFO] [stdout] | [INFO] [stdout] 27 | if input.len() == 0 || output.is_none() { [INFO] [stdout] | ^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `input.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: manual implementation of `.is_multiple_of()` [INFO] [stdout] --> linker/src/obj.rs:108:16 [INFO] [stdout] | [INFO] [stdout] 108 | if symtab_sh.sh_size as usize % size_of::() != 0 { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `!(symtab_sh.sh_size as usize).is_multiple_of(size_of::())` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_is_multiple_of [INFO] [stdout] = note: `#[warn(clippy::manual_is_multiple_of)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of `.is_multiple_of()` [INFO] [stdout] --> linker/src/obj.rs:162:20 [INFO] [stdout] | [INFO] [stdout] 162 | if sh.sh_size as usize % size_of::() != 0 { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `!(sh.sh_size as usize).is_multiple_of(size_of::())` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_is_multiple_of [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of `.is_multiple_of()` [INFO] [stdout] --> linker/src/obj.rs:189:20 [INFO] [stdout] | [INFO] [stdout] 189 | if sh.sh_size as usize % size_of::() != 0 { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with: `!(sh.sh_size as usize).is_multiple_of(size_of::())` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_is_multiple_of [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the variable `end` is used as a loop counter [INFO] [stdout] --> linker/src/obj.rs:347:5 [INFO] [stdout] | [INFO] [stdout] 347 | for ch in &table[index..] { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `for (end, ch) in (index..).zip(table[index..].iter())` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_counter_loop [INFO] [stdout] = note: `#[warn(clippy::explicit_counter_loop)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: slow zero-filling initialization [INFO] [stdout] --> linker/src/obj.rs:357:32 [INFO] [stdout] | [INFO] [stdout] 357 | let mut content: Vec = Vec::with_capacity(len); [INFO] [stdout] | ________________________________^ [INFO] [stdout] 358 | | content.resize(len, 0); [INFO] [stdout] | |__________________________^ help: consider replacing this with: `vec![0; len]` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#slow_vector_initialization [INFO] [stdout] = note: `#[warn(clippy::slow_vector_initialization)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of `.is_multiple_of()` [INFO] [stdout] --> linker/src/obj.rs:398:8 [INFO] [stdout] | [INFO] [stdout] 398 | if len % size != 0 { [INFO] [stdout] | ^^^^^^^^^^^^^^^ help: replace with: `!len.is_multiple_of(size)` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_is_multiple_of [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: length comparison to zero [INFO] [stdout] --> linker/src/main.rs:27:8 [INFO] [stdout] | [INFO] [stdout] 27 | if input.len() == 0 || output.is_none() { [INFO] [stdout] | ^^^^^^^^^^^^^^^^ help: using `is_empty` is clearer and more explicit: `input.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: casting a character literal to `u8` truncates [INFO] [stdout] --> elf/src/elf_h.rs:52:25 [INFO] [stdout] | [INFO] [stdout] 52 | pub const ELFMAG1: u8 = 'E' as u8; /* Magic number byte 1 */ [INFO] [stdout] | ^^^^^^^^^ help: use a byte literal instead: `b'E'` [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: casting a character literal to `u8` truncates [INFO] [stdout] --> elf/src/elf_h.rs:55:25 [INFO] [stdout] | [INFO] [stdout] 55 | pub const ELFMAG2: u8 = 'L' as u8; /* Magic number byte 2 */ [INFO] [stdout] | ^^^^^^^^^ help: use a byte literal instead: `b'L'` [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] --> elf/src/elf_h.rs:58:25 [INFO] [stdout] | [INFO] [stdout] 58 | pub const ELFMAG3: u8 = 'F' as u8; /* Magic number byte 3 */ [INFO] [stdout] | ^^^^^^^^^ help: use a byte literal instead: `b'F'` [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: you should consider adding a `Default` implementation for `ElfWriter` [INFO] [stdout] --> elf/src/lib.rs:131:5 [INFO] [stdout] | [INFO] [stdout] 131 | / pub fn new() -> Self { [INFO] [stdout] 132 | | Self { [INFO] [stdout] 133 | | text: Vec::new(), [INFO] [stdout] 134 | | data: Vec::new(), [INFO] [stdout] ... | [INFO] [stdout] 140 | | } [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default [INFO] [stdout] = note: `#[warn(clippy::new_without_default)]` on by default [INFO] [stdout] help: try adding this [INFO] [stdout] | [INFO] [stdout] 110 + impl Default for ElfWriter { [INFO] [stdout] 111 + fn default() -> Self { [INFO] [stdout] 112 + Self::new() [INFO] [stdout] 113 + } [INFO] [stdout] 114 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `index` is used to index `symtab` [INFO] [stdout] --> elf/src/lib.rs:181:22 [INFO] [stdout] | [INFO] [stdout] 181 | for index in 0..symtab.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] 181 - for index in 0..symtab.len() { [INFO] [stdout] 181 + for (index, ) in symtab.iter().enumerate() { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `index` is used to index `symtab` [INFO] [stdout] --> elf/src/lib.rs:380:22 [INFO] [stdout] | [INFO] [stdout] 380 | for index in 0..symtab.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] 380 - for index in 0..symtab.len() { [INFO] [stdout] 380 + for (index, ) in symtab.iter().enumerate() { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: length comparison to zero [INFO] [stdout] --> elf/src/lib.rs:388:12 [INFO] [stdout] | [INFO] [stdout] 388 | if self.rel_text.len() != 0 || self.rel_data.len() != 0 { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!self.rel_text.is_empty()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero [INFO] [stdout] = note: `#[warn(clippy::len_zero)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: length comparison to zero [INFO] [stdout] --> elf/src/lib.rs:388:40 [INFO] [stdout] | [INFO] [stdout] 388 | if self.rel_text.len() != 0 || self.rel_data.len() != 0 { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!self.rel_data.is_empty()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> elf/src/lib.rs:703:9 [INFO] [stdout] | [INFO] [stdout] 703 | return index; [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] 703 - return index; [INFO] [stdout] 703 + index [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the variable `end` is used as a loop counter [INFO] [stdout] --> elf/src/lib.rs:713:9 [INFO] [stdout] | [INFO] [stdout] 713 | for ch in &self.content[index..] { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `for (end, ch) in (index..).zip(self.content[index..].iter())` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_counter_loop [INFO] [stdout] = note: `#[warn(clippy::explicit_counter_loop)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual slice size calculation [INFO] [stdout] --> elf/src/lib.rs:803:9 [INFO] [stdout] | [INFO] [stdout] 803 | size_of::() * src.len() [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `std::mem::size_of_val(src)` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_slice_size_calculation [INFO] [stdout] = note: `#[warn(clippy::manual_slice_size_calculation)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stderr] Checking regex v1.7.0 [INFO] [stderr] Checking assembler v0.1.0 (/opt/rustwide/workdir/assembler) [INFO] [stdout] warning: this boolean expression can be simplified [INFO] [stdout] --> assembler/src/config.rs:876:31 [INFO] [stdout] | [INFO] [stdout] 876 | let (mnemonic, size) = if !infos_of_instruction(mnemonic).is_some() { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `infos_of_instruction(mnemonic).is_none()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#nonminimal_bool [INFO] [stdout] = note: `#[warn(clippy::nonminimal_bool)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this call to `from_str_radix` can be replaced with a call to `str::parse` [INFO] [stdout] --> assembler/src/parser/scanner.rs:152:27 [INFO] [stdout] | [INFO] [stdout] 152 | match i32::from_str_radix(&str[0..end], 10) { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `str[0..end].parse::()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#from_str_radix_10 [INFO] [stdout] = note: `#[warn(clippy::from_str_radix_10)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this call to `from_str_radix` can be replaced with a call to `str::parse` [INFO] [stdout] --> assembler/src/parser/scanner.rs:160:27 [INFO] [stdout] | [INFO] [stdout] 160 | match u32::from_str_radix(&str[0..end], 10) { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `str[0..end].parse::()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#from_str_radix_10 [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant pattern matching, consider using `is_some()` [INFO] [stdout] --> assembler/src/parser/scanner.rs:169:20 [INFO] [stdout] | [INFO] [stdout] 169 | if let Some(_) = cap.name("char") { [INFO] [stdout] | -------^^^^^^^------------------- help: try: `if cap.name("char").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: called `.bytes().nth().unwrap()` on a `str` [INFO] [stdout] --> assembler/src/parser/scanner.rs:170:49 [INFO] [stdout] | [INFO] [stdout] 170 | return Some((TokenKind::Integer(str.bytes().nth(1).unwrap() as u32), 3)); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `str.as_bytes()[1]` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bytes_nth [INFO] [stdout] = note: `#[warn(clippy::bytes_nth)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this match could be written as a `let` statement [INFO] [stdout] --> assembler/src/parser/mod.rs:222:8 [INFO] [stdout] | [INFO] [stdout] 222 | / let (mnemonic, line) = match self.next_token().unwrap() { [INFO] [stdout] 223 | | Token { kind, line, ..} => { [INFO] [stdout] 224 | | match kind { [INFO] [stdout] 225 | | TokenKind::Symbol(mnemonic) => (mnemonic, line), [INFO] [stdout] ... | [INFO] [stdout] 229 | | }; [INFO] [stdout] | |__________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_single_binding [INFO] [stdout] = note: `#[warn(clippy::match_single_binding)]` on by default [INFO] [stdout] help: consider using a `let` statement [INFO] [stdout] | [INFO] [stdout] 222 ~ let Token { kind, line, ..} = self.next_token().unwrap(); [INFO] [stdout] 223 + let (mnemonic, line) = match kind { [INFO] [stdout] 224 + TokenKind::Symbol(mnemonic) => (mnemonic, line), [INFO] [stdout] 225 ~ _ => panic!("can't be here"), // 调用该函数前已经确定是 Symbol 了 [INFO] [stdout] 226 + }; [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: sub-expression diverges [INFO] [stdout] --> assembler/src/parser/mod.rs:325:34 [INFO] [stdout] | [INFO] [stdout] 325 | TokenKind::Rparen => return Ok(MemNode { displacement, base, index_scale: None}), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#diverging_sub_expression [INFO] [stdout] = note: `#[warn(clippy::diverging_sub_expression)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: sub-expression diverges [INFO] [stdout] --> assembler/src/parser/mod.rs:336:34 [INFO] [stdout] | [INFO] [stdout] 336 | TokenKind::Rparen => return Ok(MemNode { displacement, base, index_scale: Some((index, 1))}), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#diverging_sub_expression [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is only used to index `value` [INFO] [stdout] --> assembler/src/generator/data.rs:32:22 [INFO] [stdout] | [INFO] [stdout] 32 | for i in 0..size { [INFO] [stdout] | ^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] = note: `#[warn(clippy::needless_range_loop)]` on by default [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 32 - for i in 0..size { [INFO] [stdout] 32 + for in value.iter().take(size) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: it looks like the same item is being pushed into this `Vec` [INFO] [stdout] --> assembler/src/generator/data.rs:63:25 [INFO] [stdout] | [INFO] [stdout] 63 | data.push(0); [INFO] [stdout] | ^^^^ [INFO] [stdout] | [INFO] [stdout] = help: consider using `vec![0;SIZE]` [INFO] [stdout] = help: or `data.extend(std::iter::repeat_n(0, SIZE))` [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#same_item_push [INFO] [stdout] = note: `#[warn(clippy::same_item_push)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: match can be simplified with `.unwrap_or_default()` [INFO] [stdout] --> assembler/src/generator/instruction.rs:161:21 [INFO] [stdout] | [INFO] [stdout] 161 | let modrm = match self.modrm { [INFO] [stdout] | _____________________^ [INFO] [stdout] 162 | | Some(modrm) => modrm, [INFO] [stdout] 163 | | _ => 0, [INFO] [stdout] 164 | | }; [INFO] [stdout] | |_________^ help: replace it with: `self.modrm.unwrap_or_default()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_unwrap_or_default [INFO] [stdout] = note: `#[warn(clippy::manual_unwrap_or_default)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: match can be simplified with `.unwrap_or_default()` [INFO] [stdout] --> assembler/src/generator/instruction.rs:170:21 [INFO] [stdout] | [INFO] [stdout] 170 | let modrm = match self.modrm { [INFO] [stdout] | _____________________^ [INFO] [stdout] 171 | | Some(modrm) => modrm, [INFO] [stdout] 172 | | _ => 0, [INFO] [stdout] 173 | | }; [INFO] [stdout] | |_________^ help: replace it with: `self.modrm.unwrap_or_default()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_unwrap_or_default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: match can be simplified with `.unwrap_or_default()` [INFO] [stdout] --> assembler/src/generator/instruction.rs:201:21 [INFO] [stdout] | [INFO] [stdout] 201 | let modrm = match self.modrm { [INFO] [stdout] | _____________________^ [INFO] [stdout] 202 | | Some(modrm) => modrm, [INFO] [stdout] 203 | | _ => 0, [INFO] [stdout] 204 | | }; [INFO] [stdout] | |_________^ help: replace it with: `self.modrm.unwrap_or_default()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_unwrap_or_default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this operation has no effect [INFO] [stdout] --> assembler/src/generator/instruction.rs:218:35 [INFO] [stdout] | [INFO] [stdout] 218 | self.modrm = Some(0b0 | modrm | 5); [INFO] [stdout] | ^^^^^^^^^^^ help: consider reducing it to: `modrm` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_op [INFO] [stdout] = note: `#[warn(clippy::identity_op)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this operation has no effect [INFO] [stdout] --> assembler/src/generator/instruction.rs:230:43 [INFO] [stdout] | [INFO] [stdout] 230 | self.modrm = Some(0b0 | modrm | rm); [INFO] [stdout] | ^^^^^^^^^^^ help: consider reducing it to: `modrm` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_op [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this operation has no effect [INFO] [stdout] --> assembler/src/generator/instruction.rs:253:51 [INFO] [stdout] | [INFO] [stdout] 253 | ... self.modrm = Some(0 | modrm | 4); [INFO] [stdout] | ^^^^^^^^^ help: consider reducing it to: `modrm` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_op [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of an assign operation [INFO] [stdout] --> assembler/src/generator/instruction.rs:265:25 [INFO] [stdout] | [INFO] [stdout] 265 | sib = sib | (base & 0b111); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `sib |= (base & 0b111)` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assign_op_pattern [INFO] [stdout] = note: `#[warn(clippy::assign_op_pattern)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this operation has no effect [INFO] [stdout] --> assembler/src/generator/instruction.rs:274:43 [INFO] [stdout] | [INFO] [stdout] 274 | self.modrm = Some(0b00 | modrm | 4); [INFO] [stdout] | ^^^^^^^^^^^^ help: consider reducing it to: `modrm` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_op [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of an assign operation [INFO] [stdout] --> assembler/src/generator/instruction.rs:276:25 [INFO] [stdout] | [INFO] [stdout] 276 | sib = sib | 5; [INFO] [stdout] | ^^^^^^^^^^^^^ help: replace it with: `sib |= 5` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assign_op_pattern [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of an assign operation [INFO] [stdout] --> assembler/src/generator/instruction.rs:289:21 [INFO] [stdout] | [INFO] [stdout] 289 | sib = sib | (0b00100 << 3); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `sib |= (0b00100 << 3)` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assign_op_pattern [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do [INFO] [stdout] --> assembler/src/generator/mod.rs:153:69 [INFO] [stdout] | [INFO] [stdout] 153 | fn handle_relative_relocation(&self, section: Section, content: &mut Vec, rel: &mut Vec) { [INFO] [stdout] | ^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg [INFO] [stdout] = note: `#[warn(clippy::ptr_arg)]` on by default [INFO] [stdout] help: change this to [INFO] [stdout] | [INFO] [stdout] 153 - fn handle_relative_relocation(&self, section: Section, content: &mut Vec, rel: &mut Vec) { [INFO] [stdout] 153 + fn handle_relative_relocation(&self, section: Section, content: &mut [u8], rel: &mut Vec) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this boolean expression can be simplified [INFO] [stdout] --> assembler/src/generator/mod.rs:510:20 [INFO] [stdout] | [INFO] [stdout] 510 | if !size.is_none() { // jmp/call rel 必须没有后缀, 大小由操作数决定 [INFO] [stdout] | ^^^^^^^^^^^^^^^ help: try: `size.is_some()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#nonminimal_bool [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do [INFO] [stdout] --> assembler/src/generator/mod.rs:418:90 [INFO] [stdout] | [INFO] [stdout] 418 | fn make_instruction(&mut self, info: &InstructionInfo, size: Option, operands: &Vec) -> Option { [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] 418 - fn make_instruction(&mut self, info: &InstructionInfo, size: Option, operands: &Vec) -> Option { [INFO] [stdout] 418 + fn make_instruction(&mut self, info: &InstructionInfo, size: Option, operands: &[OperandNode]) -> Option { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: length comparison to zero [INFO] [stdout] --> assembler/src/generator/mod.rs:428:20 [INFO] [stdout] | [INFO] [stdout] 428 | if operands.len() != 0 { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!operands.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: manual implementation of `Option::map` [INFO] [stdout] --> assembler/src/generator/mod.rs:809:20 [INFO] [stdout] | [INFO] [stdout] 809 | let disp = match &mem.displacement { [INFO] [stdout] | ____________________^ [INFO] [stdout] 810 | | Some(node) => Some(self.value_of_node(&node, false)), [INFO] [stdout] 811 | | None => None, [INFO] [stdout] 812 | | }; [INFO] [stdout] | |_________^ help: try: `mem.displacement.as_ref().map(|node| self.value_of_node(&node, false))` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_map [INFO] [stdout] = note: `#[warn(clippy::manual_map)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> assembler/src/generator/mod.rs:810:51 [INFO] [stdout] | [INFO] [stdout] 810 | Some(node) => Some(self.value_of_node(&node, false)), [INFO] [stdout] | ^^^^^ help: change this to: `node` [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: needlessly taken reference of left operand [INFO] [stdout] --> assembler/src/generator/mod.rs:878:20 [INFO] [stdout] | [INFO] [stdout] 878 | return ®.name == name; [INFO] [stdout] | ---------^^^^^^^^ [INFO] [stdout] | | [INFO] [stdout] | help: use the left value directly: `reg.name` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#op_ref [INFO] [stdout] = note: `#[warn(clippy::op_ref)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: match expression looks like `matches!` macro [INFO] [stdout] --> assembler/src/generator/mod.rs:885:20 [INFO] [stdout] | [INFO] [stdout] 885 | return match ®.name[..] { [INFO] [stdout] | ____________________^ [INFO] [stdout] 886 | | "al" | "ax" | "eax" => true, [INFO] [stdout] 887 | | _ => false, [INFO] [stdout] 888 | | }; [INFO] [stdout] | |_____________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_like_matches_macro [INFO] [stdout] = note: `#[warn(clippy::match_like_matches_macro)]` on by default [INFO] [stdout] help: use `matches!` directly [INFO] [stdout] | [INFO] [stdout] 885 - return match ®.name[..] { [INFO] [stdout] 886 - "al" | "ax" | "eax" => true, [INFO] [stdout] 887 - _ => false, [INFO] [stdout] 888 - }; [INFO] [stdout] 885 + return matches!(®.name[..], "al" | "ax" | "eax"); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: match expression looks like `matches!` macro [INFO] [stdout] --> assembler/src/generator/mod.rs:898:9 [INFO] [stdout] | [INFO] [stdout] 898 | / match self { [INFO] [stdout] 899 | | OperandNode::Immediate(_) => true, [INFO] [stdout] 900 | | _ => false, [INFO] [stdout] 901 | | } [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_like_matches_macro [INFO] [stdout] help: use `matches!` directly [INFO] [stdout] | [INFO] [stdout] 898 - match self { [INFO] [stdout] 899 - OperandNode::Immediate(_) => true, [INFO] [stdout] 900 - _ => false, [INFO] [stdout] 901 - } [INFO] [stdout] 898 + matches!(self, OperandNode::Immediate(_)) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: match expression looks like `matches!` macro [INFO] [stdout] --> assembler/src/generator/mod.rs:905:9 [INFO] [stdout] | [INFO] [stdout] 905 | / match self { [INFO] [stdout] 906 | | OperandNode::Memory(..) => true, [INFO] [stdout] 907 | | _ => false, [INFO] [stdout] 908 | | } [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_like_matches_macro [INFO] [stdout] help: use `matches!` directly [INFO] [stdout] | [INFO] [stdout] 905 - match self { [INFO] [stdout] 906 - OperandNode::Memory(..) => true, [INFO] [stdout] 907 - _ => false, [INFO] [stdout] 908 - } [INFO] [stdout] 905 + matches!(self, OperandNode::Memory(..)) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: empty string literal in `println!` [INFO] [stdout] --> assembler/src/ast/printer.rs:286:9 [INFO] [stdout] | [INFO] [stdout] 286 | println!(""); [INFO] [stdout] | ^^^^^^^^^--^ [INFO] [stdout] | | [INFO] [stdout] | help: remove the empty string [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#println_empty_string [INFO] [stdout] = note: `#[warn(clippy::println_empty_string)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this boolean expression can be simplified [INFO] [stdout] --> assembler/src/config.rs:876:31 [INFO] [stdout] | [INFO] [stdout] 876 | let (mnemonic, size) = if !infos_of_instruction(mnemonic).is_some() { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `infos_of_instruction(mnemonic).is_none()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#nonminimal_bool [INFO] [stdout] = note: `#[warn(clippy::nonminimal_bool)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this call to `from_str_radix` can be replaced with a call to `str::parse` [INFO] [stdout] --> assembler/src/parser/scanner.rs:152:27 [INFO] [stdout] | [INFO] [stdout] 152 | match i32::from_str_radix(&str[0..end], 10) { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `str[0..end].parse::()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#from_str_radix_10 [INFO] [stdout] = note: `#[warn(clippy::from_str_radix_10)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this call to `from_str_radix` can be replaced with a call to `str::parse` [INFO] [stdout] --> assembler/src/parser/scanner.rs:160:27 [INFO] [stdout] | [INFO] [stdout] 160 | match u32::from_str_radix(&str[0..end], 10) { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `str[0..end].parse::()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#from_str_radix_10 [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant pattern matching, consider using `is_some()` [INFO] [stdout] --> assembler/src/parser/scanner.rs:169:20 [INFO] [stdout] | [INFO] [stdout] 169 | if let Some(_) = cap.name("char") { [INFO] [stdout] | -------^^^^^^^------------------- help: try: `if cap.name("char").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: called `.bytes().nth().unwrap()` on a `str` [INFO] [stdout] --> assembler/src/parser/scanner.rs:170:49 [INFO] [stdout] | [INFO] [stdout] 170 | return Some((TokenKind::Integer(str.bytes().nth(1).unwrap() as u32), 3)); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `str.as_bytes()[1]` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bytes_nth [INFO] [stdout] = note: `#[warn(clippy::bytes_nth)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this match could be written as a `let` statement [INFO] [stdout] --> assembler/src/parser/mod.rs:222:8 [INFO] [stdout] | [INFO] [stdout] 222 | / let (mnemonic, line) = match self.next_token().unwrap() { [INFO] [stdout] 223 | | Token { kind, line, ..} => { [INFO] [stdout] 224 | | match kind { [INFO] [stdout] 225 | | TokenKind::Symbol(mnemonic) => (mnemonic, line), [INFO] [stdout] ... | [INFO] [stdout] 229 | | }; [INFO] [stdout] | |__________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_single_binding [INFO] [stdout] = note: `#[warn(clippy::match_single_binding)]` on by default [INFO] [stdout] help: consider using a `let` statement [INFO] [stdout] | [INFO] [stdout] 222 ~ let Token { kind, line, ..} = self.next_token().unwrap(); [INFO] [stdout] 223 + let (mnemonic, line) = match kind { [INFO] [stdout] 224 + TokenKind::Symbol(mnemonic) => (mnemonic, line), [INFO] [stdout] 225 ~ _ => panic!("can't be here"), // 调用该函数前已经确定是 Symbol 了 [INFO] [stdout] 226 + }; [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: sub-expression diverges [INFO] [stdout] --> assembler/src/parser/mod.rs:325:34 [INFO] [stdout] | [INFO] [stdout] 325 | TokenKind::Rparen => return Ok(MemNode { displacement, base, index_scale: None}), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#diverging_sub_expression [INFO] [stdout] = note: `#[warn(clippy::diverging_sub_expression)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: sub-expression diverges [INFO] [stdout] --> assembler/src/parser/mod.rs:336:34 [INFO] [stdout] | [INFO] [stdout] 336 | TokenKind::Rparen => return Ok(MemNode { displacement, base, index_scale: Some((index, 1))}), [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#diverging_sub_expression [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: empty string literal in `println!` [INFO] [stdout] --> assembler/src/parser/mod.rs:382:9 [INFO] [stdout] | [INFO] [stdout] 382 | println!(""); [INFO] [stdout] | ^^^^^^^^^--^ [INFO] [stdout] | | [INFO] [stdout] | help: remove the empty string [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#println_empty_string [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: empty string literal in `println!` [INFO] [stdout] --> assembler/src/parser/mod.rs:405:9 [INFO] [stdout] | [INFO] [stdout] 405 | println!(""); [INFO] [stdout] | ^^^^^^^^^--^ [INFO] [stdout] | | [INFO] [stdout] | help: remove the empty string [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#println_empty_string [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` [INFO] [stdout] --> assembler/src/parser/mod.rs:425:9 [INFO] [stdout] | [INFO] [stdout] 425 | / match parser.build_ast() { [INFO] [stdout] 426 | | Err(error) => panic!("{}", error), [INFO] [stdout] 427 | | _ => (), [INFO] [stdout] 428 | | } [INFO] [stdout] | |_________^ help: try: `if let Err(error) = parser.build_ast() { panic!("{}", error) }` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match [INFO] [stdout] = note: `#[warn(clippy::single_match)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: empty string literal in `println!` [INFO] [stdout] --> assembler/src/parser/mod.rs:440:9 [INFO] [stdout] | [INFO] [stdout] 440 | println!(""); [INFO] [stdout] | ^^^^^^^^^--^ [INFO] [stdout] | | [INFO] [stdout] | help: remove the empty string [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#println_empty_string [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: the loop variable `i` is only used to index `value` [INFO] [stdout] --> assembler/src/generator/data.rs:32:22 [INFO] [stdout] | [INFO] [stdout] 32 | for i in 0..size { [INFO] [stdout] | ^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop [INFO] [stdout] = note: `#[warn(clippy::needless_range_loop)]` on by default [INFO] [stdout] help: consider using an iterator [INFO] [stdout] | [INFO] [stdout] 32 - for i in 0..size { [INFO] [stdout] 32 + for in value.iter().take(size) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: it looks like the same item is being pushed into this `Vec` [INFO] [stdout] --> assembler/src/generator/data.rs:63:25 [INFO] [stdout] | [INFO] [stdout] 63 | data.push(0); [INFO] [stdout] | ^^^^ [INFO] [stdout] | [INFO] [stdout] = help: consider using `vec![0;SIZE]` [INFO] [stdout] = help: or `data.extend(std::iter::repeat_n(0, SIZE))` [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#same_item_push [INFO] [stdout] = note: `#[warn(clippy::same_item_push)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: match can be simplified with `.unwrap_or_default()` [INFO] [stdout] --> assembler/src/generator/instruction.rs:161:21 [INFO] [stdout] | [INFO] [stdout] 161 | let modrm = match self.modrm { [INFO] [stdout] | _____________________^ [INFO] [stdout] 162 | | Some(modrm) => modrm, [INFO] [stdout] 163 | | _ => 0, [INFO] [stdout] 164 | | }; [INFO] [stdout] | |_________^ help: replace it with: `self.modrm.unwrap_or_default()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_unwrap_or_default [INFO] [stdout] = note: `#[warn(clippy::manual_unwrap_or_default)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: match can be simplified with `.unwrap_or_default()` [INFO] [stdout] --> assembler/src/generator/instruction.rs:170:21 [INFO] [stdout] | [INFO] [stdout] 170 | let modrm = match self.modrm { [INFO] [stdout] | _____________________^ [INFO] [stdout] 171 | | Some(modrm) => modrm, [INFO] [stdout] 172 | | _ => 0, [INFO] [stdout] 173 | | }; [INFO] [stdout] | |_________^ help: replace it with: `self.modrm.unwrap_or_default()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_unwrap_or_default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: match can be simplified with `.unwrap_or_default()` [INFO] [stdout] --> assembler/src/generator/instruction.rs:201:21 [INFO] [stdout] | [INFO] [stdout] 201 | let modrm = match self.modrm { [INFO] [stdout] | _____________________^ [INFO] [stdout] 202 | | Some(modrm) => modrm, [INFO] [stdout] 203 | | _ => 0, [INFO] [stdout] 204 | | }; [INFO] [stdout] | |_________^ help: replace it with: `self.modrm.unwrap_or_default()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_unwrap_or_default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this operation has no effect [INFO] [stdout] --> assembler/src/generator/instruction.rs:218:35 [INFO] [stdout] | [INFO] [stdout] 218 | self.modrm = Some(0b0 | modrm | 5); [INFO] [stdout] | ^^^^^^^^^^^ help: consider reducing it to: `modrm` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_op [INFO] [stdout] = note: `#[warn(clippy::identity_op)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this operation has no effect [INFO] [stdout] --> assembler/src/generator/instruction.rs:230:43 [INFO] [stdout] | [INFO] [stdout] 230 | self.modrm = Some(0b0 | modrm | rm); [INFO] [stdout] | ^^^^^^^^^^^ help: consider reducing it to: `modrm` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_op [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this operation has no effect [INFO] [stdout] --> assembler/src/generator/instruction.rs:253:51 [INFO] [stdout] | [INFO] [stdout] 253 | ... self.modrm = Some(0 | modrm | 4); [INFO] [stdout] | ^^^^^^^^^ help: consider reducing it to: `modrm` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_op [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of an assign operation [INFO] [stdout] --> assembler/src/generator/instruction.rs:265:25 [INFO] [stdout] | [INFO] [stdout] 265 | sib = sib | (base & 0b111); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `sib |= (base & 0b111)` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assign_op_pattern [INFO] [stdout] = note: `#[warn(clippy::assign_op_pattern)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this operation has no effect [INFO] [stdout] --> assembler/src/generator/instruction.rs:274:43 [INFO] [stdout] | [INFO] [stdout] 274 | self.modrm = Some(0b00 | modrm | 4); [INFO] [stdout] | ^^^^^^^^^^^^ help: consider reducing it to: `modrm` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#identity_op [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of an assign operation [INFO] [stdout] --> assembler/src/generator/instruction.rs:276:25 [INFO] [stdout] | [INFO] [stdout] 276 | sib = sib | 5; [INFO] [stdout] | ^^^^^^^^^^^^^ help: replace it with: `sib |= 5` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assign_op_pattern [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: manual implementation of an assign operation [INFO] [stdout] --> assembler/src/generator/instruction.rs:289:21 [INFO] [stdout] | [INFO] [stdout] 289 | sib = sib | (0b00100 << 3); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `sib |= (0b00100 << 3)` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assign_op_pattern [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: writing `&mut Vec` instead of `&mut [_]` involves a new object where a slice will do [INFO] [stdout] --> assembler/src/generator/mod.rs:153:69 [INFO] [stdout] | [INFO] [stdout] 153 | fn handle_relative_relocation(&self, section: Section, content: &mut Vec, rel: &mut Vec) { [INFO] [stdout] | ^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg [INFO] [stdout] = note: `#[warn(clippy::ptr_arg)]` on by default [INFO] [stdout] help: change this to [INFO] [stdout] | [INFO] [stdout] 153 - fn handle_relative_relocation(&self, section: Section, content: &mut Vec, rel: &mut Vec) { [INFO] [stdout] 153 + fn handle_relative_relocation(&self, section: Section, content: &mut [u8], rel: &mut Vec) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this boolean expression can be simplified [INFO] [stdout] --> assembler/src/generator/mod.rs:510:20 [INFO] [stdout] | [INFO] [stdout] 510 | if !size.is_none() { // jmp/call rel 必须没有后缀, 大小由操作数决定 [INFO] [stdout] | ^^^^^^^^^^^^^^^ help: try: `size.is_some()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#nonminimal_bool [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do [INFO] [stdout] --> assembler/src/generator/mod.rs:418:90 [INFO] [stdout] | [INFO] [stdout] 418 | fn make_instruction(&mut self, info: &InstructionInfo, size: Option, operands: &Vec) -> Option { [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] 418 - fn make_instruction(&mut self, info: &InstructionInfo, size: Option, operands: &Vec) -> Option { [INFO] [stdout] 418 + fn make_instruction(&mut self, info: &InstructionInfo, size: Option, operands: &[OperandNode]) -> Option { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: length comparison to zero [INFO] [stdout] --> assembler/src/generator/mod.rs:428:20 [INFO] [stdout] | [INFO] [stdout] 428 | if operands.len() != 0 { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!operands.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: manual implementation of `Option::map` [INFO] [stdout] --> assembler/src/generator/mod.rs:809:20 [INFO] [stdout] | [INFO] [stdout] 809 | let disp = match &mem.displacement { [INFO] [stdout] | ____________________^ [INFO] [stdout] 810 | | Some(node) => Some(self.value_of_node(&node, false)), [INFO] [stdout] 811 | | None => None, [INFO] [stdout] 812 | | }; [INFO] [stdout] | |_________^ help: try: `mem.displacement.as_ref().map(|node| self.value_of_node(&node, false))` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_map [INFO] [stdout] = note: `#[warn(clippy::manual_map)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> assembler/src/generator/mod.rs:810:51 [INFO] [stdout] | [INFO] [stdout] 810 | Some(node) => Some(self.value_of_node(&node, false)), [INFO] [stdout] | ^^^^^ help: change this to: `node` [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: needlessly taken reference of left operand [INFO] [stdout] --> assembler/src/generator/mod.rs:878:20 [INFO] [stdout] | [INFO] [stdout] 878 | return ®.name == name; [INFO] [stdout] | ---------^^^^^^^^ [INFO] [stdout] | | [INFO] [stdout] | help: use the left value directly: `reg.name` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#op_ref [INFO] [stdout] = note: `#[warn(clippy::op_ref)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: match expression looks like `matches!` macro [INFO] [stdout] --> assembler/src/generator/mod.rs:885:20 [INFO] [stdout] | [INFO] [stdout] 885 | return match ®.name[..] { [INFO] [stdout] | ____________________^ [INFO] [stdout] 886 | | "al" | "ax" | "eax" => true, [INFO] [stdout] 887 | | _ => false, [INFO] [stdout] 888 | | }; [INFO] [stdout] | |_____________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_like_matches_macro [INFO] [stdout] = note: `#[warn(clippy::match_like_matches_macro)]` on by default [INFO] [stdout] help: use `matches!` directly [INFO] [stdout] | [INFO] [stdout] 885 - return match ®.name[..] { [INFO] [stdout] 886 - "al" | "ax" | "eax" => true, [INFO] [stdout] 887 - _ => false, [INFO] [stdout] 888 - }; [INFO] [stdout] 885 + return matches!(®.name[..], "al" | "ax" | "eax"); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: match expression looks like `matches!` macro [INFO] [stdout] --> assembler/src/generator/mod.rs:898:9 [INFO] [stdout] | [INFO] [stdout] 898 | / match self { [INFO] [stdout] 899 | | OperandNode::Immediate(_) => true, [INFO] [stdout] 900 | | _ => false, [INFO] [stdout] 901 | | } [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_like_matches_macro [INFO] [stdout] help: use `matches!` directly [INFO] [stdout] | [INFO] [stdout] 898 - match self { [INFO] [stdout] 899 - OperandNode::Immediate(_) => true, [INFO] [stdout] 900 - _ => false, [INFO] [stdout] 901 - } [INFO] [stdout] 898 + matches!(self, OperandNode::Immediate(_)) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: match expression looks like `matches!` macro [INFO] [stdout] --> assembler/src/generator/mod.rs:905:9 [INFO] [stdout] | [INFO] [stdout] 905 | / match self { [INFO] [stdout] 906 | | OperandNode::Memory(..) => true, [INFO] [stdout] 907 | | _ => false, [INFO] [stdout] 908 | | } [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_like_matches_macro [INFO] [stdout] help: use `matches!` directly [INFO] [stdout] | [INFO] [stdout] 905 - match self { [INFO] [stdout] 906 - OperandNode::Memory(..) => true, [INFO] [stdout] 907 - _ => false, [INFO] [stdout] 908 - } [INFO] [stdout] 905 + matches!(self, OperandNode::Memory(..)) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stderr] Finished `dev` profile [unoptimized + debuginfo] target(s) in 4.03s [INFO] running `Command { std: "docker" "inspect" "d60cccd917eb279f4980d25791d2920535a05a513a39249202a36bd2eae98e32", kill_on_drop: false }` [INFO] running `Command { std: "docker" "rm" "-f" "d60cccd917eb279f4980d25791d2920535a05a513a39249202a36bd2eae98e32", kill_on_drop: false }` [INFO] [stdout] d60cccd917eb279f4980d25791d2920535a05a513a39249202a36bd2eae98e32