[INFO] cloning repository https://github.com/zgershkoff/rchain [INFO] running `Command { std: "git" "-c" "credential.helper=" "-c" "credential.helper=/workspace/cargo-home/bin/git-credential-null" "clone" "--bare" "https://github.com/zgershkoff/rchain" "/workspace/cache/git-repos/https%3A%2F%2Fgithub.com%2Fzgershkoff%2Frchain", kill_on_drop: false }` [INFO] [stderr] Cloning into bare repository '/workspace/cache/git-repos/https%3A%2F%2Fgithub.com%2Fzgershkoff%2Frchain'... [INFO] running `Command { std: "git" "rev-parse" "HEAD", kill_on_drop: false }` [INFO] [stdout] 0498185670c66c29b2015a82b4327ee6e5b324aa [INFO] linting zgershkoff/rchain against nightly for clippy-nonminimal_bool-denied [INFO] running `Command { std: "git" "clone" "/workspace/cache/git-repos/https%3A%2F%2Fgithub.com%2Fzgershkoff%2Frchain" "/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/zgershkoff/rchain [INFO] finished tweaking git repo https://github.com/zgershkoff/rchain [INFO] tweaked toml for git repo https://github.com/zgershkoff/rchain written to /workspace/builds/worker-1-tc1/source/Cargo.toml [INFO] validating manifest of git repo https://github.com/zgershkoff/rchain 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/zgershkoff/rchain already has a lockfile, it will not be regenerated [INFO] running `Command { std: CARGO_HOME="/workspace/cargo-home" RUSTUP_HOME="/workspace/rustup-home" "/workspace/cargo-home/bin/cargo" "+nightly" "fetch" "--manifest-path" "Cargo.toml", kill_on_drop: false }` [INFO] [stderr] Downloading crates ... [INFO] [stderr] Downloaded blake2 v0.9.1 [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] 8ab88f60cfc3971a5a5b8b59934973cd12018bb5ea3712d28ec6f87878842f10 [INFO] running `Command { std: "docker" "start" "-a" "8ab88f60cfc3971a5a5b8b59934973cd12018bb5ea3712d28ec6f87878842f10", kill_on_drop: false }` [INFO] running `Command { std: "docker" "inspect" "8ab88f60cfc3971a5a5b8b59934973cd12018bb5ea3712d28ec6f87878842f10", kill_on_drop: false }` [INFO] running `Command { std: "docker" "rm" "-f" "8ab88f60cfc3971a5a5b8b59934973cd12018bb5ea3712d28ec6f87878842f10", kill_on_drop: false }` [INFO] [stdout] 8ab88f60cfc3971a5a5b8b59934973cd12018bb5ea3712d28ec6f87878842f10 [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] 7357cffa722ce888308380fa01094042f6abc294ad1e474491a9189b91745ec3 [INFO] running `Command { std: "docker" "start" "-a" "7357cffa722ce888308380fa01094042f6abc294ad1e474491a9189b91745ec3", kill_on_drop: false }` [INFO] [stderr] Compiling typenum v1.12.0 [INFO] [stderr] Compiling generic-array v0.14.4 [INFO] [stderr] Checking subtle v2.3.0 [INFO] [stderr] Checking opaque-debug v0.3.0 [INFO] [stderr] Checking digest v0.9.0 [INFO] [stderr] Checking crypto-mac v0.8.0 [INFO] [stderr] Checking blake2 v0.9.1 [INFO] [stderr] Checking rchain_v1 v0.1.0 (/opt/rustwide/workdir) [INFO] [stdout] warning: unused doc comment [INFO] [stdout] --> src/rchain/mod.rs:332:21 [INFO] [stdout] | [INFO] [stdout] 332 | / /// Warning! This is failable, if the number of blocks [INFO] [stdout] 333 | | /// exceeds a 128-bit integer. [INFO] [stdout] 334 | | /// This example chain is unlikely to have 10^40 transactions. [INFO] [stdout] 335 | | /// (That would take 10^30 years at 10 transactions per sec.) [INFO] [stdout] 336 | | /// For chains that big, it makes more sense to read from [INFO] [stdout] 337 | | /// newest block to oldest, with measures to truncate the [INFO] [stdout] 338 | | /// amount of data required. [INFO] [stdout] | |________________________________________________^ [INFO] [stdout] 339 | result.push((u128::try_from(i).unwrap(), transaction)) [INFO] [stdout] | ------------------------------------------------------ rustdoc does not generate documentation for expressions [INFO] [stdout] | [INFO] [stdout] = help: use `//` for a plain comment [INFO] [stdout] = note: `#[warn(unused_doc_comments)]` (part of `#[warn(unused)]`) on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: empty line after doc comment [INFO] [stdout] --> src/rchain/mod.rs:536:1 [INFO] [stdout] | [INFO] [stdout] 536 | / /// (trait and parameters are not within the local crate) [INFO] [stdout] 537 | | /*impl From<&std::vec::Vec> for std::string::String { [INFO] [stdout] 538 | | fn from(item: &Vec) -> Self { [INFO] [stdout] 539 | | item.iter().map(|&c| c as char).collect() [INFO] [stdout] 540 | | } [INFO] [stdout] 541 | | }*/ [INFO] [stdout] 542 | | [INFO] [stdout] | |_^ [INFO] [stdout] ... [INFO] [stdout] 545 | fn byte_vector_to_string(arr: &Vec) -> String { [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 doc comment should not document function `byte_vector_to_string` then comment it out [INFO] [stdout] | [INFO] [stdout] 533 ~ // /// Will take an array of bytes and transform it into a string by interpreting every byte [INFO] [stdout] 534 ~ // /// as an character due to RFC 1023 that's not possible [INFO] [stdout] 535 ~ // /// @Link https://github.com/rust-lang/rfcs/blob/master/text/1023-rebalancing-coherence.md [INFO] [stdout] 536 ~ // /// (trait and parameters are not within the local crate) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unused doc comment [INFO] [stdout] --> src/rchain/mod.rs:332:21 [INFO] [stdout] | [INFO] [stdout] 332 | / /// Warning! This is failable, if the number of blocks [INFO] [stdout] 333 | | /// exceeds a 128-bit integer. [INFO] [stdout] 334 | | /// This example chain is unlikely to have 10^40 transactions. [INFO] [stdout] 335 | | /// (That would take 10^30 years at 10 transactions per sec.) [INFO] [stdout] 336 | | /// For chains that big, it makes more sense to read from [INFO] [stdout] 337 | | /// newest block to oldest, with measures to truncate the [INFO] [stdout] 338 | | /// amount of data required. [INFO] [stdout] | |________________________________________________^ [INFO] [stdout] 339 | result.push((u128::try_from(i).unwrap(), transaction)) [INFO] [stdout] | ------------------------------------------------------ rustdoc does not generate documentation for expressions [INFO] [stdout] | [INFO] [stdout] = help: use `//` for a plain comment [INFO] [stdout] = note: `#[warn(unused_doc_comments)]` (part of `#[warn(unused)]`) on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: empty line after doc comment [INFO] [stdout] --> src/rchain/mod.rs:536:1 [INFO] [stdout] | [INFO] [stdout] 536 | / /// (trait and parameters are not within the local crate) [INFO] [stdout] 537 | | /*impl From<&std::vec::Vec> for std::string::String { [INFO] [stdout] 538 | | fn from(item: &Vec) -> Self { [INFO] [stdout] 539 | | item.iter().map(|&c| c as char).collect() [INFO] [stdout] 540 | | } [INFO] [stdout] 541 | | }*/ [INFO] [stdout] 542 | | [INFO] [stdout] | |_^ [INFO] [stdout] ... [INFO] [stdout] 545 | fn byte_vector_to_string(arr: &Vec) -> String { [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 doc comment should not document function `byte_vector_to_string` then comment it out [INFO] [stdout] | [INFO] [stdout] 533 ~ // /// Will take an array of bytes and transform it into a string by interpreting every byte [INFO] [stdout] 534 ~ // /// as an character due to RFC 1023 that's not possible [INFO] [stdout] 535 ~ // /// @Link https://github.com/rust-lang/rfcs/blob/master/text/1023-rebalancing-coherence.md [INFO] [stdout] 536 ~ // /// (trait and parameters are not within the local crate) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unused variable: `account` [INFO] [stdout] --> src/rchain/mod.rs:428:52 [INFO] [stdout] | [INFO] [stdout] 428 | TransactionData::CreateUserAccount(account) => {} [INFO] [stdout] | ^^^^^^^ help: if this is intentional, prefix it with an underscore: `_account` [INFO] [stdout] | [INFO] [stdout] = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: value assigned to `res` is never read [INFO] [stdout] --> src/main.rs:30:19 [INFO] [stdout] | [INFO] [stdout] 30 | let mut res = bc.append_block(genesis); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: maybe it is overwritten before being read? [INFO] [stdout] = note: `#[warn(unused_assignments)]` (part of `#[warn(unused)]`) on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: value assigned to `res` is never read [INFO] [stdout] --> src/main.rs:66:5 [INFO] [stdout] | [INFO] [stdout] 66 | res = bc.append_block(block3); [INFO] [stdout] | ^^^ [INFO] [stdout] | [INFO] [stdout] = help: maybe it is overwritten before being read? [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: field `pending_transactions` is never read [INFO] [stdout] --> src/rchain/mod.rs:26:5 [INFO] [stdout] | [INFO] [stdout] 16 | pub struct Blockchain { [INFO] [stdout] | ---------- field in this struct [INFO] [stdout] ... [INFO] [stdout] 26 | pending_transactions: Vec, [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: `Blockchain` 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: variant `ChangeStoreValue` is never constructed [INFO] [stdout] --> src/rchain/mod.rs:102:5 [INFO] [stdout] | [INFO] [stdout] 97 | pub enum TransactionData { [INFO] [stdout] | --------------- variant in this enum [INFO] [stdout] ... [INFO] [stdout] 102 | ChangeStoreValue { key: String, value: String }, [INFO] [stdout] | ^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: `TransactionData` has derived impls for the traits `Debug` and `Clone`, but these are intentionally ignored during dead code analysis [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: fields `store` and `acc_type` are never read [INFO] [stdout] --> src/rchain/mod.rs:119:5 [INFO] [stdout] | [INFO] [stdout] 117 | pub struct Account { [INFO] [stdout] | ------- fields in this struct [INFO] [stdout] 118 | /// We want the account to be able to store any information we want (Dictionary) [INFO] [stdout] 119 | store: HashMap, [INFO] [stdout] | ^^^^^ [INFO] [stdout] ... [INFO] [stdout] 122 | acc_type: AccountType, [INFO] [stdout] | ^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: `Account` has derived impls for the traits `Debug` and `Clone`, but these are intentionally ignored during dead code analysis [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: variants `Contract` and `Validator` are never constructed [INFO] [stdout] --> src/rchain/mod.rs:140:5 [INFO] [stdout] | [INFO] [stdout] 132 | pub enum AccountType { [INFO] [stdout] | ----------- variants in this enum [INFO] [stdout] ... [INFO] [stdout] 140 | Contract, [INFO] [stdout] | ^^^^^^^^ [INFO] [stdout] ... [INFO] [stdout] 144 | Validator { [INFO] [stdout] | ^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: `AccountType` has derived impls for the traits `Debug` and `Clone`, but these are intentionally ignored during dead code analysis [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: method `set_nonce` is never used [INFO] [stdout] --> src/rchain/mod.rs:360:12 [INFO] [stdout] | [INFO] [stdout] 349 | impl Block { [INFO] [stdout] | ---------- method in this implementation [INFO] [stdout] ... [INFO] [stdout] 360 | pub fn set_nonce(&mut self, nonce: u128) { [INFO] [stdout] | ^^^^^^^^^ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: writing `&String` instead of `&str` involves a new object where a slice will do [INFO] [stdout] --> src/rchain/mod.rs:40:45 [INFO] [stdout] | [INFO] [stdout] 40 | fn get_account_by_id_mut(&mut self, id: &String) -> Option<&mut Account>; [INFO] [stdout] | ^^^^^^^ help: change this to: `&str` [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] [INFO] [stdout] [INFO] [stdout] warning: writing `&String` instead of `&str` involves a new object where a slice will do [INFO] [stdout] --> src/rchain/mod.rs:43:37 [INFO] [stdout] | [INFO] [stdout] 43 | fn get_account_by_id(&self, id: &String) -> Option<&Account>; [INFO] [stdout] | ^^^^^^^ help: change this to: `&str` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this boolean expression can be simplified [INFO] [stdout] --> src/rchain/mod.rs:177:12 [INFO] [stdout] | [INFO] [stdout] 177 | if !(block.prev_hash == self.get_last_block_hash()) { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(block.prev_hash != self.get_last_block_hash())` [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 boolean expression can be simplified [INFO] [stdout] --> src/rchain/mod.rs:259:20 [INFO] [stdout] | [INFO] [stdout] 259 | if !(&block.prev_hash == &self.blocks[block_num - 1].hash) { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(&block.prev_hash != &self.blocks[block_num - 1].hash)` [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: useless conversion to the same type: `std::string::String` [INFO] [stdout] --> src/rchain/mod.rs:238:28 [INFO] [stdout] | [INFO] [stdout] 238 | return Err(format!("Stored hash for Block #{} \ [INFO] [stdout] | ____________________________^ [INFO] [stdout] 239 | | does not match calculated hash (Code: 665234234)", block_num + 1).into()); [INFO] [stdout] | |____________________________________________________________________________________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion [INFO] [stdout] = note: `#[warn(clippy::useless_conversion)]` on by default [INFO] [stdout] help: consider removing `.into()` [INFO] [stdout] | [INFO] [stdout] 238 ~ return Err(format!("Stored hash for Block #{} \ [INFO] [stdout] 239 ~ does not match calculated hash (Code: 665234234)", block_num + 1)); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: useless conversion to the same type: `std::string::String` [INFO] [stdout] --> src/rchain/mod.rs:252:32 [INFO] [stdout] | [INFO] [stdout] 252 | return Err(format!("Block #{} has no previous hash set", block_num + 1).into()); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into()`: `format!("Block #{} has no previous hash set", block_num + 1)` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: needlessly taken reference of both operands [INFO] [stdout] --> src/rchain/mod.rs:259:21 [INFO] [stdout] | [INFO] [stdout] 259 | if !(&block.prev_hash == &self.blocks[block_num - 1].hash) { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [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] help: use the values directly [INFO] [stdout] | [INFO] [stdout] 259 - if !(&block.prev_hash == &self.blocks[block_num - 1].hash) { [INFO] [stdout] 259 + if !(block.prev_hash == self.blocks[block_num - 1].hash) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: useless conversion to the same type: `std::string::String` [INFO] [stdout] --> src/rchain/mod.rs:260:32 [INFO] [stdout] | [INFO] [stdout] 260 | return Err(format!("Block #{} is not connected to previous block (Hashes do \ [INFO] [stdout] | ________________________________^ [INFO] [stdout] 261 | | not match. Should be `{}` but is `{}`)", block_num, prev_hash_proposed, [INFO] [stdout] 262 | | prev_hash_actual).into()); [INFO] [stdout] | |_______________________________________________________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion [INFO] [stdout] help: consider removing `.into()` [INFO] [stdout] | [INFO] [stdout] 260 ~ return Err(format!("Block #{} is not connected to previous block (Hashes do \ [INFO] [stdout] 261 + not match. Should be `{}` but is `{}`)", block_num, prev_hash_proposed, [INFO] [stdout] 262 ~ prev_hash_actual)); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you are using an explicit closure for cloning elements [INFO] [stdout] --> src/rchain/mod.rs:283:9 [INFO] [stdout] | [INFO] [stdout] 283 | self.accounts.keys().map(|s| s.clone()).collect() [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `cloned` method: `self.accounts.keys().cloned()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_clone [INFO] [stdout] = note: `#[warn(clippy::map_clone)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/rchain/mod.rs:296:9 [INFO] [stdout] | [INFO] [stdout] 296 | / return if !self.get_user_ids().contains(&id) { [INFO] [stdout] 297 | | let acc = Account::new(account_type); [INFO] [stdout] 298 | | self.accounts.insert(id, acc); [INFO] [stdout] 299 | | Ok(()) [INFO] [stdout] 300 | | } else { [INFO] [stdout] 301 | | Err("User already exists! (Code: 934823094)") [INFO] [stdout] 302 | | }; [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] 296 ~ if !self.get_user_ids().contains(&id) { [INFO] [stdout] 297 + let acc = Account::new(account_type); [INFO] [stdout] 298 + self.accounts.insert(id, acc); [INFO] [stdout] 299 + Ok(()) [INFO] [stdout] 300 + } else { [INFO] [stdout] 301 + Err("User already exists! (Code: 934823094)") [INFO] [stdout] 302 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` [INFO] [stdout] --> src/rchain/mod.rs:312:17 [INFO] [stdout] | [INFO] [stdout] 312 | / match transaction.record { [INFO] [stdout] 313 | | // if CreateTokens, add amount to total [INFO] [stdout] 314 | | TransactionData::CreateTokens { receiver: _, amount } => { [INFO] [stdout] 315 | | tokens += amount; [INFO] [stdout] 316 | | } [INFO] [stdout] 317 | | _ => {} // ignore remaining cases [INFO] [stdout] 318 | | } [INFO] [stdout] | |_________________^ [INFO] [stdout] | [INFO] [stdout] = note: you might want to preserve the comments from inside the `match` [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] 312 ~ if let TransactionData::CreateTokens { receiver: _, amount } = transaction.record { [INFO] [stdout] 313 + tokens += amount; [INFO] [stdout] 314 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unused variable: `account` [INFO] [stdout] --> src/rchain/mod.rs:428:52 [INFO] [stdout] | [INFO] [stdout] 428 | TransactionData::CreateUserAccount(account) => {} [INFO] [stdout] | ^^^^^^^ help: if this is intentional, prefix it with an underscore: `_account` [INFO] [stdout] | [INFO] [stdout] = note: `#[warn(unused_variables)]` (part of `#[warn(unused)]`) on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/rchain/mod.rs:376:9 [INFO] [stdout] | [INFO] [stdout] 376 | return Vec::from(hasher.finalize().as_ref()); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 376 - return Vec::from(hasher.finalize().as_ref()); [INFO] [stdout] 376 + Vec::from(hasher.finalize().as_ref()) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: called `unwrap` on `balance_sender_new` after checking its variant with `is_some` [INFO] [stdout] --> src/rchain/mod.rs:481:85 [INFO] [stdout] | [INFO] [stdout] 480 | if balance_recv_new.is_some() && balance_sender_new.is_some() { [INFO] [stdout] | ---------------------------- the check is happening here [INFO] [stdout] 481 | world_state.get_account_by_id_mut(&self.from).unwrap().tokens = balance_sender_new.unwrap(); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: try using `match` [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_unwrap [INFO] [stdout] = note: `#[warn(clippy::unnecessary_unwrap)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: called `unwrap` on `balance_recv_new` after checking its variant with `is_some` [INFO] [stdout] --> src/rchain/mod.rs:482:77 [INFO] [stdout] | [INFO] [stdout] 480 | if balance_recv_new.is_some() && balance_sender_new.is_some() { [INFO] [stdout] | -------------------------- the check is happening here [INFO] [stdout] 481 | world_state.get_account_by_id_mut(&self.from).unwrap().tokens = balance_sender_new.unwrap(); [INFO] [stdout] 482 | world_state.get_account_by_id_mut(to).unwrap().tokens = balance_recv_new.unwrap(); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: try using `match` [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_unwrap [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/rchain/mod.rs:441:9 [INFO] [stdout] | [INFO] [stdout] 441 | / return match &self.record { [INFO] [stdout] 442 | | [INFO] [stdout] 443 | | TransactionData::CreateUserAccount(account) => { [INFO] [stdout] 444 | | world_state.create_account(account.into(), AccountType::User) [INFO] [stdout] ... | [INFO] [stdout] 492 | | }; [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 441 ~ match &self.record { [INFO] [stdout] 442 + [INFO] [stdout] 443 + TransactionData::CreateUserAccount(account) => { [INFO] [stdout] 444 + world_state.create_account(account.into(), AccountType::User) [INFO] [stdout] 445 + } [INFO] [stdout] 446 + [INFO] [stdout] 447 + TransactionData::CreateTokens { receiver, amount } => { [INFO] [stdout] 448 + if !is_initial { [INFO] [stdout] 449 + return Err("Token creation is only available on initial creation (Code: 2394233)"); [INFO] [stdout] 450 + } [INFO] [stdout] 451 + // Get the receiving user (must exist) [INFO] [stdout] 452 + return if let Some(account) = world_state.get_account_by_id_mut(receiver) { [INFO] [stdout] 453 + account.tokens += *amount; [INFO] [stdout] 454 + Ok(()) [INFO] [stdout] 455 + } else { [INFO] [stdout] 456 + Err("Receiver Account does not exist (Code: 23482309)") [INFO] [stdout] 457 + }; [INFO] [stdout] 458 + } [INFO] [stdout] 459 + [INFO] [stdout] 460 + TransactionData::TransferTokens { to, amount } => { [INFO] [stdout] 461 + let recv_tokens: u128; [INFO] [stdout] 462 + let sender_tokens: u128; [INFO] [stdout] 463 + [INFO] [stdout] 464 + if let Some(recv) = world_state.get_account_by_id_mut(to) { [INFO] [stdout] 465 + // Be extra careful here, even in the genesis block the sender account has to exist [INFO] [stdout] 466 + recv_tokens = recv.tokens; [INFO] [stdout] 467 + } else { [INFO] [stdout] 468 + return Err("Receiver Account does not exist! (Code: 3242342380)"); [INFO] [stdout] 469 + } [INFO] [stdout] 470 + [INFO] [stdout] 471 + if let Some(sender) = world_state.get_account_by_id_mut(&self.from) { [INFO] [stdout] 472 + sender_tokens = sender.tokens; [INFO] [stdout] 473 + } else { [INFO] [stdout] 474 + return Err("That account does not exist! (Code: 23423923)"); [INFO] [stdout] 475 + } [INFO] [stdout] 476 + [INFO] [stdout] 477 + let balance_recv_new = recv_tokens.checked_add(*amount); [INFO] [stdout] 478 + let balance_sender_new = sender_tokens.checked_sub(*amount); [INFO] [stdout] 479 + [INFO] [stdout] 480 + if balance_recv_new.is_some() && balance_sender_new.is_some() { [INFO] [stdout] 481 + world_state.get_account_by_id_mut(&self.from).unwrap().tokens = balance_sender_new.unwrap(); [INFO] [stdout] 482 + world_state.get_account_by_id_mut(to).unwrap().tokens = balance_recv_new.unwrap(); [INFO] [stdout] 483 + return Ok(()); [INFO] [stdout] 484 + } else { [INFO] [stdout] 485 + return Err("Overspent or Arithmetic error (Code: 48239084203)"); [INFO] [stdout] 486 + } [INFO] [stdout] 487 + } [INFO] [stdout] 488 + [INFO] [stdout] 489 + _ => { // Not implemented transaction type [INFO] [stdout] 490 + Err("Unknown Transaction type (not implemented) (Code: 487289724389)") [INFO] [stdout] 491 + } [INFO] [stdout] 492 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/rchain/mod.rs:502:9 [INFO] [stdout] | [INFO] [stdout] 502 | return Vec::from(hasher.finalize().as_ref()); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 502 - return Vec::from(hasher.finalize().as_ref()); [INFO] [stdout] 502 + Vec::from(hasher.finalize().as_ref()) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/rchain/mod.rs:525:9 [INFO] [stdout] | [INFO] [stdout] 525 | / return Self { [INFO] [stdout] 526 | | tokens: 0, [INFO] [stdout] 527 | | acc_type: account_type, [INFO] [stdout] 528 | | store: HashMap::new(), [INFO] [stdout] 529 | | }; [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 525 ~ Self { [INFO] [stdout] 526 + tokens: 0, [INFO] [stdout] 527 + acc_type: account_type, [INFO] [stdout] 528 + store: HashMap::new(), [INFO] [stdout] 529 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do [INFO] [stdout] --> src/rchain/mod.rs:545:31 [INFO] [stdout] | [INFO] [stdout] 545 | fn byte_vector_to_string(arr: &Vec) -> String { [INFO] [stdout] | ^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg [INFO] [stdout] help: change this to [INFO] [stdout] | [INFO] [stdout] 545 - fn byte_vector_to_string(arr: &Vec) -> String { [INFO] [stdout] 545 + fn byte_vector_to_string(arr: &[u8]) -> String { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: value assigned to `res` is never read [INFO] [stdout] --> src/main.rs:30:19 [INFO] [stdout] | [INFO] [stdout] 30 | let mut res = bc.append_block(genesis); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: maybe it is overwritten before being read? [INFO] [stdout] = note: `#[warn(unused_assignments)]` (part of `#[warn(unused)]`) on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: value assigned to `res` is never read [INFO] [stdout] --> src/main.rs:66:5 [INFO] [stdout] | [INFO] [stdout] 66 | res = bc.append_block(block3); [INFO] [stdout] | ^^^ [INFO] [stdout] | [INFO] [stdout] = help: maybe it is overwritten before being read? [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: field `pending_transactions` is never read [INFO] [stdout] --> src/rchain/mod.rs:26:5 [INFO] [stdout] | [INFO] [stdout] 16 | pub struct Blockchain { [INFO] [stdout] | ---------- field in this struct [INFO] [stdout] ... [INFO] [stdout] 26 | pending_transactions: Vec, [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: `Blockchain` 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: variant `ChangeStoreValue` is never constructed [INFO] [stdout] --> src/rchain/mod.rs:102:5 [INFO] [stdout] | [INFO] [stdout] 97 | pub enum TransactionData { [INFO] [stdout] | --------------- variant in this enum [INFO] [stdout] ... [INFO] [stdout] 102 | ChangeStoreValue { key: String, value: String }, [INFO] [stdout] | ^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: `TransactionData` has derived impls for the traits `Debug` and `Clone`, but these are intentionally ignored during dead code analysis [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: fields `store` and `acc_type` are never read [INFO] [stdout] --> src/rchain/mod.rs:119:5 [INFO] [stdout] | [INFO] [stdout] 117 | pub struct Account { [INFO] [stdout] | ------- fields in this struct [INFO] [stdout] 118 | /// We want the account to be able to store any information we want (Dictionary) [INFO] [stdout] 119 | store: HashMap, [INFO] [stdout] | ^^^^^ [INFO] [stdout] ... [INFO] [stdout] 122 | acc_type: AccountType, [INFO] [stdout] | ^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: `Account` has derived impls for the traits `Debug` and `Clone`, but these are intentionally ignored during dead code analysis [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: variants `Contract` and `Validator` are never constructed [INFO] [stdout] --> src/rchain/mod.rs:140:5 [INFO] [stdout] | [INFO] [stdout] 132 | pub enum AccountType { [INFO] [stdout] | ----------- variants in this enum [INFO] [stdout] ... [INFO] [stdout] 140 | Contract, [INFO] [stdout] | ^^^^^^^^ [INFO] [stdout] ... [INFO] [stdout] 144 | Validator { [INFO] [stdout] | ^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = note: `AccountType` has derived impls for the traits `Debug` and `Clone`, but these are intentionally ignored during dead code analysis [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: method `set_nonce` is never used [INFO] [stdout] --> src/rchain/mod.rs:360:12 [INFO] [stdout] | [INFO] [stdout] 349 | impl Block { [INFO] [stdout] | ---------- method in this implementation [INFO] [stdout] ... [INFO] [stdout] 360 | pub fn set_nonce(&mut self, nonce: u128) { [INFO] [stdout] | ^^^^^^^^^ [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: writing `&String` instead of `&str` involves a new object where a slice will do [INFO] [stdout] --> src/rchain/mod.rs:40:45 [INFO] [stdout] | [INFO] [stdout] 40 | fn get_account_by_id_mut(&mut self, id: &String) -> Option<&mut Account>; [INFO] [stdout] | ^^^^^^^ help: change this to: `&str` [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] [INFO] [stdout] [INFO] [stdout] warning: writing `&String` instead of `&str` involves a new object where a slice will do [INFO] [stdout] --> src/rchain/mod.rs:43:37 [INFO] [stdout] | [INFO] [stdout] 43 | fn get_account_by_id(&self, id: &String) -> Option<&Account>; [INFO] [stdout] | ^^^^^^^ help: change this to: `&str` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` [INFO] [stdout] --> src/main.rs:93:5 [INFO] [stdout] | [INFO] [stdout] 93 | / match transaction_data.record.borrow_mut() { [INFO] [stdout] 94 | | &mut TransactionData::TransferTokens {to:_, ref mut amount} => { [INFO] [stdout] 95 | | *amount = 100; // Actually change the value in place [INFO] [stdout] 96 | | }, [INFO] [stdout] 97 | | [INFO] [stdout] 98 | | _ => {} // We know that that recors is a TransferToken Action so we ignore the rest [INFO] [stdout] 99 | | } [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = note: you might want to preserve the comments from inside the `match` [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 93 ~ if let &mut TransactionData::TransferTokens {to:_, ref mut amount} = transaction_data.record.borrow_mut() { [INFO] [stdout] 94 + *amount = 100; // Actually change the value in place [INFO] [stdout] 95 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` [INFO] [stdout] --> src/main.rs:114:5 [INFO] [stdout] | [INFO] [stdout] 114 | / match transaction_data.record.borrow_mut() { [INFO] [stdout] 115 | | &mut TransactionData::CreateTokens {receiver: _, ref mut amount} => { [INFO] [stdout] 116 | | *amount = 100_000_000_000; // Let's dont be small on that [INFO] [stdout] 117 | | }, [INFO] [stdout] 118 | | _ => {} // We know that that record is a Token Create Action so we ignore the rest [INFO] [stdout] 119 | | } [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = note: you might want to preserve the comments from inside the `match` [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 114 ~ if let &mut TransactionData::CreateTokens {receiver: _, ref mut amount} = transaction_data.record.borrow_mut() { [INFO] [stdout] 115 + *amount = 100_000_000_000; // Let's dont be small on that [INFO] [stdout] 116 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: this boolean expression can be simplified [INFO] [stdout] --> src/rchain/mod.rs:177:12 [INFO] [stdout] | [INFO] [stdout] 177 | if !(block.prev_hash == self.get_last_block_hash()) { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(block.prev_hash != self.get_last_block_hash())` [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 boolean expression can be simplified [INFO] [stdout] --> src/rchain/mod.rs:259:20 [INFO] [stdout] | [INFO] [stdout] 259 | if !(&block.prev_hash == &self.blocks[block_num - 1].hash) { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(&block.prev_hash != &self.blocks[block_num - 1].hash)` [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: useless conversion to the same type: `std::string::String` [INFO] [stdout] --> src/rchain/mod.rs:238:28 [INFO] [stdout] | [INFO] [stdout] 238 | return Err(format!("Stored hash for Block #{} \ [INFO] [stdout] | ____________________________^ [INFO] [stdout] 239 | | does not match calculated hash (Code: 665234234)", block_num + 1).into()); [INFO] [stdout] | |____________________________________________________________________________________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion [INFO] [stdout] = note: `#[warn(clippy::useless_conversion)]` on by default [INFO] [stdout] help: consider removing `.into()` [INFO] [stdout] | [INFO] [stdout] 238 ~ return Err(format!("Stored hash for Block #{} \ [INFO] [stdout] 239 ~ does not match calculated hash (Code: 665234234)", block_num + 1)); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: useless conversion to the same type: `std::string::String` [INFO] [stdout] --> src/rchain/mod.rs:252:32 [INFO] [stdout] | [INFO] [stdout] 252 | return Err(format!("Block #{} has no previous hash set", block_num + 1).into()); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing `.into()`: `format!("Block #{} has no previous hash set", block_num + 1)` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: needlessly taken reference of both operands [INFO] [stdout] --> src/rchain/mod.rs:259:21 [INFO] [stdout] | [INFO] [stdout] 259 | if !(&block.prev_hash == &self.blocks[block_num - 1].hash) { [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [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] help: use the values directly [INFO] [stdout] | [INFO] [stdout] 259 - if !(&block.prev_hash == &self.blocks[block_num - 1].hash) { [INFO] [stdout] 259 + if !(block.prev_hash == self.blocks[block_num - 1].hash) { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: useless conversion to the same type: `std::string::String` [INFO] [stdout] --> src/rchain/mod.rs:260:32 [INFO] [stdout] | [INFO] [stdout] 260 | return Err(format!("Block #{} is not connected to previous block (Hashes do \ [INFO] [stdout] | ________________________________^ [INFO] [stdout] 261 | | not match. Should be `{}` but is `{}`)", block_num, prev_hash_proposed, [INFO] [stdout] 262 | | prev_hash_actual).into()); [INFO] [stdout] | |_______________________________________________________________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion [INFO] [stdout] help: consider removing `.into()` [INFO] [stdout] | [INFO] [stdout] 260 ~ return Err(format!("Block #{} is not connected to previous block (Hashes do \ [INFO] [stdout] 261 + not match. Should be `{}` but is `{}`)", block_num, prev_hash_proposed, [INFO] [stdout] 262 ~ prev_hash_actual)); [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you are using an explicit closure for cloning elements [INFO] [stdout] --> src/rchain/mod.rs:283:9 [INFO] [stdout] | [INFO] [stdout] 283 | self.accounts.keys().map(|s| s.clone()).collect() [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider calling the dedicated `cloned` method: `self.accounts.keys().cloned()` [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_clone [INFO] [stdout] = note: `#[warn(clippy::map_clone)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/rchain/mod.rs:296:9 [INFO] [stdout] | [INFO] [stdout] 296 | / return if !self.get_user_ids().contains(&id) { [INFO] [stdout] 297 | | let acc = Account::new(account_type); [INFO] [stdout] 298 | | self.accounts.insert(id, acc); [INFO] [stdout] 299 | | Ok(()) [INFO] [stdout] 300 | | } else { [INFO] [stdout] 301 | | Err("User already exists! (Code: 934823094)") [INFO] [stdout] 302 | | }; [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] 296 ~ if !self.get_user_ids().contains(&id) { [INFO] [stdout] 297 + let acc = Account::new(account_type); [INFO] [stdout] 298 + self.accounts.insert(id, acc); [INFO] [stdout] 299 + Ok(()) [INFO] [stdout] 300 + } else { [INFO] [stdout] 301 + Err("User already exists! (Code: 934823094)") [INFO] [stdout] 302 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` [INFO] [stdout] --> src/rchain/mod.rs:312:17 [INFO] [stdout] | [INFO] [stdout] 312 | / match transaction.record { [INFO] [stdout] 313 | | // if CreateTokens, add amount to total [INFO] [stdout] 314 | | TransactionData::CreateTokens { receiver: _, amount } => { [INFO] [stdout] 315 | | tokens += amount; [INFO] [stdout] 316 | | } [INFO] [stdout] 317 | | _ => {} // ignore remaining cases [INFO] [stdout] 318 | | } [INFO] [stdout] | |_________________^ [INFO] [stdout] | [INFO] [stdout] = note: you might want to preserve the comments from inside the `match` [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] 312 ~ if let TransactionData::CreateTokens { receiver: _, amount } = transaction.record { [INFO] [stdout] 313 + tokens += amount; [INFO] [stdout] 314 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/rchain/mod.rs:376:9 [INFO] [stdout] | [INFO] [stdout] 376 | return Vec::from(hasher.finalize().as_ref()); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 376 - return Vec::from(hasher.finalize().as_ref()); [INFO] [stdout] 376 + Vec::from(hasher.finalize().as_ref()) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: called `unwrap` on `balance_sender_new` after checking its variant with `is_some` [INFO] [stdout] --> src/rchain/mod.rs:481:85 [INFO] [stdout] | [INFO] [stdout] 480 | if balance_recv_new.is_some() && balance_sender_new.is_some() { [INFO] [stdout] | ---------------------------- the check is happening here [INFO] [stdout] 481 | world_state.get_account_by_id_mut(&self.from).unwrap().tokens = balance_sender_new.unwrap(); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: try using `match` [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_unwrap [INFO] [stdout] = note: `#[warn(clippy::unnecessary_unwrap)]` on by default [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: called `unwrap` on `balance_recv_new` after checking its variant with `is_some` [INFO] [stdout] --> src/rchain/mod.rs:482:77 [INFO] [stdout] | [INFO] [stdout] 480 | if balance_recv_new.is_some() && balance_sender_new.is_some() { [INFO] [stdout] | -------------------------- the check is happening here [INFO] [stdout] 481 | world_state.get_account_by_id_mut(&self.from).unwrap().tokens = balance_sender_new.unwrap(); [INFO] [stdout] 482 | world_state.get_account_by_id_mut(to).unwrap().tokens = balance_recv_new.unwrap(); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: try using `match` [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_unwrap [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/rchain/mod.rs:441:9 [INFO] [stdout] | [INFO] [stdout] 441 | / return match &self.record { [INFO] [stdout] 442 | | [INFO] [stdout] 443 | | TransactionData::CreateUserAccount(account) => { [INFO] [stdout] 444 | | world_state.create_account(account.into(), AccountType::User) [INFO] [stdout] ... | [INFO] [stdout] 492 | | }; [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 441 ~ match &self.record { [INFO] [stdout] 442 + [INFO] [stdout] 443 + TransactionData::CreateUserAccount(account) => { [INFO] [stdout] 444 + world_state.create_account(account.into(), AccountType::User) [INFO] [stdout] 445 + } [INFO] [stdout] 446 + [INFO] [stdout] 447 + TransactionData::CreateTokens { receiver, amount } => { [INFO] [stdout] 448 + if !is_initial { [INFO] [stdout] 449 + return Err("Token creation is only available on initial creation (Code: 2394233)"); [INFO] [stdout] 450 + } [INFO] [stdout] 451 + // Get the receiving user (must exist) [INFO] [stdout] 452 + return if let Some(account) = world_state.get_account_by_id_mut(receiver) { [INFO] [stdout] 453 + account.tokens += *amount; [INFO] [stdout] 454 + Ok(()) [INFO] [stdout] 455 + } else { [INFO] [stdout] 456 + Err("Receiver Account does not exist (Code: 23482309)") [INFO] [stdout] 457 + }; [INFO] [stdout] 458 + } [INFO] [stdout] 459 + [INFO] [stdout] 460 + TransactionData::TransferTokens { to, amount } => { [INFO] [stdout] 461 + let recv_tokens: u128; [INFO] [stdout] 462 + let sender_tokens: u128; [INFO] [stdout] 463 + [INFO] [stdout] 464 + if let Some(recv) = world_state.get_account_by_id_mut(to) { [INFO] [stdout] 465 + // Be extra careful here, even in the genesis block the sender account has to exist [INFO] [stdout] 466 + recv_tokens = recv.tokens; [INFO] [stdout] 467 + } else { [INFO] [stdout] 468 + return Err("Receiver Account does not exist! (Code: 3242342380)"); [INFO] [stdout] 469 + } [INFO] [stdout] 470 + [INFO] [stdout] 471 + if let Some(sender) = world_state.get_account_by_id_mut(&self.from) { [INFO] [stdout] 472 + sender_tokens = sender.tokens; [INFO] [stdout] 473 + } else { [INFO] [stdout] 474 + return Err("That account does not exist! (Code: 23423923)"); [INFO] [stdout] 475 + } [INFO] [stdout] 476 + [INFO] [stdout] 477 + let balance_recv_new = recv_tokens.checked_add(*amount); [INFO] [stdout] 478 + let balance_sender_new = sender_tokens.checked_sub(*amount); [INFO] [stdout] 479 + [INFO] [stdout] 480 + if balance_recv_new.is_some() && balance_sender_new.is_some() { [INFO] [stdout] 481 + world_state.get_account_by_id_mut(&self.from).unwrap().tokens = balance_sender_new.unwrap(); [INFO] [stdout] 482 + world_state.get_account_by_id_mut(to).unwrap().tokens = balance_recv_new.unwrap(); [INFO] [stdout] 483 + return Ok(()); [INFO] [stdout] 484 + } else { [INFO] [stdout] 485 + return Err("Overspent or Arithmetic error (Code: 48239084203)"); [INFO] [stdout] 486 + } [INFO] [stdout] 487 + } [INFO] [stdout] 488 + [INFO] [stdout] 489 + _ => { // Not implemented transaction type [INFO] [stdout] 490 + Err("Unknown Transaction type (not implemented) (Code: 487289724389)") [INFO] [stdout] 491 + } [INFO] [stdout] 492 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/rchain/mod.rs:502:9 [INFO] [stdout] | [INFO] [stdout] 502 | return Vec::from(hasher.finalize().as_ref()); [INFO] [stdout] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 502 - return Vec::from(hasher.finalize().as_ref()); [INFO] [stdout] 502 + Vec::from(hasher.finalize().as_ref()) [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: unneeded `return` statement [INFO] [stdout] --> src/rchain/mod.rs:525:9 [INFO] [stdout] | [INFO] [stdout] 525 | / return Self { [INFO] [stdout] 526 | | tokens: 0, [INFO] [stdout] 527 | | acc_type: account_type, [INFO] [stdout] 528 | | store: HashMap::new(), [INFO] [stdout] 529 | | }; [INFO] [stdout] | |_________^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return [INFO] [stdout] help: remove `return` [INFO] [stdout] | [INFO] [stdout] 525 ~ Self { [INFO] [stdout] 526 + tokens: 0, [INFO] [stdout] 527 + acc_type: account_type, [INFO] [stdout] 528 + store: HashMap::new(), [INFO] [stdout] 529 ~ } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do [INFO] [stdout] --> src/rchain/mod.rs:545:31 [INFO] [stdout] | [INFO] [stdout] 545 | fn byte_vector_to_string(arr: &Vec) -> String { [INFO] [stdout] | ^^^^^^^^ [INFO] [stdout] | [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg [INFO] [stdout] help: change this to [INFO] [stdout] | [INFO] [stdout] 545 - fn byte_vector_to_string(arr: &Vec) -> String { [INFO] [stdout] 545 + fn byte_vector_to_string(arr: &[u8]) -> String { [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` [INFO] [stdout] --> src/main.rs:93:5 [INFO] [stdout] | [INFO] [stdout] 93 | / match transaction_data.record.borrow_mut() { [INFO] [stdout] 94 | | &mut TransactionData::TransferTokens {to:_, ref mut amount} => { [INFO] [stdout] 95 | | *amount = 100; // Actually change the value in place [INFO] [stdout] 96 | | }, [INFO] [stdout] 97 | | [INFO] [stdout] 98 | | _ => {} // We know that that recors is a TransferToken Action so we ignore the rest [INFO] [stdout] 99 | | } [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = note: you might want to preserve the comments from inside the `match` [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 93 ~ if let &mut TransactionData::TransferTokens {to:_, ref mut amount} = transaction_data.record.borrow_mut() { [INFO] [stdout] 94 + *amount = 100; // Actually change the value in place [INFO] [stdout] 95 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stdout] warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let` [INFO] [stdout] --> src/main.rs:114:5 [INFO] [stdout] | [INFO] [stdout] 114 | / match transaction_data.record.borrow_mut() { [INFO] [stdout] 115 | | &mut TransactionData::CreateTokens {receiver: _, ref mut amount} => { [INFO] [stdout] 116 | | *amount = 100_000_000_000; // Let's dont be small on that [INFO] [stdout] 117 | | }, [INFO] [stdout] 118 | | _ => {} // We know that that record is a Token Create Action so we ignore the rest [INFO] [stdout] 119 | | } [INFO] [stdout] | |_____^ [INFO] [stdout] | [INFO] [stdout] = note: you might want to preserve the comments from inside the `match` [INFO] [stdout] = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match [INFO] [stdout] help: try [INFO] [stdout] | [INFO] [stdout] 114 ~ if let &mut TransactionData::CreateTokens {receiver: _, ref mut amount} = transaction_data.record.borrow_mut() { [INFO] [stdout] 115 + *amount = 100_000_000_000; // Let's dont be small on that [INFO] [stdout] 116 + } [INFO] [stdout] | [INFO] [stdout] [INFO] [stdout] [INFO] [stderr] Finished `dev` profile [unoptimized + debuginfo] target(s) in 2.67s [INFO] running `Command { std: "docker" "inspect" "7357cffa722ce888308380fa01094042f6abc294ad1e474491a9189b91745ec3", kill_on_drop: false }` [INFO] running `Command { std: "docker" "rm" "-f" "7357cffa722ce888308380fa01094042f6abc294ad1e474491a9189b91745ec3", kill_on_drop: false }` [INFO] [stdout] 7357cffa722ce888308380fa01094042f6abc294ad1e474491a9189b91745ec3