chore(lint): Replace allow with expect for dead_code and rm unfullfilled lints (#15530)

This commit is contained in:
Emilia Hane
2025-04-04 15:32:08 +02:00
committed by GitHub
parent 1a9562f89b
commit e5c6de595e
21 changed files with 8 additions and 32 deletions

View File

@@ -123,7 +123,6 @@ impl Serialize for CombinedResult {
#[derive(Debug)]
pub(crate) struct TotalGasRow {
/// The block number of the block being processed.
#[allow(dead_code)]
pub(crate) block_number: u64,
/// The total gas used in the block.
pub(crate) gas_used: u64,

View File

@@ -88,7 +88,6 @@ where
}
/// Returns the canonical head of the chain.
#[allow(dead_code)]
pub fn get_canonical_num_hash(&self) -> BlockNumHash {
self.inner.canonical_head.read().num_hash()
}

View File

@@ -597,7 +597,6 @@ pub struct BlockState<N: NodePrimitives = EthPrimitives> {
parent: Option<Arc<BlockState<N>>>,
}
#[allow(dead_code)]
impl<N: NodePrimitives> BlockState<N> {
/// [`BlockState`] constructor.
pub const fn new(block: ExecutedBlockWithTrieUpdates<N>) -> Self {

View File

@@ -57,19 +57,17 @@ impl ForkchoiceStateTracker {
}
/// Returns whether the latest received FCU is syncing: [`ForkchoiceStatus::Invalid`]
#[allow(dead_code)]
pub fn is_latest_invalid(&self) -> bool {
self.latest_status().is_some_and(|s| s.is_invalid())
}
/// Returns the last valid head hash.
#[allow(dead_code)]
pub fn last_valid_head(&self) -> Option<B256> {
self.last_valid.as_ref().map(|s| s.head_block_hash)
}
/// Returns the head hash of the latest received FCU to which we need to sync.
#[allow(dead_code)]
#[cfg_attr(not(test), expect(dead_code))]
pub(crate) fn sync_target(&self) -> Option<B256> {
self.last_syncing.as_ref().map(|s| s.head_block_hash)
}
@@ -123,8 +121,8 @@ impl ForkchoiceStateTracker {
/// Represents a forkchoice update and tracks the status we assigned to it.
#[derive(Debug, Clone)]
#[allow(dead_code)]
pub(crate) struct ReceivedForkchoiceState {
#[cfg_attr(not(test), expect(dead_code))]
state: ForkchoiceState,
status: ForkchoiceStatus,
}

View File

@@ -37,7 +37,6 @@ impl TestPipelineBuilder {
}
/// Set the executor results to use for the test consensus engine.
#[allow(dead_code)]
pub fn with_executor_results(mut self, executor_results: Vec<ExecutionOutcome>) -> Self {
self.executor_results = executor_results;
self

View File

@@ -3081,7 +3081,6 @@ mod tests {
/// This is a test channel that allows you to `release` any value that is in the channel.
///
/// If nothing has been sent, then the next value will be immediately sent.
#[allow(dead_code)]
struct TestChannel<T> {
/// If an item is sent to this channel, an item will be released in the wrapped channel
release: Receiver<()>,
@@ -3093,7 +3092,6 @@ mod tests {
impl<T: Send + 'static> TestChannel<T> {
/// Creates a new test channel
#[allow(dead_code)]
fn spawn_channel() -> (Sender<T>, Receiver<T>, TestChannelHandle) {
let (original_tx, original_rx) = channel();
let (wrapped_tx, wrapped_rx) = channel();
@@ -3157,7 +3155,7 @@ mod tests {
Self::with_persistence_channel(chain_spec, action_tx, action_rx)
}
#[allow(dead_code)]
#[expect(dead_code)]
fn with_test_channel(chain_spec: Arc<ChainSpec>) -> (Self, TestChannelHandle) {
let (action_tx, action_rx, handle) = TestChannel::spawn_channel();
(Self::with_persistence_channel(chain_spec, action_tx, action_rx), handle)

View File

@@ -94,13 +94,11 @@ impl<T: Hash + Eq + fmt::Debug> LruCache<T> {
}
/// Returns number of elements currently in cache.
#[allow(dead_code)]
pub fn len(&self) -> usize {
self.inner.len()
}
/// Returns `true` if there are currently no elements in the cache.
#[allow(dead_code)]
pub fn is_empty(&self) -> bool {
self.inner.is_empty()
}
@@ -254,7 +252,7 @@ mod test {
}
#[test]
#[allow(dead_code)]
#[expect(dead_code)]
fn test_debug_impl_lru_map() {
#[derive(Debug)]
struct Value(i8);
@@ -271,7 +269,6 @@ mod test {
}
#[test]
#[allow(dead_code)]
fn test_debug_impl_lru_cache() {
let mut cache = LruCache::new(2);
let key_1 = Key(1);

View File

@@ -396,7 +396,6 @@ impl PeerState {
struct Request<Req, Resp> {
/// The issued request object
// TODO: this can be attached to the response in error case
#[allow(dead_code)]
request: Req,
response: oneshot::Sender<Resp>,
}

View File

@@ -702,7 +702,7 @@ impl PeersManager {
/// Called for a newly discovered trusted peer.
///
/// If the peer already exists, then the address and kind will be updated.
#[allow(dead_code)]
#[cfg_attr(not(test), expect(dead_code))]
pub(crate) fn add_trusted_peer(&mut self, peer_id: PeerId, addr: PeerAddr) {
self.add_peer_kind(peer_id, PeerKind::Trusted, addr, None)
}
@@ -778,7 +778,7 @@ impl PeersManager {
/// Connect to the given peer. NOTE: if the maximum number out outbound sessions is reached,
/// this won't do anything. See `reth_network::SessionManager::dial_outbound`.
#[allow(dead_code)]
#[cfg_attr(not(test), expect(dead_code))]
pub(crate) fn add_and_connect(
&mut self,
peer_id: PeerId,

View File

@@ -23,7 +23,6 @@ const MAX_CONCURRENT_CONDITIONAL_VALIDATIONS: usize = 3;
///
/// Separate from [`super::OpEthApi`] to allow to enable it conditionally,
#[derive(Clone, Debug)]
#[allow(dead_code)]
pub struct OpEthExtApi<Pool, Provider> {
/// Sequencer client, configured to forward submitted transactions to sequencer of given OP
/// network.

View File

@@ -31,7 +31,6 @@ pub struct DevSigner {
accounts: HashMap<Address, PrivateKeySigner>,
}
#[allow(dead_code)]
impl DevSigner {
/// Generates a random dev signer which satisfies [`EthSigner`] trait
pub fn random<T: Decodable2718>() -> Box<dyn EthSigner<T>> {

View File

@@ -443,7 +443,6 @@ where
#[derive(Debug)]
struct EthSimBundleInner<Eth> {
/// Access to commonly used code of the `eth` namespace
#[allow(dead_code)]
eth_api: Eth,
// restrict the number of concurrent tracing calls.
#[expect(dead_code)]

View File

@@ -762,7 +762,6 @@ mod tests {
}
#[cfg(test)]
#[allow(dead_code)]
#[test_fuzz::test_fuzz]
fn compact_test_enum_all_variants(var0: TestEnum, var1: TestEnum, var2: TestEnum) {
let mut buf = vec![];

View File

@@ -36,7 +36,6 @@ macro_rules! impl_fuzzer_with_input {
}
#[cfg(test)]
#[allow(dead_code)]
#[expect(missing_docs)]
#[test_fuzz::test_fuzz]
pub fn fuzz(obj: $input_type) {

View File

@@ -214,7 +214,6 @@ pub struct StaticFileWriterError {
impl StaticFileWriterError {
/// Creates a new [`StaticFileWriterError`] with the given message.
#[allow(dead_code)]
pub fn new(message: impl Into<String>) -> Self {
Self { message: message.into() }
}

View File

@@ -320,7 +320,7 @@ impl ZstdDictionaries<'_> {
/// A Zstd dictionary. It's created and serialized with [`ZstdDictionary::Raw`], and deserialized as
/// [`ZstdDictionary::Loaded`].
pub(crate) enum ZstdDictionary<'a> {
#[allow(dead_code)]
#[cfg_attr(not(test), expect(dead_code))]
Raw(RawDictionary),
Loaded(DecoderDictionary<'a>),
}

View File

@@ -329,7 +329,6 @@ pub struct DataReader {
/// Mmap handle for data.
data_mmap: Mmap,
/// Offset file descriptor. Needs to be kept alive as long as `offset_mmap` handle.
#[allow(dead_code)]
offset_file: File,
/// Mmap handle for offsets.
offset_mmap: Mmap,

View File

@@ -19,7 +19,6 @@ pub struct SenderIdentifiers {
impl SenderIdentifiers {
/// Returns the address for the given identifier.
#[allow(dead_code)]
pub fn address(&self, id: &SenderId) -> Option<&Address> {
self.sender_to_address.get(id)
}

View File

@@ -137,7 +137,6 @@ impl<T: PoolTransaction> BlobTransactions<T> {
/// Returns whether the pool is empty
#[cfg(test)]
#[allow(dead_code)]
pub(crate) fn is_empty(&self) -> bool {
self.by_id.is_empty()
}

View File

@@ -240,7 +240,6 @@ impl<T: ParkedOrd> ParkedPool<T> {
/// Returns whether the pool is empty
#[cfg(test)]
#[allow(dead_code)]
pub(crate) fn is_empty(&self) -> bool {
self.by_id.is_empty()
}
@@ -272,7 +271,6 @@ impl<T: PoolTransaction> ParkedPool<BasefeeOrd<T>> {
/// Returns all transactions that satisfy the given basefee.
///
/// Note: this does _not_ remove the transactions
#[allow(dead_code)]
pub(crate) fn satisfy_base_fee_transactions(
&self,
basefee: u64,

View File

@@ -1068,7 +1068,6 @@ impl<T: TransactionOrdering> Drop for TxPool<T> {
// Additional test impls
#[cfg(any(test, feature = "test-utils"))]
#[allow(dead_code)]
impl<T: TransactionOrdering> TxPool<T> {
pub(crate) const fn pending(&self) -> &PendingPool<T> {
&self.pending_pool
@@ -1908,7 +1907,7 @@ pub(crate) struct InsertOk<T: PoolTransaction> {
/// Where to move the transaction to.
move_to: SubPool,
/// Current state of the inserted tx.
#[allow(dead_code)]
#[cfg_attr(not(test), expect(dead_code))]
state: TxState,
/// The transaction that was replaced by this.
replaced_tx: Option<(Arc<ValidPoolTransaction<T>>, SubPool)>,