Update Rust Edition to 2024 (#7766)

* #7749

Thanks @dknopik and @michaelsproul for your help!
This commit is contained in:
chonghe
2025-08-13 11:04:31 +08:00
committed by GitHub
parent bd6b8b6a65
commit 522bd9e9c6
468 changed files with 3594 additions and 3396 deletions

View File

@@ -1,6 +1,6 @@
use std::path::PathBuf;
use jsonwebtoken::{encode, get_current_timestamp, Algorithm, EncodingKey, Header};
use jsonwebtoken::{Algorithm, EncodingKey, Header, encode, get_current_timestamp};
use rand::Rng;
use serde::{Deserialize, Serialize};
use zeroize::Zeroize;
@@ -46,7 +46,7 @@ impl JwtKey {
/// Generate a random secret.
pub fn random() -> Self {
Self(rand::thread_rng().gen::<[u8; JWT_SECRET_LENGTH]>())
Self(rand::rng().random::<[u8; JWT_SECRET_LENGTH]>())
}
/// Returns a reference to the underlying byte array.

View File

@@ -226,7 +226,7 @@ pub mod deposit_methods {
use super::Log;
use crate::HttpJsonRpc;
use serde::{Deserialize, Serialize};
use serde_json::{json, Value};
use serde_json::{Value, json};
use std::fmt;
use std::ops::Range;
use std::str::FromStr;
@@ -1392,7 +1392,7 @@ impl HttpJsonRpc {
mod test {
use super::auth::JwtKey;
use super::*;
use crate::test_utils::{MockServer, DEFAULT_JWT_SECRET};
use crate::test_utils::{DEFAULT_JWT_SECRET, MockServer};
use std::future::Future;
use std::str::FromStr;
use std::sync::Arc;

View File

@@ -440,10 +440,10 @@ impl<E: EthSpec> TryFrom<JsonExecutionRequests> for ExecutionRequests<E> {
// Elements of the list **MUST** be ordered by `request_type` in ascending order
let current_prefix = RequestType::from_u8(*prefix_byte)
.ok_or(RequestsError::InvalidPrefix(*prefix_byte))?;
if let Some(prev) = prev_prefix {
if prev.to_u8() >= current_prefix.to_u8() {
return Err(RequestsError::InvalidOrdering);
}
if let Some(prev) = prev_prefix
&& prev.to_u8() >= current_prefix.to_u8()
{
return Err(RequestsError::InvalidOrdering);
}
prev_prefix = Some(current_prefix);

View File

@@ -1,4 +1,4 @@
use crate::{block_hash::calculate_execution_block_hash, metrics, Error};
use crate::{Error, block_hash::calculate_execution_block_hash, metrics};
use crate::versioned_hashes::verify_versioned_hashes;
use state_processing::per_block_processing::deneb::kzg_commitment_to_versioned_hash;