[INFO] cloning repository https://github.com/Sailor-wu/blockchain_project [INFO] running `Command { std: "git" "-c" "credential.helper=" "-c" "credential.helper=/workspace/cargo-home/bin/git-credential-null" "clone" "--bare" "https://github.com/Sailor-wu/blockchain_project" "/workspace/cache/git-repos/https%3A%2F%2Fgithub.com%2FSailor-wu%2Fblockchain_project", kill_on_drop: false }` [INFO] [stderr] Cloning into bare repository '/workspace/cache/git-repos/https%3A%2F%2Fgithub.com%2FSailor-wu%2Fblockchain_project'... [INFO] running `Command { std: "git" "rev-parse" "HEAD", kill_on_drop: false }` [INFO] [stdout] e21ff0f9fc78d0eaf15c7f3a77ec26dbf35c1b9b [INFO] linting Sailor-wu/blockchain_project against nightly for clippy-nonminimal_bool-denied [INFO] running `Command { std: "git" "clone" "/workspace/cache/git-repos/https%3A%2F%2Fgithub.com%2FSailor-wu%2Fblockchain_project" "/workspace/builds/worker-1-tc1/source", kill_on_drop: false }` [INFO] [stderr] Cloning into '/workspace/builds/worker-1-tc1/source'... [INFO] [stderr] done. [INFO] started tweaking git repo https://github.com/Sailor-wu/blockchain_project [INFO] finished tweaking git repo https://github.com/Sailor-wu/blockchain_project [INFO] tweaked toml for git repo https://github.com/Sailor-wu/blockchain_project written to /workspace/builds/worker-1-tc1/source/Cargo.toml [INFO] validating manifest of git repo https://github.com/Sailor-wu/blockchain_project 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/Sailor-wu/blockchain_project 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] running `Command { std: "docker" "create" "-v" "/var/lib/crater-agent-workspace/builds/worker-1-tc1/target:/opt/rustwide/target:rw,Z" "-v" "/var/lib/crater-agent-workspace/builds/worker-1-tc1/source:/opt/rustwide/workdir:ro,Z" "-v" "/var/lib/crater-agent-workspace/cargo-home:/opt/rustwide/cargo-home:ro,Z" "-v" "/var/lib/crater-agent-workspace/rustup-home:/opt/rustwide/rustup-home:ro,Z" "-e" "SOURCE_DIR=/opt/rustwide/workdir" "-e" "CARGO_TARGET_DIR=/opt/rustwide/target" "-e" "CARGO_HOME=/opt/rustwide/cargo-home" "-e" "RUSTUP_HOME=/opt/rustwide/rustup-home" "-w" "/opt/rustwide/workdir" "-m" "1610612736" "--user" "0:0" "--network" "none" "ghcr.io/rust-lang/crates-build-env/linux@sha256:d429b63d4308055ea97f60fb1d3dfca48854a00942f1bd2ad806beaf015945ec" "/opt/rustwide/cargo-home/bin/cargo" "+nightly" "metadata" "--no-deps" "--format-version=1", kill_on_drop: false }` [INFO] [stdout] 685a7f6e7f625e133ef13ed0a39c8f1d8d2dffc923ce62318da1a10a78f4ce4a [INFO] running `Command { std: "docker" "start" "-a" "685a7f6e7f625e133ef13ed0a39c8f1d8d2dffc923ce62318da1a10a78f4ce4a", kill_on_drop: false }` [INFO] running `Command { std: "docker" "inspect" "685a7f6e7f625e133ef13ed0a39c8f1d8d2dffc923ce62318da1a10a78f4ce4a", kill_on_drop: false }` [INFO] running `Command { std: "docker" "rm" "-f" "685a7f6e7f625e133ef13ed0a39c8f1d8d2dffc923ce62318da1a10a78f4ce4a", kill_on_drop: false }` [INFO] [stdout] 685a7f6e7f625e133ef13ed0a39c8f1d8d2dffc923ce62318da1a10a78f4ce4a [INFO] running `Command { std: "docker" "create" "-v" "/var/lib/crater-agent-workspace/builds/worker-1-tc1/target:/opt/rustwide/target:rw,Z" "-v" "/var/lib/crater-agent-workspace/builds/worker-1-tc1/source:/opt/rustwide/workdir:ro,Z" "-v" "/var/lib/crater-agent-workspace/cargo-home:/opt/rustwide/cargo-home:ro,Z" "-v" "/var/lib/crater-agent-workspace/rustup-home:/opt/rustwide/rustup-home:ro,Z" "-e" "SOURCE_DIR=/opt/rustwide/workdir" "-e" "CARGO_TARGET_DIR=/opt/rustwide/target" "-e" "CARGO_INCREMENTAL=0" "-e" "RUST_BACKTRACE=full" "-e" "RUSTFLAGS=--cap-lints=forbid" "-e" "RUSTDOCFLAGS=--cap-lints=forbid" "-e" "CARGO_HOME=/opt/rustwide/cargo-home" "-e" "RUSTUP_HOME=/opt/rustwide/rustup-home" "-w" "/opt/rustwide/workdir" "-m" "1610612736" "--user" "0:0" "--network" "none" "ghcr.io/rust-lang/crates-build-env/linux@sha256:d429b63d4308055ea97f60fb1d3dfca48854a00942f1bd2ad806beaf015945ec" "/opt/rustwide/cargo-home/bin/cargo" "+nightly" "clippy" "--frozen" "--all" "--all-targets" "--message-format=json", kill_on_drop: false }` [INFO] [stdout] 7e078058b4c1ca0128cdff462f1c7deb9b21ee73bd5b5b46b06bdaea273a4c98 [INFO] running `Command { std: "docker" "start" "-a" "7e078058b4c1ca0128cdff462f1c7deb9b21ee73bd5b5b46b06bdaea273a4c98", kill_on_drop: false }` [INFO] [stderr] Compiling unicode-ident v1.0.20 [INFO] [stderr] Checking socket2 v0.6.1 [INFO] [stderr] Checking signal-hook-registry v1.4.6 [INFO] [stderr] Checking mio v1.1.0 [INFO] [stderr] Checking parking_lot_core v0.9.12 [INFO] [stderr] Checking tracing v0.1.41 [INFO] [stderr] Checking futures-util v0.3.31 [INFO] [stderr] Compiling cc v1.2.41 [INFO] [stderr] Compiling proc-macro2 v1.0.101 [INFO] [stderr] Checking sync_wrapper v1.0.2 [INFO] [stderr] Checking http-range-header v0.4.2 [INFO] [stderr] Checking tower v0.4.13 [INFO] [stderr] Checking rand v0.8.5 [INFO] [stderr] Compiling quote v1.0.41 [INFO] [stderr] Checking parking_lot v0.12.5 [INFO] [stderr] Compiling syn v2.0.107 [INFO] [stderr] Compiling ring v0.17.14 [INFO] [stderr] Compiling tokio-macros v2.6.0 [INFO] [stderr] Compiling serde_derive v1.0.228 [INFO] [stderr] Compiling async-trait v0.1.89 [INFO] [stderr] Checking tokio v1.48.0 [INFO] [stderr] Checking axum-core v0.4.5 [INFO] [stderr] Checking serde v1.0.228 [INFO] [stderr] Checking serde_urlencoded v0.7.1 [INFO] [stderr] Checking chrono v0.4.42 [INFO] [stderr] Checking bincode v1.3.3 [INFO] [stderr] Checking hyper v1.7.0 [INFO] [stderr] Checking tower v0.5.2 [INFO] [stderr] Checking tokio-util v0.7.16 [INFO] [stderr] Checking tower-http v0.5.2 [INFO] [stderr] Checking hyper-util v0.1.17 [INFO] [stderr] Checking axum v0.7.9 [INFO] [stderr] Checking blockchain_project v0.1.0 (/opt/rustwide/workdir) [INFO] [stdout] warning: unused import: `Ed25519KeyPair` [INFO] [stdout] --> src/cli.rs:4:23 [INFO] [stdout] | [INFO] [stdout] 4 | use ring::signature::{Ed25519KeyPair, KeyPair}; [INFO] [stdout] | ^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unused import: `std::collections::HashMap` [INFO] [stdout] --> src/cli.rs:8:5 [INFO] [stdout] | [INFO] [stdout] 8 | use std::collections::HashMap; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unused import: `Ed25519KeyPair` [INFO] [stdout] --> src/wallet.rs:2:23 [INFO] [stdout] | [INFO] [stdout] 2 | use ring::signature::{Ed25519KeyPair, KeyPair}; [INFO] [stdout] | ^^^^^^^^^^^^^^ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this import is redundant [INFO] [stdout] --> src/wallet.rs:6:1 [INFO] [stdout] | [INFO] [stdout] 6 | use hex; [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: empty line after doc comment [INFO] [stdout] --> src/wallet.rs:141:1 [INFO] [stdout] | [INFO] [stdout] 141 | / /// 钱包 CLI 功能 [INFO] [stdout] 142 | | [INFO] [stdout] | |_^ [INFO] [stdout] 143 | /// 创建钱包 CLI [INFO] [stdout] 144 | pub fn create_wallet_cli(wallet_manager: &WalletManager) { [INFO] [stdout] | ------------------------ the comment documents this function [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 line is unintentional, remove it [INFO] [stdout] help: if the documentation should include the empty line include it in the comment [INFO] [stdout] | [INFO] [stdout] 142 | /// [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unused import: `Block` [INFO] [stdout] --> src/web.rs:2:20 [INFO] [stdout] | [INFO] [stdout] 2 | use crate::block::{Block, Transaction}; [INFO] [stdout] | ^^^^^ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unused import: `http::StatusCode` [INFO] [stdout] --> src/web.rs:6:5 [INFO] [stdout] | [INFO] [stdout] 6 | http::StatusCode, [INFO] [stdout] | ^^^^^^^^^^^^^^^^ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unused import: `Ed25519KeyPair` [INFO] [stdout] --> src/cli.rs:4:23 [INFO] [stdout] | [INFO] [stdout] 4 | use ring::signature::{Ed25519KeyPair, KeyPair}; [INFO] [stdout] | ^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: `#[warn(unused_imports)]` (part of `#[warn(unused)]`) on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unused import: `std::collections::HashMap` [INFO] [stdout] --> src/cli.rs:8:5 [INFO] [stdout] | [INFO] [stdout] 8 | use std::collections::HashMap; [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unused import: `Ed25519KeyPair` [INFO] [stdout] --> src/wallet.rs:2:23 [INFO] [stdout] | [INFO] [stdout] 2 | use ring::signature::{Ed25519KeyPair, KeyPair}; [INFO] [stdout] | ^^^^^^^^^^^^^^ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this import is redundant [INFO] [stdout] --> src/wallet.rs:6:1 [INFO] [stdout] | [INFO] [stdout] 6 | use hex; [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: empty line after doc comment [INFO] [stdout] --> src/wallet.rs:141:1 [INFO] [stdout] | [INFO] [stdout] 141 | / /// 钱包 CLI 功能 [INFO] [stdout] 142 | | [INFO] [stdout] | |_^ [INFO] [stdout] 143 | /// 创建钱包 CLI [INFO] [stdout] 144 | pub fn create_wallet_cli(wallet_manager: &WalletManager) { [INFO] [stdout] | ------------------------ the comment documents this function [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 line is unintentional, remove it [INFO] [stdout] help: if the documentation should include the empty line include it in the comment [INFO] [stdout] | [INFO] [stdout] 142 | /// [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unused import: `Block` [INFO] [stdout] --> src/web.rs:2:20 [INFO] [stdout] | [INFO] [stdout] 2 | use crate::block::{Block, Transaction}; [INFO] [stdout] | ^^^^^ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unused import: `http::StatusCode` [INFO] [stdout] --> src/web.rs:6:5 [INFO] [stdout] | [INFO] [stdout] 6 | http::StatusCode, [INFO] [stdout] | ^^^^^^^^^^^^^^^^ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unused variable: `blockchain` [INFO] [stdout] --> src/consensus.rs:225:32 [INFO] [stdout] | [INFO] [stdout] 225 | fn select_validator(&self, blockchain: &Blockchain) -> Option { [INFO] [stdout] | ^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_blockchain` [INFO] [stdout] | [INFO] [stdout] = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unused variable: `private_key_bytes` [INFO] [stdout] --> src/wallet.rs:31:13 [INFO] [stdout] | [INFO] [stdout] 31 | let private_key_bytes = hex::decode(private_key_hex) [INFO] [stdout] | ^^^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_private_key_bytes` [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unused variable: `key` [INFO] [stdout] --> src/main.rs:349:26 [INFO] [stdout] | [INFO] [stdout] 349 | for (key, delegation) in &dpos.delegations { [INFO] [stdout] | ^^^ help: if this is intentional, prefix it with an underscore: `_key` [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: field `address` is never read [INFO] [stdout] --> src/p2p_node.rs:56:9 [INFO] [stdout] | [INFO] [stdout] 55 | pub struct PeerInfo { [INFO] [stdout] | -------- field in this struct [INFO] [stdout] 56 | pub address: SocketAddr, [INFO] [stdout] | ^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: `PeerInfo` has derived impls for the traits `Clone` and `Debug`, but these are intentionally ignored during dead code analysis [INFO] [stdout] = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: methods `broadcast_block`, `stop`, and `request_chain_sync` are never used [INFO] [stdout] --> src/p2p_node.rs:133:12 [INFO] [stdout] | [INFO] [stdout] 60 | impl P2PNode { [INFO] [stdout] | ------------ methods in this implementation [INFO] [stdout] ... [INFO] [stdout] 133 | pub fn broadcast_block(&self, block: Block) -> Result<(), Box> { [INFO] [stdout] | ^^^^^^^^^^^^^^^ [INFO] [stdout] ... [INFO] [stdout] 328 | pub fn stop(&mut self) { [INFO] [stdout] | ^^^^ [INFO] [stdout] ... [INFO] [stdout] 607 | pub fn request_chain_sync(&self, peer_address: SocketAddr) -> Result<(), Box> { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: trait `Consensus` is never used [INFO] [stdout] --> src/consensus.rs:15:11 [INFO] [stdout] | [INFO] [stdout] 15 | pub trait Consensus { [INFO] [stdout] | ^^^^^^^^^ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: methods `get_address` and `get_public_key` are never used [INFO] [stdout] --> src/wallet.rs:46:12 [INFO] [stdout] | [INFO] [stdout] 16 | impl Wallet { [INFO] [stdout] | ----------- methods in this implementation [INFO] [stdout] ... [INFO] [stdout] 46 | pub fn get_address(&self) -> &str { [INFO] [stdout] | ^^^^^^^^^^^ [INFO] [stdout] ... [INFO] [stdout] 51 | pub fn get_public_key(&self) -> &str { [INFO] [stdout] | ^^^^^^^^^^^^^^ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: field `wallet_manager` is never read [INFO] [stdout] --> src/web.rs:21:9 [INFO] [stdout] | [INFO] [stdout] 19 | pub struct AppState { [INFO] [stdout] | -------- field in this struct [INFO] [stdout] 20 | pub blockchain: Arc>, [INFO] [stdout] 21 | pub wallet_manager: Arc, [INFO] [stdout] | ^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: `AppState` has a derived impl for the trait `Clone`, but this is intentionally ignored during dead code analysis [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant pattern matching, consider using `is_ok()` [INFO] [stdout] --> src/block.rs:108:9 [INFO] [stdout] | [INFO] [stdout] 108 | / match signature::UnparsedPublicKey::new(&signature::ED25519, &public_key_bytes).verify(message.as_bytes(), &signature_byt... [INFO] [stdout] 109 | | Ok(_) => true, [INFO] [stdout] 110 | | Err(_) => false, [INFO] [stdout] 111 | | } [INFO] [stdout] | |_________^ help: try: `signature::UnparsedPublicKey::new(&signature::ED25519, &public_key_bytes).verify(message.as_bytes(), &signature_bytes).is_ok()` [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 `if` statement can be collapsed [INFO] [stdout] --> src/blockchain.rs:75:9 [INFO] [stdout] | [INFO] [stdout] 75 | / if transaction.signature.is_some() { [INFO] [stdout] 76 | | if !transaction.verify_signature() { [INFO] [stdout] 77 | | return Err("交易签名验证失败".to_string()); [INFO] [stdout] 78 | | } [INFO] [stdout] 79 | | } [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] 75 ~ if transaction.signature.is_some() [INFO] [stdout] 76 ~ && !transaction.verify_signature() { [INFO] [stdout] 77 | return Err("交易签名验证失败".to_string()); [INFO] [stdout] 78 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `u64` which implements the `Copy` trait [INFO] [stdout] --> src/blockchain.rs:160:9 [INFO] [stdout] | [INFO] [stdout] 160 | self.balances.get(address).unwrap_or(&0).clone() [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try dereferencing it: `*self.balances.get(address).unwrap_or(&0)` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] = note: `#[warn(clippy::clone_on_copy)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this boolean expression can be simplified [INFO] [stdout] --> src/blockchain.rs:267:12 [INFO] [stdout] | [INFO] [stdout] 267 | if !fs::metadata(filename).is_ok() { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `fs::metadata(filename).is_err()` [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_some()` [INFO] [stdout] --> src/consensus.rs:81:16 [INFO] [stdout] | [INFO] [stdout] 81 | if let Some(_) = self.stakes.remove(&validator) { [INFO] [stdout] | -------^^^^^^^--------------------------------- help: try: `if self.stakes.remove(&validator).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] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/consensus.rs:97:9 [INFO] [stdout] | [INFO] [stdout] 97 | / if let Some(validator) = &block.header.validator { [INFO] [stdout] 98 | | if !self.stakes.contains_key(validator) { [INFO] [stdout] 99 | | return false; [INFO] [stdout] 100 | | } [INFO] [stdout] 101 | | } [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] 97 ~ if let Some(validator) = &block.header.validator [INFO] [stdout] 98 ~ && !self.stakes.contains_key(validator) { [INFO] [stdout] 99 | return false; [INFO] [stdout] 100 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/consensus.rs:216:9 [INFO] [stdout] | [INFO] [stdout] 216 | / if let Some(validator) = &block.header.validator { [INFO] [stdout] 217 | | if !self.candidates.contains(&validator) { [INFO] [stdout] 218 | | return false; [INFO] [stdout] 219 | | } [INFO] [stdout] 220 | | } [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] 216 ~ if let Some(validator) = &block.header.validator [INFO] [stdout] 217 ~ && !self.candidates.contains(&validator) { [INFO] [stdout] 218 | return false; [INFO] [stdout] 219 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/consensus.rs:217:42 [INFO] [stdout] | [INFO] [stdout] 217 | if !self.candidates.contains(&validator) { [INFO] [stdout] | ^^^^^^^^^^ help: change this to: `validator` [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: unused variable: `blockchain` [INFO] [stdout] --> src/consensus.rs:225:32 [INFO] [stdout] | [INFO] [stdout] 225 | fn select_validator(&self, blockchain: &Blockchain) -> Option { [INFO] [stdout] | ^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_blockchain` [INFO] [stdout] | [INFO] [stdout] = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unused variable: `private_key_bytes` [INFO] [stdout] --> src/wallet.rs:31:13 [INFO] [stdout] | [INFO] [stdout] 31 | let private_key_bytes = hex::decode(private_key_hex) [INFO] [stdout] | ^^^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_private_key_bytes` [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unused variable: `key` [INFO] [stdout] --> src/main.rs:349:26 [INFO] [stdout] | [INFO] [stdout] 349 | for (key, delegation) in &dpos.delegations { [INFO] [stdout] | ^^^ help: if this is intentional, prefix it with an underscore: `_key` [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: field `address` is never read [INFO] [stdout] --> src/p2p_node.rs:56:9 [INFO] [stdout] | [INFO] [stdout] 55 | pub struct PeerInfo { [INFO] [stdout] | -------- field in this struct [INFO] [stdout] 56 | pub address: SocketAddr, [INFO] [stdout] | ^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: `PeerInfo` has derived impls for the traits `Clone` and `Debug`, but these are intentionally ignored during dead code analysis [INFO] [stdout] = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: methods `broadcast_block`, `stop`, and `request_chain_sync` are never used [INFO] [stdout] --> src/p2p_node.rs:133:12 [INFO] [stdout] | [INFO] [stdout] 60 | impl P2PNode { [INFO] [stdout] | ------------ methods in this implementation [INFO] [stdout] ... [INFO] [stdout] 133 | pub fn broadcast_block(&self, block: Block) -> Result<(), Box> { [INFO] [stdout] | ^^^^^^^^^^^^^^^ [INFO] [stdout] ... [INFO] [stdout] 328 | pub fn stop(&mut self) { [INFO] [stdout] | ^^^^ [INFO] [stdout] ... [INFO] [stdout] 607 | pub fn request_chain_sync(&self, peer_address: SocketAddr) -> Result<(), Box> { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: trait `Consensus` is never used [INFO] [stdout] --> src/consensus.rs:15:11 [INFO] [stdout] | [INFO] [stdout] 15 | pub trait Consensus { [INFO] [stdout] | ^^^^^^^^^ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: methods `get_address` and `get_public_key` are never used [INFO] [stdout] --> src/wallet.rs:46:12 [INFO] [stdout] | [INFO] [stdout] 16 | impl Wallet { [INFO] [stdout] | ----------- methods in this implementation [INFO] [stdout] ... [INFO] [stdout] 46 | pub fn get_address(&self) -> &str { [INFO] [stdout] | ^^^^^^^^^^^ [INFO] [stdout] ... [INFO] [stdout] 51 | pub fn get_public_key(&self) -> &str { [INFO] [stdout] | ^^^^^^^^^^^^^^ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: field `wallet_manager` is never read [INFO] [stdout] --> src/web.rs:21:9 [INFO] [stdout] | [INFO] [stdout] 19 | pub struct AppState { [INFO] [stdout] | -------- field in this struct [INFO] [stdout] 20 | pub blockchain: Arc>, [INFO] [stdout] 21 | pub wallet_manager: Arc, [INFO] [stdout] | ^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: `AppState` has a derived impl for the trait `Clone`, but this is intentionally ignored during dead code analysis [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: redundant pattern matching, consider using `is_ok()` [INFO] [stdout] --> src/block.rs:108:9 [INFO] [stdout] | [INFO] [stdout] 108 | / match signature::UnparsedPublicKey::new(&signature::ED25519, &public_key_bytes).verify(message.as_bytes(), &signature_byt... [INFO] [stdout] 109 | | Ok(_) => true, [INFO] [stdout] 110 | | Err(_) => false, [INFO] [stdout] 111 | | } [INFO] [stdout] | |_________^ help: try: `signature::UnparsedPublicKey::new(&signature::ED25519, &public_key_bytes).verify(message.as_bytes(), &signature_bytes).is_ok()` [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 `if` statement can be collapsed [INFO] [stdout] --> src/blockchain.rs:75:9 [INFO] [stdout] | [INFO] [stdout] 75 | / if transaction.signature.is_some() { [INFO] [stdout] 76 | | if !transaction.verify_signature() { [INFO] [stdout] 77 | | return Err("交易签名验证失败".to_string()); [INFO] [stdout] 78 | | } [INFO] [stdout] 79 | | } [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] 75 ~ if transaction.signature.is_some() [INFO] [stdout] 76 ~ && !transaction.verify_signature() { [INFO] [stdout] 77 | return Err("交易签名验证失败".to_string()); [INFO] [stdout] 78 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: using `clone` on type `u64` which implements the `Copy` trait [INFO] [stdout] --> src/blockchain.rs:160:9 [INFO] [stdout] | [INFO] [stdout] 160 | self.balances.get(address).unwrap_or(&0).clone() [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try dereferencing it: `*self.balances.get(address).unwrap_or(&0)` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy [INFO] [stdout] = note: `#[warn(clippy::clone_on_copy)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this boolean expression can be simplified [INFO] [stdout] --> src/blockchain.rs:267:12 [INFO] [stdout] | [INFO] [stdout] 267 | if !fs::metadata(filename).is_ok() { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `fs::metadata(filename).is_err()` [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_some()` [INFO] [stdout] --> src/consensus.rs:81:16 [INFO] [stdout] | [INFO] [stdout] 81 | if let Some(_) = self.stakes.remove(&validator) { [INFO] [stdout] | -------^^^^^^^--------------------------------- help: try: `if self.stakes.remove(&validator).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] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/consensus.rs:97:9 [INFO] [stdout] | [INFO] [stdout] 97 | / if let Some(validator) = &block.header.validator { [INFO] [stdout] 98 | | if !self.stakes.contains_key(validator) { [INFO] [stdout] 99 | | return false; [INFO] [stdout] 100 | | } [INFO] [stdout] 101 | | } [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] 97 ~ if let Some(validator) = &block.header.validator [INFO] [stdout] 98 ~ && !self.stakes.contains_key(validator) { [INFO] [stdout] 99 | return false; [INFO] [stdout] 100 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this `if` statement can be collapsed [INFO] [stdout] --> src/consensus.rs:216:9 [INFO] [stdout] | [INFO] [stdout] 216 | / if let Some(validator) = &block.header.validator { [INFO] [stdout] 217 | | if !self.candidates.contains(&validator) { [INFO] [stdout] 218 | | return false; [INFO] [stdout] 219 | | } [INFO] [stdout] 220 | | } [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] 216 ~ if let Some(validator) = &block.header.validator [INFO] [stdout] 217 ~ && !self.candidates.contains(&validator) { [INFO] [stdout] 218 | return false; [INFO] [stdout] 219 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this expression creates a reference which is immediately dereferenced by the compiler [INFO] [stdout] --> src/consensus.rs:217:42 [INFO] [stdout] | [INFO] [stdout] 217 | if !self.candidates.contains(&validator) { [INFO] [stdout] | ^^^^^^^^^^ help: change this to: `validator` [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] [stderr] Finished `dev` profile [unoptimized + debuginfo] target(s) in 34.90s [INFO] running `Command { std: "docker" "inspect" "7e078058b4c1ca0128cdff462f1c7deb9b21ee73bd5b5b46b06bdaea273a4c98", kill_on_drop: false }` [INFO] running `Command { std: "docker" "rm" "-f" "7e078058b4c1ca0128cdff462f1c7deb9b21ee73bd5b5b46b06bdaea273a4c98", kill_on_drop: false }` [INFO] [stdout] 7e078058b4c1ca0128cdff462f1c7deb9b21ee73bd5b5b46b06bdaea273a4c98