mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-04-30 03:01:58 -04:00
Add missing_const_for_fn clippy lint (#8498)
This commit is contained in:
@@ -52,7 +52,7 @@ pub enum DatabaseEnvKind {
|
||||
|
||||
impl DatabaseEnvKind {
|
||||
/// Returns `true` if the environment is read-write.
|
||||
pub fn is_rw(&self) -> bool {
|
||||
pub const fn is_rw(&self) -> bool {
|
||||
matches!(self, Self::RW)
|
||||
}
|
||||
}
|
||||
@@ -91,7 +91,7 @@ pub struct DatabaseArguments {
|
||||
|
||||
impl DatabaseArguments {
|
||||
/// Create new database arguments with given client version.
|
||||
pub fn new(client_version: ClientVersion) -> Self {
|
||||
pub const fn new(client_version: ClientVersion) -> Self {
|
||||
Self {
|
||||
client_version,
|
||||
log_level: None,
|
||||
@@ -101,13 +101,13 @@ impl DatabaseArguments {
|
||||
}
|
||||
|
||||
/// Set the log level.
|
||||
pub fn with_log_level(mut self, log_level: Option<LogLevel>) -> Self {
|
||||
pub const fn with_log_level(mut self, log_level: Option<LogLevel>) -> Self {
|
||||
self.log_level = log_level;
|
||||
self
|
||||
}
|
||||
|
||||
/// Set the maximum duration of a read transaction.
|
||||
pub fn with_max_read_transaction_duration(
|
||||
pub const fn with_max_read_transaction_duration(
|
||||
mut self,
|
||||
max_read_transaction_duration: Option<MaxReadTransactionDuration>,
|
||||
) -> Self {
|
||||
@@ -116,13 +116,13 @@ impl DatabaseArguments {
|
||||
}
|
||||
|
||||
/// Set the mdbx exclusive flag.
|
||||
pub fn with_exclusive(mut self, exclusive: Option<bool>) -> Self {
|
||||
pub const fn with_exclusive(mut self, exclusive: Option<bool>) -> Self {
|
||||
self.exclusive = exclusive;
|
||||
self
|
||||
}
|
||||
|
||||
/// Returns the client version if any.
|
||||
pub fn client_version(&self) -> &ClientVersion {
|
||||
pub const fn client_version(&self) -> &ClientVersion {
|
||||
&self.client_version
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ pub struct Tx<K: TransactionKind> {
|
||||
impl<K: TransactionKind> Tx<K> {
|
||||
/// Creates new `Tx` object with a `RO` or `RW` transaction.
|
||||
#[inline]
|
||||
pub fn new(inner: Transaction<K>) -> Self {
|
||||
pub const fn new(inner: Transaction<K>) -> Self {
|
||||
Self::new_inner(inner, None)
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ impl<K: TransactionKind> Tx<K> {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn new_inner(inner: Transaction<K>, metrics_handler: Option<MetricsHandler<K>>) -> Self {
|
||||
const fn new_inner(inner: Transaction<K>, metrics_handler: Option<MetricsHandler<K>>) -> Self {
|
||||
// NOTE: These constants are needed to initialize `OnceCell` at compile-time, as array
|
||||
// initialization is not allowed with non-Copy types, and `const { }` blocks are not stable
|
||||
// yet.
|
||||
|
||||
Reference in New Issue
Block a user