Add ValidatorInfo to PeerContacts. #14101
Clippy Report
7 warnings
Details
Results
Message level | Amount |
---|---|
Internal compiler error | 0 |
Error | 0 |
Warning | 7 |
Note | 0 |
Help | 0 |
Versions
- rustc 1.82.0 (f6e511eec 2024-10-15)
- cargo 1.82.0 (8f40fc59f 2024-08-21)
- clippy 0.1.82 (f6e511e 2024-10-15)
Annotations
Check warning on line 38 in validator/src/validator.rs
github-actions / Clippy Report
unused import: `TaggedSignable`
warning: unused import: `TaggedSignable`
--> validator/src/validator.rs:38:58
|
38 | use nimiq_utils::{spawn, tagged_signing::{TaggedKeyPair, TaggedSignable, TaggedSigned}};
| ^^^^^^^^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
Check warning on line 147 in dht/src/lib.rs
github-actions / Clippy Report
using `Result.and_then(|x| Ok(y))`, which is more succinctly expressed as `map(|x| y)`
warning: using `Result.and_then(|x| Ok(y))`, which is more succinctly expressed as `map(|x| y)`
--> dht/src/lib.rs:139:17
|
139 | / self.verify_validator_record(&validator_record)
140 | | .map_err(|_| DhtVerifierError::ValidatorInfoError)
141 | | .and_then(|_| {
142 | | Ok(DhtRecord::Validator(
... |
146 | | ))
147 | | })
| |______________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bind_instead_of_map
= note: `#[warn(clippy::bind_instead_of_map)]` on by default
help: try
|
139 ~ self.verify_validator_record(&validator_record)
140 + .map_err(|_| DhtVerifierError::ValidatorInfoError).map(|_| DhtRecord::Validator(
141 + validator_record.record.peer_id,
142 + validator_record.record,
143 + record.clone(),
144 + ))
|
Check warning on line 93 in dht/src/lib.rs
github-actions / Clippy Report
unnecessary closure used with `bool::then`
warning: unnecessary closure used with `bool::then`
--> dht/src/lib.rs:91:9
|
91 | / signed_record
92 | | .verify(&public_key)
93 | | .then(|| ())
| |________________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_lazy_evaluations
= note: `#[warn(clippy::unnecessary_lazy_evaluations)]` on by default
help: use `then_some` instead
|
93 | .then_some(())
| ~~~~~~~~~~~~~
Check warning on line 761 in network-libp2p/src/discovery/peer_contacts.rs
github-actions / Clippy Report
using `clone` on type `PeerId` which implements the `Copy` trait
warning: using `clone` on type `PeerId` which implements the `Copy` trait
--> network-libp2p/src/discovery/peer_contacts.rs:761:29
|
761 | ... peer_id.clone(),
| ^^^^^^^^^^^^^^^ help: try dereferencing it: `*peer_id`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy
= note: `#[warn(clippy::clone_on_copy)]` on by default
Check warning on line 737 in network-libp2p/src/discovery/peer_contacts.rs
github-actions / Clippy Report
using `Option.and_then(|x| Some(y))`, which is more succinctly expressed as `map(|x| y)`
warning: using `Option.and_then(|x| Some(y))`, which is more succinctly expressed as `map(|x| y)`
--> network-libp2p/src/discovery/peer_contacts.rs:731:34
|
731 | contact.validator_info = self.validator_record_signing.as_ref().and_then(|callback| {
| __________________________________^
732 | | let tagged_signed = (callback)(contact.peer_id(), contact.timestamp);
733 | | Some(ValidatorInfo {
734 | | validator_address: tagged_signed.record.validator_address.clone(),
735 | | signature: tagged_signed.signature.clone(),
736 | | })
737 | | });
| |__________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#bind_instead_of_map
= note: `#[warn(clippy::bind_instead_of_map)]` on by default
help: use `map` instead
|
731 ~ contact.validator_info = self.validator_record_signing.as_ref().map(|callback| {
732 | let tagged_signed = (callback)(contact.peer_id(), contact.timestamp);
733 ~ ValidatorInfo {
734 + validator_address: tagged_signed.record.validator_address.clone(),
735 + signature: tagged_signed.signature.clone(),
736 + }
|
Check warning on line 587 in network-libp2p/src/discovery/peer_contacts.rs
github-actions / Clippy Report
use of `or_insert` to construct default value
warning: use of `or_insert` to construct default value
--> network-libp2p/src/discovery/peer_contacts.rs:587:18
|
587 | .or_insert(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 warning on line 516 in network-libp2p/src/discovery/peer_contacts.rs
github-actions / Clippy Report
use of `or_insert` to construct default value
warning: use of `or_insert` to construct default value
--> network-libp2p/src/discovery/peer_contacts.rs:516:18
|
516 | .or_insert(HashSet::new())
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `or_default()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unwrap_or_default
= note: `#[warn(clippy::unwrap_or_default)]` on by default