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

@ -55,7 +55,7 @@ pub(crate) struct ChecksumViewer<'a, DB: Database> {
}
impl<DB: Database> ChecksumViewer<'_, DB> {
pub(crate) fn new(tool: &'_ DbTool<DB>) -> ChecksumViewer<'_, DB> {
pub(crate) const fn new(tool: &'_ DbTool<DB>) -> ChecksumViewer<'_, DB> {
ChecksumViewer { tool, start_key: None, end_key: None, limit: None }
}

View File

@ -418,7 +418,7 @@ enum ExtraTableElement<T: Table> {
impl<T: Table> ExtraTableElement<T> {
/// Return the key for the extra element
fn key(&self) -> &T::Key {
const fn key(&self) -> &T::Key {
match self {
Self::First { key, .. } => key,
Self::Second { key, .. } => key,

View File

@ -55,7 +55,7 @@ enum Entries<T: Table> {
impl<T: Table> Entries<T> {
/// Creates new empty [Entries] as [Entries::RawValues] if `raw_values == true` and as
/// [Entries::Values] if `raw == false`.
fn new_with_raw_values(raw_values: bool) -> Self {
const fn new_with_raw_values(raw_values: bool) -> Self {
if raw_values {
Self::RawValues(Vec::new())
} else {
@ -85,7 +85,7 @@ impl<T: Table> Entries<T> {
/// Returns an iterator over keys of the internal [Vec]. For both [Entries::RawValues] and
/// [Entries::Values], this iterator will yield [Table::Key].
fn iter_keys(&self) -> EntriesKeyIter<'_, T> {
const fn iter_keys(&self) -> EntriesKeyIter<'_, T> {
EntriesKeyIter { entries: self, index: 0 }
}
}

View File

@ -148,6 +148,6 @@ fn min_sigstack_size() -> usize {
/// Not all OS support hardware where this is needed.
#[cfg(not(any(target_os = "linux", target_os = "android")))]
fn min_sigstack_size() -> usize {
const fn min_sigstack_size() -> usize {
libc::MINSIGSTKSZ
}