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

@@ -6,7 +6,7 @@ use crate::{
use flate2::bufread::{ZlibDecoder, ZlibEncoder};
use serde::{Deserialize, Serialize};
use std::borrow::Borrow;
use std::collections::{btree_map::Entry, BTreeMap, HashSet};
use std::collections::{BTreeMap, HashSet, btree_map::Entry};
use std::io::Read;
use std::sync::Arc;
use types::{AttesterSlashing, Epoch, EthSpec, IndexedAttestation};

View File

@@ -1,9 +1,9 @@
use crate::{database::IndexedAttestationId, Error};
use crate::{Error, database::IndexedAttestationId};
use ssz_derive::{Decode, Encode};
use std::borrow::Cow;
use std::sync::{
atomic::{AtomicU64, Ordering},
Arc,
atomic::{AtomicU64, Ordering},
};
use tree_hash::TreeHash as _;
use tree_hash_derive::TreeHash;

View File

@@ -4,8 +4,8 @@ mod mdbx_impl;
mod redb_impl;
use crate::{
metrics, AttesterRecord, AttesterSlashingStatus, CompactAttesterRecord, Config, Database,
Error, ProposerSlashingStatus,
AttesterRecord, AttesterSlashingStatus, CompactAttesterRecord, Config, Database, Error,
ProposerSlashingStatus, metrics,
};
use byteorder::{BigEndian, ByteOrder};
use interface::{Environment, OpenDatabases, RwTransaction};

View File

@@ -1,12 +1,12 @@
#![cfg(feature = "mdbx")]
use crate::{
Config, Error,
config::MEGABYTE,
database::{
interface::{Key, OpenDatabases, Value},
*,
},
Config, Error,
};
use mdbx::{DatabaseFlags, Geometry, WriteFlags};
use std::borrow::Cow;

View File

@@ -1,11 +1,11 @@
#![cfg(feature = "redb")]
use crate::{
Config, Error,
config::REDB_DATA_FILENAME,
database::{
interface::{Key, OpenDatabases, Value},
*,
},
Config, Error,
};
use derivative::Derivative;
use redb::{ReadableTable, TableDefinition};

View File

@@ -23,8 +23,8 @@ pub use attester_record::{AttesterRecord, CompactAttesterRecord, IndexedAttester
pub use block_queue::BlockQueue;
pub use config::{Config, DatabaseBackend, DatabaseBackendOverride};
pub use database::{
interface::{Database, Environment, RwTransaction},
IndexedAttestationId, SlasherDB,
interface::{Database, Environment, RwTransaction},
};
pub use error::Error;

View File

@@ -1,4 +1,4 @@
use crate::{database::CURRENT_SCHEMA_VERSION, Error, SlasherDB};
use crate::{Error, SlasherDB, database::CURRENT_SCHEMA_VERSION};
use types::EthSpec;
impl<E: EthSpec> SlasherDB<E> {

View File

@@ -5,8 +5,8 @@ use crate::metrics::{
SLASHER_NUM_BLOCKS_PROCESSED,
};
use crate::{
array, AttestationBatch, AttestationQueue, AttesterRecord, BlockQueue, Config, Error,
IndexedAttestationId, ProposerSlashingStatus, RwTransaction, SimpleBatch, SlasherDB,
AttestationBatch, AttestationQueue, AttesterRecord, BlockQueue, Config, Error,
IndexedAttestationId, ProposerSlashingStatus, RwTransaction, SimpleBatch, SlasherDB, array,
};
use parking_lot::Mutex;
use std::collections::HashSet;

View File

@@ -1,11 +1,11 @@
use std::collections::HashSet;
use std::sync::Arc;
use types::{
indexed_attestation::{IndexedAttestationBase, IndexedAttestationElectra},
AggregateSignature, AttestationData, AttesterSlashing, AttesterSlashingBase,
AttesterSlashingElectra, BeaconBlockHeader, ChainSpec, Checkpoint, Epoch, EthSpec,
FixedBytesExtended, Hash256, IndexedAttestation, MainnetEthSpec, Signature,
SignedBeaconBlockHeader, Slot,
indexed_attestation::{IndexedAttestationBase, IndexedAttestationElectra},
};
pub type E = MainnetEthSpec;