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

@ -52,7 +52,7 @@ pub struct DnsResolver(TokioAsyncResolver);
impl DnsResolver {
/// Create a new resolver by wrapping the given [AsyncResolver]
pub fn new(resolver: TokioAsyncResolver) -> Self {
pub const fn new(resolver: TokioAsyncResolver) -> Self {
Self(resolver)
}

View File

@ -41,11 +41,11 @@ impl<K: EnrKeyUnambiguous> SyncTree<K> {
}
#[cfg(test)]
pub(crate) fn root(&self) -> &TreeRootEntry {
pub(crate) const fn root(&self) -> &TreeRootEntry {
&self.root
}
pub(crate) fn link(&self) -> &LinkEntry<K> {
pub(crate) const fn link(&self) -> &LinkEntry<K> {
&self.link
}
@ -156,7 +156,7 @@ pub(crate) enum ResolveKind {
// === impl ResolveKind ===
impl ResolveKind {
pub(crate) fn is_link(&self) -> bool {
pub(crate) const fn is_link(&self) -> bool {
matches!(self, Self::Link)
}
}

View File

@ -199,7 +199,7 @@ impl BranchEntry {
/// `n` bytes of base32-encoded data.
/// See also <https://cs.opensource.google/go/go/+/refs/tags/go1.19.5:src/encoding/base32/base32.go;l=526-531;drc=8a5845e4e34c046758af3729acf9221b8b6c01ae>
#[inline(always)]
fn base32_no_padding_decoded_len(n: usize) -> usize {
const fn base32_no_padding_decoded_len(n: usize) -> usize {
n * 5 / 8
}