Skip to content

Commit 0dcce40

Browse files
Fix Clippy for Rust 1.90 beta (#7826)
Fix Clippy for recently released Rust 1.90 beta. There may be more changes required when Rust 1.89 stable is released in a few days, but possibly not 🤞
1 parent adf6ad7 commit 0dcce40

File tree

15 files changed

+42
-38
lines changed

15 files changed

+42
-38
lines changed

beacon_node/beacon_chain/src/historical_blocks.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
201201
let signature_set = signed_blocks
202202
.iter()
203203
.zip_eq(block_roots)
204-
.filter(|&(_block, block_root)| (block_root != self.genesis_block_root))
204+
.filter(|&(_block, block_root)| block_root != self.genesis_block_root)
205205
.map(|(block, block_root)| {
206206
block_proposal_signature_set_from_parts(
207207
block,

beacon_node/genesis/src/interop.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ fn alternating_eth1_withdrawal_credentials_fn<'a>(
169169
pubkey: &'a PublicKey,
170170
spec: &'a ChainSpec,
171171
) -> Hash256 {
172-
if index % 2usize == 0usize {
172+
if index.is_multiple_of(2) {
173173
bls_withdrawal_credentials(pubkey, spec)
174174
} else {
175175
eth1_withdrawal_credentials(pubkey, spec)

beacon_node/http_api/src/aggregate_attestation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,6 @@ pub fn get_aggregate_attestation<T: BeaconChainTypes>(
6363
} else if endpoint_version == V1 {
6464
Ok(warp::reply::json(&GenericResponse::from(aggregate_attestation)).into_response())
6565
} else {
66-
return Err(unsupported_version_rejection(endpoint_version));
66+
Err(unsupported_version_rejection(endpoint_version))
6767
}
6868
}

beacon_node/http_api/tests/tests.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6270,7 +6270,9 @@ impl ApiTester {
62706270

62716271
// Produce a BLS to execution change event
62726272
self.client
6273-
.post_beacon_pool_bls_to_execution_changes(&[self.bls_to_execution_change.clone()])
6273+
.post_beacon_pool_bls_to_execution_changes(std::slice::from_ref(
6274+
&self.bls_to_execution_change,
6275+
))
62746276
.await
62756277
.unwrap();
62766278

beacon_node/lighthouse_network/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ impl<'de> Deserialize<'de> for PeerIdSerialized {
6363
struct ClearDialError<'a>(&'a DialError);
6464

6565
impl ClearDialError<'_> {
66-
fn most_inner_error(err: &(dyn std::error::Error)) -> &(dyn std::error::Error) {
66+
fn most_inner_error(err: &dyn std::error::Error) -> &dyn std::error::Error {
6767
let mut current = err;
6868
while let Some(source) = current.source() {
6969
current = source;

beacon_node/lighthouse_network/tests/rpc_tests.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -652,9 +652,8 @@ fn test_tcp_blocks_by_range_chunked_rpc_terminates_correctly() {
652652
}
653653

654654
// if we need to send messages send them here. This will happen after a delay
655-
if message_info.is_some() {
655+
if let Some((peer_id, inbound_request_id)) = &message_info {
656656
messages_sent += 1;
657-
let (peer_id, inbound_request_id) = message_info.as_ref().unwrap();
658657
receiver.send_response(*peer_id, *inbound_request_id, rpc_response.clone());
659658
debug!("Sending message {}", messages_sent);
660659
if messages_sent == messages_to_send + extra_messages_to_send {
@@ -1074,9 +1073,8 @@ fn test_tcp_blocks_by_root_chunked_rpc_terminates_correctly() {
10741073
}
10751074

10761075
// if we need to send messages send them here. This will happen after a delay
1077-
if message_info.is_some() {
1076+
if let Some((peer_id, inbound_request_id)) = &message_info {
10781077
messages_sent += 1;
1079-
let (peer_id, inbound_request_id) = message_info.as_ref().unwrap();
10801078
receiver.send_response(*peer_id, *inbound_request_id, rpc_response.clone());
10811079
debug!("Sending message {}", messages_sent);
10821080
if messages_sent == messages_to_send + extra_messages_to_send {

beacon_node/store/src/database/redb_impl.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,11 @@ impl<E: EthSpec> Redb<E> {
204204
mut_db.compact().map_err(Into::into).map(|_| ())
205205
}
206206

207-
pub fn iter_column_keys_from<K: Key>(&self, column: DBColumn, from: &[u8]) -> ColumnKeyIter<K> {
207+
pub fn iter_column_keys_from<K: Key>(
208+
&self,
209+
column: DBColumn,
210+
from: &[u8],
211+
) -> ColumnKeyIter<'_, K> {
208212
let table_definition: TableDefinition<'_, &[u8], &[u8]> =
209213
TableDefinition::new(column.into());
210214

@@ -232,11 +236,11 @@ impl<E: EthSpec> Redb<E> {
232236
}
233237

234238
/// Iterate through all keys and values in a particular column.
235-
pub fn iter_column_keys<K: Key>(&self, column: DBColumn) -> ColumnKeyIter<K> {
239+
pub fn iter_column_keys<K: Key>(&self, column: DBColumn) -> ColumnKeyIter<'_, K> {
236240
self.iter_column_keys_from(column, &vec![0; column.key_size()])
237241
}
238242

239-
pub fn iter_column_from<K: Key>(&self, column: DBColumn, from: &[u8]) -> ColumnIter<K> {
243+
pub fn iter_column_from<K: Key>(&self, column: DBColumn, from: &[u8]) -> ColumnIter<'_, K> {
240244
let table_definition: TableDefinition<'_, &[u8], &[u8]> =
241245
TableDefinition::new(column.into());
242246

@@ -269,7 +273,7 @@ impl<E: EthSpec> Redb<E> {
269273
}
270274
}
271275

272-
pub fn iter_column<K: Key>(&self, column: DBColumn) -> ColumnIter<K> {
276+
pub fn iter_column<K: Key>(&self, column: DBColumn) -> ColumnIter<'_, K> {
273277
self.iter_column_from(column, &vec![0; column.key_size()])
274278
}
275279

consensus/state_processing/src/per_block_processing/tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -906,7 +906,7 @@ async fn invalid_proposer_slashing_duplicate_slashing() {
906906
let mut ctxt = ConsensusContext::new(state.slot());
907907
let result_1 = process_operations::process_proposer_slashings(
908908
&mut state,
909-
&[proposer_slashing.clone()],
909+
std::slice::from_ref(&proposer_slashing),
910910
VerifySignatures::False,
911911
&mut ctxt,
912912
&spec,
@@ -915,7 +915,7 @@ async fn invalid_proposer_slashing_duplicate_slashing() {
915915

916916
let result_2 = process_operations::process_proposer_slashings(
917917
&mut state,
918-
&[proposer_slashing],
918+
std::slice::from_ref(&proposer_slashing),
919919
VerifySignatures::False,
920920
&mut ctxt,
921921
&spec,

crypto/bls/tests/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ macro_rules! test_suite {
370370
}
371371

372372
impl OwnedSignatureSet {
373-
pub fn multiple_pubkeys(&self) -> SignatureSet {
373+
pub fn multiple_pubkeys(&self) -> SignatureSet<'_> {
374374
let signing_keys = self.signing_keys.iter().map(Cow::Borrowed).collect();
375375
SignatureSet::multiple_pubkeys(&self.signature, signing_keys, self.message)
376376
}

crypto/eth2_keystore/src/json_keystore/hex_bytes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ impl TryFrom<String> for HexBytes {
3737
fn try_from(s: String) -> Result<Self, Self::Error> {
3838
// Left-pad with a zero if there is not an even number of hex digits to ensure
3939
// `hex::decode` doesn't return an error.
40-
let s = if s.len() % 2 != 0 {
40+
let s = if !s.len().is_multiple_of(2) {
4141
format!("0{}", s)
4242
} else {
4343
s

0 commit comments

Comments
 (0)