Add missing_const_for_fn clippy lint (#8498)

This commit is contained in:
Thomas Coratger
2024-05-30 11:50:03 +02:00
committed by GitHub
parent 99068198db
commit 3d3f52b2a4
255 changed files with 834 additions and 804 deletions

View File

@ -237,7 +237,7 @@ impl Discv5 {
None
}
discv5::Event::SessionEstablished(enr, remote_socket) => {
// this branch is semantically similar to branches of
// this branch is semantically similar to branches of
// `reth_discv4::DiscoveryUpdate`: `DiscoveryUpdate::Added(_)` and
// `DiscoveryUpdate::DiscoveredAtCapacity(_)
@ -253,11 +253,11 @@ impl Discv5 {
socket,
node_id: _,
} => {
// this branch is semantically similar to branches of
// this branch is semantically similar to branches of
// `reth_discv4::DiscoveryUpdate`: `DiscoveryUpdate::Added(_)` and
// `DiscoveryUpdate::DiscoveredAtCapacity(_)
// peer has been discovered as part of query, or, by an outgoing session (but peer
// peer has been discovered as part of query, or, by an outgoing session (but peer
// is behind NAT and responds from a different socket)
// NOTE: `discv5::Discv5` won't initiate a session with any peer with an
@ -390,12 +390,12 @@ impl Discv5 {
////////////////////////////////////////////////////////////////////////////////////////////////
/// Returns the RLPx [`IpMode`] of the local node.
pub fn ip_mode(&self) -> IpMode {
pub const fn ip_mode(&self) -> IpMode {
self.rlpx_ip_mode
}
/// Returns the key to use to identify the [`ForkId`] kv-pair on the [`Enr`](discv5::Enr).
pub fn fork_key(&self) -> Option<&[u8]> {
pub const fn fork_key(&self) -> Option<&[u8]> {
self.fork_key
}
}
@ -813,12 +813,12 @@ mod test {
impl<T> Key<T> {
/// Construct a new `Key` by providing the raw 32 byte hash.
pub fn new_raw(preimage: T, hash: GenericArray<u8, U32>) -> Self {
pub const fn new_raw(preimage: T, hash: GenericArray<u8, U32>) -> Self {
Self { preimage, hash }
}
/// Borrows the preimage of the key.
pub fn preimage(&self) -> &T {
pub const fn preimage(&self) -> &T {
&self.preimage
}