Skip to content

Commit

Permalink
Suppress clippy::missing_const_for_fn lint in generated code
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed Feb 3, 2025
1 parent c6d2ebc commit 1003f80
Show file tree
Hide file tree
Showing 39 changed files with 55 additions and 36 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ Note: In this file, do not use the hard wrap in the middle of a sentence for com

## [Unreleased]

- Suppress `clippy::missing_const_for_fn` lint in generated code.

## [1.1.8] - 2025-01-06

- Suppress `unnameable_types`, `clippy::absolute_paths`, `clippy::min_ident_chars`, `clippy::pub_with_shorthand`, `clippy::single_call_fn`, `clippy::single_char_lifetime_names` lints in generated code.
Expand Down
2 changes: 1 addition & 1 deletion pin-project-internal/src/pin_project/derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ impl GenerateTokens {
#[allow(
unused_qualifications,
#allowed_lints
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
clippy::use_self,
Expand Down Expand Up @@ -972,7 +973,6 @@ fn make_proj_impl(
});
let mut project_ref = Some(quote! {
#allow_dead_code
#[allow(clippy::missing_const_for_fn)]
#[inline]
#vis fn project_ref<#lifetime>(
self: _pin_project::__private::Pin<&#lifetime Self>,
Expand Down
1 change: 1 addition & 0 deletions pin-project-internal/src/pinned_drop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ fn expand_impl(item: &mut ItemImpl) {

method.block.stmts = parse_quote! {
#[allow(
clippy::missing_const_for_fn,
clippy::needless_pass_by_value, // This lint does not warn the receiver.
clippy::single_call_fn
)]
Expand Down
2 changes: 1 addition & 1 deletion tests/expand/default/enum.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ where
clippy::redundant_pub_crate,
clippy::single_char_lifetime_names,
clippy::type_repetition_in_bounds,
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
clippy::use_self,
Expand Down Expand Up @@ -108,7 +109,6 @@ const _: () = {
}
}
#[allow(dead_code)]
#[allow(clippy::missing_const_for_fn)]
#[inline]
fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
Expand Down
2 changes: 1 addition & 1 deletion tests/expand/default/struct.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ struct Struct<T, U> {
clippy::redundant_pub_crate,
clippy::single_char_lifetime_names,
clippy::type_repetition_in_bounds,
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
clippy::use_self,
Expand Down Expand Up @@ -59,7 +60,6 @@ const _: () = {
}
}
#[allow(dead_code)]
#[allow(clippy::missing_const_for_fn)]
#[inline]
fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
Expand Down
2 changes: 1 addition & 1 deletion tests/expand/default/tuple_struct.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ struct TupleStruct<T, U>(#[pin] T, U);
clippy::redundant_pub_crate,
clippy::single_char_lifetime_names,
clippy::type_repetition_in_bounds,
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
clippy::use_self,
Expand Down Expand Up @@ -53,7 +54,6 @@ const _: () = {
}
}
#[allow(dead_code)]
#[allow(clippy::missing_const_for_fn)]
#[inline]
fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
Expand Down
2 changes: 1 addition & 1 deletion tests/expand/multifields/enum.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ enum EnumProjOwn<T, U> {
clippy::redundant_pub_crate,
clippy::single_char_lifetime_names,
clippy::type_repetition_in_bounds,
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
clippy::use_self,
Expand Down Expand Up @@ -173,7 +174,6 @@ const _: () = {
}
}
#[allow(dead_code)]
#[allow(clippy::missing_const_for_fn)]
#[inline]
fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
Expand Down
2 changes: 1 addition & 1 deletion tests/expand/multifields/struct.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ struct Struct<T, U> {
clippy::redundant_pub_crate,
clippy::single_char_lifetime_names,
clippy::type_repetition_in_bounds,
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
clippy::use_self,
Expand Down Expand Up @@ -76,7 +77,6 @@ const _: () = {
}
}
#[allow(dead_code)]
#[allow(clippy::missing_const_for_fn)]
#[inline]
fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
Expand Down
2 changes: 1 addition & 1 deletion tests/expand/multifields/tuple_struct.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ struct TupleStruct<T, U>(#[pin] T, #[pin] T, U, U);
clippy::redundant_pub_crate,
clippy::single_char_lifetime_names,
clippy::type_repetition_in_bounds,
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
clippy::use_self,
Expand Down Expand Up @@ -66,7 +67,6 @@ const _: () = {
}
}
#[allow(dead_code)]
#[allow(clippy::missing_const_for_fn)]
#[inline]
fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
Expand Down
2 changes: 1 addition & 1 deletion tests/expand/naming/enum-all.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ enum ProjOwn<T, U> {
clippy::redundant_pub_crate,
clippy::single_char_lifetime_names,
clippy::type_repetition_in_bounds,
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
clippy::use_self,
Expand Down Expand Up @@ -129,7 +130,6 @@ const _: () = {
}
}
#[allow(dead_code)]
#[allow(clippy::missing_const_for_fn)]
#[inline]
fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
Expand Down
1 change: 1 addition & 0 deletions tests/expand/naming/enum-mut.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ where
clippy::redundant_pub_crate,
clippy::single_char_lifetime_names,
clippy::type_repetition_in_bounds,
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
clippy::use_self,
Expand Down
1 change: 1 addition & 0 deletions tests/expand/naming/enum-none.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ enum Enum<T, U> {
clippy::redundant_pub_crate,
clippy::single_char_lifetime_names,
clippy::type_repetition_in_bounds,
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
clippy::use_self,
Expand Down
1 change: 1 addition & 0 deletions tests/expand/naming/enum-own.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ enum ProjOwn<T, U> {
clippy::redundant_pub_crate,
clippy::single_char_lifetime_names,
clippy::type_repetition_in_bounds,
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
clippy::use_self,
Expand Down
2 changes: 1 addition & 1 deletion tests/expand/naming/enum-ref.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ where
clippy::redundant_pub_crate,
clippy::single_char_lifetime_names,
clippy::type_repetition_in_bounds,
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
clippy::use_self,
Expand All @@ -56,7 +57,6 @@ const _: () = {
extern crate pin_project as _pin_project;
impl<T, U> Enum<T, U> {
#[allow(dead_code)]
#[allow(clippy::missing_const_for_fn)]
#[inline]
fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
Expand Down
2 changes: 1 addition & 1 deletion tests/expand/naming/struct-all.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ struct ProjOwn<T, U> {
clippy::redundant_pub_crate,
clippy::single_char_lifetime_names,
clippy::type_repetition_in_bounds,
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
clippy::use_self,
Expand All @@ -114,7 +115,6 @@ const _: () = {
}
}
#[allow(dead_code)]
#[allow(clippy::missing_const_for_fn)]
#[inline]
fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
Expand Down
2 changes: 1 addition & 1 deletion tests/expand/naming/struct-mut.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ where
clippy::redundant_pub_crate,
clippy::single_char_lifetime_names,
clippy::type_repetition_in_bounds,
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
clippy::use_self,
Expand Down Expand Up @@ -76,7 +77,6 @@ const _: () = {
}
}
#[allow(dead_code)]
#[allow(clippy::missing_const_for_fn)]
#[inline]
fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
Expand Down
2 changes: 1 addition & 1 deletion tests/expand/naming/struct-none.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ struct Struct<T, U> {
clippy::redundant_pub_crate,
clippy::single_char_lifetime_names,
clippy::type_repetition_in_bounds,
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
clippy::use_self,
Expand Down Expand Up @@ -59,7 +60,6 @@ const _: () = {
}
}
#[allow(dead_code)]
#[allow(clippy::missing_const_for_fn)]
#[inline]
fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
Expand Down
2 changes: 1 addition & 1 deletion tests/expand/naming/struct-own.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ struct ProjOwn<T, U> {
clippy::redundant_pub_crate,
clippy::single_char_lifetime_names,
clippy::type_repetition_in_bounds,
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
clippy::use_self,
Expand Down Expand Up @@ -80,7 +81,6 @@ const _: () = {
}
}
#[allow(dead_code)]
#[allow(clippy::missing_const_for_fn)]
#[inline]
fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
Expand Down
2 changes: 1 addition & 1 deletion tests/expand/naming/struct-ref.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ where
clippy::redundant_pub_crate,
clippy::single_char_lifetime_names,
clippy::type_repetition_in_bounds,
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
clippy::use_self,
Expand Down Expand Up @@ -76,7 +77,6 @@ const _: () = {
}
}
#[allow(dead_code)]
#[allow(clippy::missing_const_for_fn)]
#[inline]
fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
Expand Down
2 changes: 1 addition & 1 deletion tests/expand/naming/tuple_struct-all.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ struct ProjOwn<T, U>(::pin_project::__private::PhantomData<T>, U);
clippy::redundant_pub_crate,
clippy::single_char_lifetime_names,
clippy::type_repetition_in_bounds,
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
clippy::use_self,
Expand All @@ -102,7 +103,6 @@ const _: () = {
}
}
#[allow(dead_code)]
#[allow(clippy::missing_const_for_fn)]
#[inline]
fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
Expand Down
2 changes: 1 addition & 1 deletion tests/expand/naming/tuple_struct-mut.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ where
clippy::redundant_pub_crate,
clippy::single_char_lifetime_names,
clippy::type_repetition_in_bounds,
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
clippy::use_self,
Expand Down Expand Up @@ -67,7 +68,6 @@ const _: () = {
}
}
#[allow(dead_code)]
#[allow(clippy::missing_const_for_fn)]
#[inline]
fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
Expand Down
2 changes: 1 addition & 1 deletion tests/expand/naming/tuple_struct-none.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ struct TupleStruct<T, U>(#[pin] T, U);
clippy::redundant_pub_crate,
clippy::single_char_lifetime_names,
clippy::type_repetition_in_bounds,
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
clippy::use_self,
Expand Down Expand Up @@ -53,7 +54,6 @@ const _: () = {
}
}
#[allow(dead_code)]
#[allow(clippy::missing_const_for_fn)]
#[inline]
fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
Expand Down
2 changes: 1 addition & 1 deletion tests/expand/naming/tuple_struct-own.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ struct ProjOwn<T, U>(::pin_project::__private::PhantomData<T>, U);
clippy::redundant_pub_crate,
clippy::single_char_lifetime_names,
clippy::type_repetition_in_bounds,
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
clippy::use_self,
Expand Down Expand Up @@ -71,7 +72,6 @@ const _: () = {
}
}
#[allow(dead_code)]
#[allow(clippy::missing_const_for_fn)]
#[inline]
fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
Expand Down
2 changes: 1 addition & 1 deletion tests/expand/naming/tuple_struct-ref.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ where
clippy::redundant_pub_crate,
clippy::single_char_lifetime_names,
clippy::type_repetition_in_bounds,
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
clippy::use_self,
Expand Down Expand Up @@ -70,7 +71,6 @@ const _: () = {
}
}
#[allow(dead_code)]
#[allow(clippy::missing_const_for_fn)]
#[inline]
fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
Expand Down
2 changes: 1 addition & 1 deletion tests/expand/not_unpin/enum.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ where
clippy::redundant_pub_crate,
clippy::single_char_lifetime_names,
clippy::type_repetition_in_bounds,
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
clippy::use_self,
Expand Down Expand Up @@ -108,7 +109,6 @@ const _: () = {
}
}
#[allow(dead_code)]
#[allow(clippy::missing_const_for_fn)]
#[inline]
fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
Expand Down
2 changes: 1 addition & 1 deletion tests/expand/not_unpin/struct.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ struct Struct<T, U> {
clippy::redundant_pub_crate,
clippy::single_char_lifetime_names,
clippy::type_repetition_in_bounds,
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
clippy::use_self,
Expand Down Expand Up @@ -59,7 +60,6 @@ const _: () = {
}
}
#[allow(dead_code)]
#[allow(clippy::missing_const_for_fn)]
#[inline]
fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
Expand Down
2 changes: 1 addition & 1 deletion tests/expand/not_unpin/tuple_struct.expanded.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ struct TupleStruct<T, U>(#[pin] T, U);
clippy::redundant_pub_crate,
clippy::single_char_lifetime_names,
clippy::type_repetition_in_bounds,
clippy::missing_const_for_fn,
clippy::needless_lifetimes,
clippy::semicolon_if_nothing_returned,
clippy::use_self,
Expand Down Expand Up @@ -53,7 +54,6 @@ const _: () = {
}
}
#[allow(dead_code)]
#[allow(clippy::missing_const_for_fn)]
#[inline]
fn project_ref<'pin>(
self: _pin_project::__private::Pin<&'pin Self>,
Expand Down
Loading

0 comments on commit 1003f80

Please sign in to comment.