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

@ -23,7 +23,7 @@ enum MetricField<'a> {
}
impl<'a> MetricField<'a> {
fn field(&self) -> &'a Field {
const fn field(&self) -> &'a Field {
match self {
MetricField::Included(Metric { field, .. }) | MetricField::Skipped(field) => field,
}

View File

@ -12,7 +12,7 @@ pub(crate) struct Metric<'a> {
}
impl<'a> Metric<'a> {
pub(crate) fn new(field: &'a Field, description: String, rename: Option<LitStr>) -> Self {
pub(crate) const fn new(field: &'a Field, description: String, rename: Option<LitStr>) -> Self {
Self { field, description, rename }
}

View File

@ -152,7 +152,7 @@ impl<T> MeteredSender<T> {
}
/// Returns the underlying [Sender](mpsc::Sender).
pub fn inner(&self) -> &mpsc::Sender<T> {
pub const fn inner(&self) -> &mpsc::Sender<T> {
&self.sender
}
@ -283,7 +283,7 @@ impl<T: Send + 'static> MeteredPollSender<T> {
}
/// Returns the underlying [PollSender].
pub fn inner(&self) -> &PollSender<T> {
pub const fn inner(&self) -> &PollSender<T> {
&self.sender
}