Skip to content

chore: solve clippy warnings #4

chore: solve clippy warnings

chore: solve clippy warnings #4

GitHub Actions / clippy failed Oct 11, 2023 in 0s

clippy

8 errors

Details

Results

Message level Amount
Internal compiler error 0
Error 8
Warning 0
Note 0
Help 0

Versions

  • rustc 1.73.0 (cc66ad468 2023-10-03)
  • cargo 1.73.0 (9c4383fb5 2023-08-26)
  • clippy 0.1.73 (cc66ad4 2023-10-03)

Annotations

Check failure on line 173 in data_structures/src/superblock.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

use of `format!` to build up a string from an iterator

error: use of `format!` to build up a string from an iterator
   --> data_structures/src/superblock.rs:161:29
    |
161 |           let mut s: String = self
    |  _____________________________^
162 | |             .votes_on_each_superblock
163 | |             .iter()
164 | |             .map(|(superblock_hash, votes)| {
...   |
172 | |             })
173 | |             .collect();
    | |______________________^
    |
help: call `fold` instead
   --> data_structures/src/superblock.rs:164:14
    |
164 |             .map(|(superblock_hash, votes)| {
    |              ^^^
help: ... and use the `write!` macro here
   --> data_structures/src/superblock.rs:171:17
    |
171 |                 format!("  {}: {} votes: {:?}\n", superblock_hash, pkhs.len(), pkhs)
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: this can be written more efficiently by appending to a `String` directly
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#format_collect
    = note: `-D clippy::format-collect` implied by `-D warnings`

Check failure on line 146 in data_structures/src/data_request.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

use of `or_insert_with` to construct default value

error: use of `or_insert_with` to construct default value
   --> data_structures/src/data_request.rs:146:14
    |
146 |             .or_insert_with(HashSet::new)
    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_or_default

Check failure on line 173 in data_structures/src/superblock.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

use of `format!` to build up a string from an iterator

error: use of `format!` to build up a string from an iterator
   --> data_structures/src/superblock.rs:161:29
    |
161 |           let mut s: String = self
    |  _____________________________^
162 | |             .votes_on_each_superblock
163 | |             .iter()
164 | |             .map(|(superblock_hash, votes)| {
...   |
172 | |             })
173 | |             .collect();
    | |______________________^
    |
help: call `fold` instead
   --> data_structures/src/superblock.rs:164:14
    |
164 |             .map(|(superblock_hash, votes)| {
    |              ^^^
help: ... and use the `write!` macro here
   --> data_structures/src/superblock.rs:171:17
    |
171 |                 format!("  {}: {} votes: {:?}\n", superblock_hash, pkhs.len(), pkhs)
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: this can be written more efficiently by appending to a `String` directly
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#format_collect
    = note: `-D clippy::format-collect` implied by `-D warnings`

Check failure on line 146 in data_structures/src/data_request.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

use of `or_insert_with` to construct default value

error: use of `or_insert_with` to construct default value
   --> data_structures/src/data_request.rs:146:14
    |
146 |             .or_insert_with(HashSet::new)
    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_or_default

Check failure on line 2718 in data_structures/src/chain/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

use of `or_insert_with` to construct default value

error: use of `or_insert_with` to construct default value
    --> data_structures/src/chain/mod.rs:2718:30
     |
2718 | ...                   .or_insert_with(Vec::new)
     |                        ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()`
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_or_default

Check failure on line 2693 in data_structures/src/chain/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

use of `or_insert_with` to construct default value

error: use of `or_insert_with` to construct default value
    --> data_structures/src/chain/mod.rs:2693:30
     |
2693 | ...                   .or_insert_with(Vec::new)
     |                        ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()`
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_or_default
     = note: `-D clippy::unwrap-or-default` implied by `-D warnings`

Check failure on line 2718 in data_structures/src/chain/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

use of `or_insert_with` to construct default value

error: use of `or_insert_with` to construct default value
    --> data_structures/src/chain/mod.rs:2718:30
     |
2718 | ...                   .or_insert_with(Vec::new)
     |                        ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()`
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_or_default

Check failure on line 2693 in data_structures/src/chain/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

use of `or_insert_with` to construct default value

error: use of `or_insert_with` to construct default value
    --> data_structures/src/chain/mod.rs:2693:30
     |
2693 | ...                   .or_insert_with(Vec::new)
     |                        ^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()`
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_or_default
     = note: `-D clippy::unwrap-or-default` implied by `-D warnings`