mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-04-08 03:01:12 -04:00
Add missing_const_for_fn clippy lint (#8498)
This commit is contained in:
@@ -47,7 +47,7 @@ impl BlockBuffer {
|
||||
}
|
||||
|
||||
/// Return reference to buffered blocks
|
||||
pub fn blocks(&self) -> &HashMap<BlockHash, SealedBlockWithSenders> {
|
||||
pub const fn blocks(&self) -> &HashMap<BlockHash, SealedBlockWithSenders> {
|
||||
&self.blocks
|
||||
}
|
||||
|
||||
|
||||
@@ -58,12 +58,12 @@ impl BlockIndices {
|
||||
}
|
||||
|
||||
/// Return fork to child indices
|
||||
pub fn fork_to_child(&self) -> &HashMap<BlockHash, LinkedHashSet<BlockHash>> {
|
||||
pub const fn fork_to_child(&self) -> &HashMap<BlockHash, LinkedHashSet<BlockHash>> {
|
||||
&self.fork_to_child
|
||||
}
|
||||
|
||||
/// Return block to chain id
|
||||
pub fn blocks_to_chain(&self) -> &HashMap<BlockHash, BlockchainId> {
|
||||
pub const fn blocks_to_chain(&self) -> &HashMap<BlockHash, BlockchainId> {
|
||||
&self.blocks_to_chain
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ impl BlockIndices {
|
||||
}
|
||||
|
||||
/// Last finalized block
|
||||
pub fn last_finalized_block(&self) -> BlockNumber {
|
||||
pub const fn last_finalized_block(&self) -> BlockNumber {
|
||||
self.last_finalized_block
|
||||
}
|
||||
|
||||
@@ -366,7 +366,7 @@ impl BlockIndices {
|
||||
|
||||
/// Canonical chain needed for execution of EVM. It should contain last 256 block hashes.
|
||||
#[inline]
|
||||
pub(crate) fn canonical_chain(&self) -> &CanonicalChain {
|
||||
pub(crate) const fn canonical_chain(&self) -> &CanonicalChain {
|
||||
&self.canonical_chain
|
||||
}
|
||||
}
|
||||
|
||||
@@ -227,7 +227,7 @@ where
|
||||
|
||||
/// Expose internal indices of the BlockchainTree.
|
||||
#[inline]
|
||||
pub fn block_indices(&self) -> &BlockIndices {
|
||||
pub const fn block_indices(&self) -> &BlockIndices {
|
||||
self.state.block_indices()
|
||||
}
|
||||
|
||||
@@ -1463,7 +1463,7 @@ mod tests {
|
||||
}
|
||||
|
||||
impl TreeTester {
|
||||
fn with_chain_num(mut self, chain_num: usize) -> Self {
|
||||
const fn with_chain_num(mut self, chain_num: usize) -> Self {
|
||||
self.chain_num = Some(chain_num);
|
||||
self
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ impl CanonicalChain {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub(crate) fn inner(&self) -> &BTreeMap<BlockNumber, BlockHash> {
|
||||
pub(crate) const fn inner(&self) -> &BTreeMap<BlockNumber, BlockHash> {
|
||||
&self.chain
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ impl DerefMut for AppendableChain {
|
||||
|
||||
impl AppendableChain {
|
||||
/// Create a new appendable chain from a given chain.
|
||||
pub fn new(chain: Chain) -> Self {
|
||||
pub const fn new(chain: Chain) -> Self {
|
||||
Self { chain }
|
||||
}
|
||||
|
||||
|
||||
@@ -57,18 +57,18 @@ impl BlockchainTreeConfig {
|
||||
}
|
||||
|
||||
/// Return the maximum reorg depth.
|
||||
pub fn max_reorg_depth(&self) -> u64 {
|
||||
pub const fn max_reorg_depth(&self) -> u64 {
|
||||
self.max_reorg_depth
|
||||
}
|
||||
|
||||
/// Return the maximum number of blocks in one chain.
|
||||
pub fn max_blocks_in_chain(&self) -> u64 {
|
||||
pub const fn max_blocks_in_chain(&self) -> u64 {
|
||||
self.max_blocks_in_chain
|
||||
}
|
||||
|
||||
/// Return number of additional canonical block hashes that we need to retain
|
||||
/// in order to have enough information for EVM execution.
|
||||
pub fn num_of_additional_canonical_block_hashes(&self) -> u64 {
|
||||
pub const fn num_of_additional_canonical_block_hashes(&self) -> u64 {
|
||||
self.num_of_additional_canonical_block_hashes
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ impl BlockchainTreeConfig {
|
||||
}
|
||||
|
||||
/// Return max number of unconnected blocks that we are buffering
|
||||
pub fn max_unconnected_blocks(&self) -> u32 {
|
||||
pub const fn max_unconnected_blocks(&self) -> u32 {
|
||||
self.max_unconnected_blocks
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ pub(crate) enum MakeCanonicalAction {
|
||||
}
|
||||
|
||||
impl MakeCanonicalAction {
|
||||
fn as_str(&self) -> &'static str {
|
||||
const fn as_str(&self) -> &'static str {
|
||||
match self {
|
||||
Self::CloneOldBlocks => "clone old blocks",
|
||||
Self::FindCanonicalHeader => "find canonical header",
|
||||
|
||||
@@ -49,7 +49,7 @@ impl TreeState {
|
||||
|
||||
/// Expose internal indices of the BlockchainTree.
|
||||
#[inline]
|
||||
pub(crate) fn block_indices(&self) -> &BlockIndices {
|
||||
pub(crate) const fn block_indices(&self) -> &BlockIndices {
|
||||
&self.block_indices
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user