Skip to content

Commit 2f535d0

Browse files
bors[bot]dnaka91
andauthored
Merge #284
284: Allow clippy::redundant_pub_crate r=taiki-e a=dnaka91 This is my first PR to this project so please bear with me. While using this crate in my project I noticed that the clippy::redundant_pub_crate (part of clippy::nursery) came up when I was using the derive macro in a module within a binary crate. For example my trimmed down project layout is like this: ``` src/main.rs src/services/log.rs <-- using the pin_project derive macro here creates a clippy warning ``` This change allows the clippy::redundant_pub_crate lint on all generated code to silence the lint messages. I hope this is the right spot to add the `#[allow(...)]` attribute. Co-authored-by: Dominik Nakamura <dnaka91@gmail.com>
2 parents 334de32 + 4859555 commit 2f535d0

34 files changed

+101
-0
lines changed

pin-project-internal/src/pin_project/derive.rs

+1
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ fn global_allowed_lints() -> TokenStream {
150150
#[allow(explicit_outlives_requirements)] // https://github.com/rust-lang/rust/issues/60993
151151
#[allow(single_use_lifetimes)] // https://github.com/rust-lang/rust/issues/55058
152152
#[allow(clippy::pattern_type_mismatch)]
153+
#[allow(clippy::redundant_pub_crate)]
153154
}
154155
}
155156

tests/expand/tests/expand/default-enum.expanded.rs

+3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ enum Enum<T, U> {
1616
#[allow(explicit_outlives_requirements)]
1717
#[allow(single_use_lifetimes)]
1818
#[allow(clippy::pattern_type_mismatch)]
19+
#[allow(clippy::redundant_pub_crate)]
1920
enum EnumProj<'pin, T, U>
2021
where
2122
Enum<T, U>: 'pin,
@@ -33,6 +34,7 @@ where
3334
#[allow(explicit_outlives_requirements)]
3435
#[allow(single_use_lifetimes)]
3536
#[allow(clippy::pattern_type_mismatch)]
37+
#[allow(clippy::redundant_pub_crate)]
3638
enum EnumProjRef<'pin, T, U>
3739
where
3840
Enum<T, U>: 'pin,
@@ -51,6 +53,7 @@ where
5153
#[allow(explicit_outlives_requirements)]
5254
#[allow(single_use_lifetimes)]
5355
#[allow(clippy::pattern_type_mismatch)]
56+
#[allow(clippy::redundant_pub_crate)]
5457
const _: () = {
5558
impl<T, U> Enum<T, U> {
5659
fn project<'pin>(

tests/expand/tests/expand/default-struct.expanded.rs

+3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ struct Struct<T, U> {
1212
#[allow(explicit_outlives_requirements)]
1313
#[allow(single_use_lifetimes)]
1414
#[allow(clippy::pattern_type_mismatch)]
15+
#[allow(clippy::redundant_pub_crate)]
1516
const _: () = {
1617
#[allow(dead_code)]
1718
#[allow(clippy::mut_mut)]
@@ -20,6 +21,7 @@ const _: () = {
2021
#[allow(explicit_outlives_requirements)]
2122
#[allow(single_use_lifetimes)]
2223
#[allow(clippy::pattern_type_mismatch)]
24+
#[allow(clippy::redundant_pub_crate)]
2325
struct __StructProjection<'pin, T, U>
2426
where
2527
Struct<T, U>: 'pin,
@@ -33,6 +35,7 @@ const _: () = {
3335
#[allow(explicit_outlives_requirements)]
3436
#[allow(single_use_lifetimes)]
3537
#[allow(clippy::pattern_type_mismatch)]
38+
#[allow(clippy::redundant_pub_crate)]
3639
struct __StructProjectionRef<'pin, T, U>
3740
where
3841
Struct<T, U>: 'pin,

tests/expand/tests/expand/default-tuple_struct.expanded.rs

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ struct TupleStruct<T, U>(#[pin] T, U);
88
#[allow(explicit_outlives_requirements)]
99
#[allow(single_use_lifetimes)]
1010
#[allow(clippy::pattern_type_mismatch)]
11+
#[allow(clippy::redundant_pub_crate)]
1112
const _: () = {
1213
#[allow(dead_code)]
1314
#[allow(clippy::mut_mut)]
@@ -16,6 +17,7 @@ const _: () = {
1617
#[allow(explicit_outlives_requirements)]
1718
#[allow(single_use_lifetimes)]
1819
#[allow(clippy::pattern_type_mismatch)]
20+
#[allow(clippy::redundant_pub_crate)]
1921
struct __TupleStructProjection<'pin, T, U>(
2022
::pin_project::__private::Pin<&'pin mut (T)>,
2123
&'pin mut (U),
@@ -28,6 +30,7 @@ const _: () = {
2830
#[allow(explicit_outlives_requirements)]
2931
#[allow(single_use_lifetimes)]
3032
#[allow(clippy::pattern_type_mismatch)]
33+
#[allow(clippy::redundant_pub_crate)]
3134
struct __TupleStructProjectionRef<'pin, T, U>(
3235
::pin_project::__private::Pin<&'pin (T)>,
3336
&'pin (U),

tests/expand/tests/expand/naming-enum-all.expanded.rs

+4
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ enum Enum<T, U> {
1616
#[allow(explicit_outlives_requirements)]
1717
#[allow(single_use_lifetimes)]
1818
#[allow(clippy::pattern_type_mismatch)]
19+
#[allow(clippy::redundant_pub_crate)]
1920
enum Proj<'pin, T, U>
2021
where
2122
Enum<T, U>: 'pin,
@@ -33,6 +34,7 @@ where
3334
#[allow(explicit_outlives_requirements)]
3435
#[allow(single_use_lifetimes)]
3536
#[allow(clippy::pattern_type_mismatch)]
37+
#[allow(clippy::redundant_pub_crate)]
3638
enum ProjRef<'pin, T, U>
3739
where
3840
Enum<T, U>: 'pin,
@@ -51,6 +53,7 @@ where
5153
#[allow(explicit_outlives_requirements)]
5254
#[allow(single_use_lifetimes)]
5355
#[allow(clippy::pattern_type_mismatch)]
56+
#[allow(clippy::redundant_pub_crate)]
5457
enum ProjOwn<T, U> {
5558
Struct {
5659
pinned: ::pin_project::__private::PhantomData<T>,
@@ -66,6 +69,7 @@ enum ProjOwn<T, U> {
6669
#[allow(explicit_outlives_requirements)]
6770
#[allow(single_use_lifetimes)]
6871
#[allow(clippy::pattern_type_mismatch)]
72+
#[allow(clippy::redundant_pub_crate)]
6973
const _: () = {
7074
impl<T, U> Enum<T, U> {
7175
fn project<'pin>(self: ::pin_project::__private::Pin<&'pin mut Self>) -> Proj<'pin, T, U> {

tests/expand/tests/expand/naming-enum-mut.expanded.rs

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ enum Enum<T, U> {
1616
#[allow(explicit_outlives_requirements)]
1717
#[allow(single_use_lifetimes)]
1818
#[allow(clippy::pattern_type_mismatch)]
19+
#[allow(clippy::redundant_pub_crate)]
1920
enum Proj<'pin, T, U>
2021
where
2122
Enum<T, U>: 'pin,
@@ -34,6 +35,7 @@ where
3435
#[allow(explicit_outlives_requirements)]
3536
#[allow(single_use_lifetimes)]
3637
#[allow(clippy::pattern_type_mismatch)]
38+
#[allow(clippy::redundant_pub_crate)]
3739
const _: () = {
3840
impl<T, U> Enum<T, U> {
3941
fn project<'pin>(self: ::pin_project::__private::Pin<&'pin mut Self>) -> Proj<'pin, T, U> {

tests/expand/tests/expand/naming-enum-none.expanded.rs

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ enum Enum<T, U> {
1616
#[allow(explicit_outlives_requirements)]
1717
#[allow(single_use_lifetimes)]
1818
#[allow(clippy::pattern_type_mismatch)]
19+
#[allow(clippy::redundant_pub_crate)]
1920
const _: () = {
2021
impl<T, U> Enum<T, U> {}
2122
struct __Enum<'pin, T, U> {

tests/expand/tests/expand/naming-enum-own.expanded.rs

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ enum Enum<T, U> {
1616
#[allow(explicit_outlives_requirements)]
1717
#[allow(single_use_lifetimes)]
1818
#[allow(clippy::pattern_type_mismatch)]
19+
#[allow(clippy::redundant_pub_crate)]
1920
enum ProjOwn<T, U> {
2021
Struct {
2122
pinned: ::pin_project::__private::PhantomData<T>,
@@ -31,6 +32,7 @@ enum ProjOwn<T, U> {
3132
#[allow(explicit_outlives_requirements)]
3233
#[allow(single_use_lifetimes)]
3334
#[allow(clippy::pattern_type_mismatch)]
35+
#[allow(clippy::redundant_pub_crate)]
3436
const _: () = {
3537
impl<T, U> Enum<T, U> {
3638
fn project_replace(

tests/expand/tests/expand/naming-enum-ref.expanded.rs

+2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ enum Enum<T, U> {
1515
#[allow(explicit_outlives_requirements)]
1616
#[allow(single_use_lifetimes)]
1717
#[allow(clippy::pattern_type_mismatch)]
18+
#[allow(clippy::redundant_pub_crate)]
1819
enum ProjRef<'pin, T, U>
1920
where
2021
Enum<T, U>: 'pin,
@@ -33,6 +34,7 @@ where
3334
#[allow(explicit_outlives_requirements)]
3435
#[allow(single_use_lifetimes)]
3536
#[allow(clippy::pattern_type_mismatch)]
37+
#[allow(clippy::redundant_pub_crate)]
3638
const _: () = {
3739
impl<T, U> Enum<T, U> {
3840
fn project_ref<'pin>(

tests/expand/tests/expand/naming-struct-all.expanded.rs

+4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ struct Struct<T, U> {
1212
#[allow(explicit_outlives_requirements)]
1313
#[allow(single_use_lifetimes)]
1414
#[allow(clippy::pattern_type_mismatch)]
15+
#[allow(clippy::redundant_pub_crate)]
1516
struct Proj<'pin, T, U>
1617
where
1718
Struct<T, U>: 'pin,
@@ -25,6 +26,7 @@ where
2526
#[allow(explicit_outlives_requirements)]
2627
#[allow(single_use_lifetimes)]
2728
#[allow(clippy::pattern_type_mismatch)]
29+
#[allow(clippy::redundant_pub_crate)]
2830
struct ProjRef<'pin, T, U>
2931
where
3032
Struct<T, U>: 'pin,
@@ -38,6 +40,7 @@ where
3840
#[allow(explicit_outlives_requirements)]
3941
#[allow(single_use_lifetimes)]
4042
#[allow(clippy::pattern_type_mismatch)]
43+
#[allow(clippy::redundant_pub_crate)]
4144
struct ProjOwn<T, U> {
4245
pinned: ::pin_project::__private::PhantomData<T>,
4346
unpinned: U,
@@ -49,6 +52,7 @@ struct ProjOwn<T, U> {
4952
#[allow(explicit_outlives_requirements)]
5053
#[allow(single_use_lifetimes)]
5154
#[allow(clippy::pattern_type_mismatch)]
55+
#[allow(clippy::redundant_pub_crate)]
5256
const _: () = {
5357
impl<T, U> Struct<T, U> {
5458
fn project<'pin>(self: ::pin_project::__private::Pin<&'pin mut Self>) -> Proj<'pin, T, U> {

tests/expand/tests/expand/naming-struct-mut.expanded.rs

+3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ struct Struct<T, U> {
1212
#[allow(explicit_outlives_requirements)]
1313
#[allow(single_use_lifetimes)]
1414
#[allow(clippy::pattern_type_mismatch)]
15+
#[allow(clippy::redundant_pub_crate)]
1516
struct Proj<'pin, T, U>
1617
where
1718
Struct<T, U>: 'pin,
@@ -26,13 +27,15 @@ where
2627
#[allow(explicit_outlives_requirements)]
2728
#[allow(single_use_lifetimes)]
2829
#[allow(clippy::pattern_type_mismatch)]
30+
#[allow(clippy::redundant_pub_crate)]
2931
const _: () = {
3032
#[allow(dead_code)]
3133
#[allow(clippy::type_repetition_in_bounds)]
3234
#[allow(box_pointers)]
3335
#[allow(explicit_outlives_requirements)]
3436
#[allow(single_use_lifetimes)]
3537
#[allow(clippy::pattern_type_mismatch)]
38+
#[allow(clippy::redundant_pub_crate)]
3639
struct __StructProjectionRef<'pin, T, U>
3740
where
3841
Struct<T, U>: 'pin,

tests/expand/tests/expand/naming-struct-none.expanded.rs

+3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ struct Struct<T, U> {
1212
#[allow(explicit_outlives_requirements)]
1313
#[allow(single_use_lifetimes)]
1414
#[allow(clippy::pattern_type_mismatch)]
15+
#[allow(clippy::redundant_pub_crate)]
1516
const _: () = {
1617
#[allow(dead_code)]
1718
#[allow(clippy::mut_mut)]
@@ -20,6 +21,7 @@ const _: () = {
2021
#[allow(explicit_outlives_requirements)]
2122
#[allow(single_use_lifetimes)]
2223
#[allow(clippy::pattern_type_mismatch)]
24+
#[allow(clippy::redundant_pub_crate)]
2325
struct __StructProjection<'pin, T, U>
2426
where
2527
Struct<T, U>: 'pin,
@@ -33,6 +35,7 @@ const _: () = {
3335
#[allow(explicit_outlives_requirements)]
3436
#[allow(single_use_lifetimes)]
3537
#[allow(clippy::pattern_type_mismatch)]
38+
#[allow(clippy::redundant_pub_crate)]
3639
struct __StructProjectionRef<'pin, T, U>
3740
where
3841
Struct<T, U>: 'pin,

tests/expand/tests/expand/naming-struct-own.expanded.rs

+4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ struct Struct<T, U> {
1111
#[allow(explicit_outlives_requirements)]
1212
#[allow(single_use_lifetimes)]
1313
#[allow(clippy::pattern_type_mismatch)]
14+
#[allow(clippy::redundant_pub_crate)]
1415
struct ProjOwn<T, U> {
1516
pinned: ::pin_project::__private::PhantomData<T>,
1617
unpinned: U,
@@ -22,6 +23,7 @@ struct ProjOwn<T, U> {
2223
#[allow(explicit_outlives_requirements)]
2324
#[allow(single_use_lifetimes)]
2425
#[allow(clippy::pattern_type_mismatch)]
26+
#[allow(clippy::redundant_pub_crate)]
2527
const _: () = {
2628
#[allow(dead_code)]
2729
#[allow(clippy::mut_mut)]
@@ -30,6 +32,7 @@ const _: () = {
3032
#[allow(explicit_outlives_requirements)]
3133
#[allow(single_use_lifetimes)]
3234
#[allow(clippy::pattern_type_mismatch)]
35+
#[allow(clippy::redundant_pub_crate)]
3336
struct __StructProjection<'pin, T, U>
3437
where
3538
Struct<T, U>: 'pin,
@@ -43,6 +46,7 @@ const _: () = {
4346
#[allow(explicit_outlives_requirements)]
4447
#[allow(single_use_lifetimes)]
4548
#[allow(clippy::pattern_type_mismatch)]
49+
#[allow(clippy::redundant_pub_crate)]
4650
struct __StructProjectionRef<'pin, T, U>
4751
where
4852
Struct<T, U>: 'pin,

tests/expand/tests/expand/naming-struct-ref.expanded.rs

+3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ struct Struct<T, U> {
1111
#[allow(explicit_outlives_requirements)]
1212
#[allow(single_use_lifetimes)]
1313
#[allow(clippy::pattern_type_mismatch)]
14+
#[allow(clippy::redundant_pub_crate)]
1415
struct ProjRef<'pin, T, U>
1516
where
1617
Struct<T, U>: 'pin,
@@ -25,6 +26,7 @@ where
2526
#[allow(explicit_outlives_requirements)]
2627
#[allow(single_use_lifetimes)]
2728
#[allow(clippy::pattern_type_mismatch)]
29+
#[allow(clippy::redundant_pub_crate)]
2830
const _: () = {
2931
#[allow(dead_code)]
3032
#[allow(clippy::mut_mut)]
@@ -33,6 +35,7 @@ const _: () = {
3335
#[allow(explicit_outlives_requirements)]
3436
#[allow(single_use_lifetimes)]
3537
#[allow(clippy::pattern_type_mismatch)]
38+
#[allow(clippy::redundant_pub_crate)]
3639
struct __StructProjection<'pin, T, U>
3740
where
3841
Struct<T, U>: 'pin,

tests/expand/tests/expand/naming-tuple_struct-all.expanded.rs

+4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ struct TupleStruct<T, U>(#[pin] T, U);
88
#[allow(explicit_outlives_requirements)]
99
#[allow(single_use_lifetimes)]
1010
#[allow(clippy::pattern_type_mismatch)]
11+
#[allow(clippy::redundant_pub_crate)]
1112
struct Proj<'pin, T, U>(::pin_project::__private::Pin<&'pin mut (T)>, &'pin mut (U))
1213
where
1314
TupleStruct<T, U>: 'pin;
@@ -17,6 +18,7 @@ where
1718
#[allow(explicit_outlives_requirements)]
1819
#[allow(single_use_lifetimes)]
1920
#[allow(clippy::pattern_type_mismatch)]
21+
#[allow(clippy::redundant_pub_crate)]
2022
struct ProjRef<'pin, T, U>(::pin_project::__private::Pin<&'pin (T)>, &'pin (U))
2123
where
2224
TupleStruct<T, U>: 'pin;
@@ -26,6 +28,7 @@ where
2628
#[allow(explicit_outlives_requirements)]
2729
#[allow(single_use_lifetimes)]
2830
#[allow(clippy::pattern_type_mismatch)]
31+
#[allow(clippy::redundant_pub_crate)]
2932
struct ProjOwn<T, U>(::pin_project::__private::PhantomData<T>, U);
3033
#[doc(hidden)]
3134
#[allow(non_upper_case_globals)]
@@ -34,6 +37,7 @@ struct ProjOwn<T, U>(::pin_project::__private::PhantomData<T>, U);
3437
#[allow(explicit_outlives_requirements)]
3538
#[allow(single_use_lifetimes)]
3639
#[allow(clippy::pattern_type_mismatch)]
40+
#[allow(clippy::redundant_pub_crate)]
3741
const _: () = {
3842
impl<T, U> TupleStruct<T, U> {
3943
fn project<'pin>(self: ::pin_project::__private::Pin<&'pin mut Self>) -> Proj<'pin, T, U> {

tests/expand/tests/expand/naming-tuple_struct-mut.expanded.rs

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ struct TupleStruct<T, U>(#[pin] T, U);
88
#[allow(explicit_outlives_requirements)]
99
#[allow(single_use_lifetimes)]
1010
#[allow(clippy::pattern_type_mismatch)]
11+
#[allow(clippy::redundant_pub_crate)]
1112
struct Proj<'pin, T, U>(::pin_project::__private::Pin<&'pin mut (T)>, &'pin mut (U))
1213
where
1314
TupleStruct<T, U>: 'pin;
@@ -18,13 +19,15 @@ where
1819
#[allow(explicit_outlives_requirements)]
1920
#[allow(single_use_lifetimes)]
2021
#[allow(clippy::pattern_type_mismatch)]
22+
#[allow(clippy::redundant_pub_crate)]
2123
const _: () = {
2224
#[allow(dead_code)]
2325
#[allow(clippy::type_repetition_in_bounds)]
2426
#[allow(box_pointers)]
2527
#[allow(explicit_outlives_requirements)]
2628
#[allow(single_use_lifetimes)]
2729
#[allow(clippy::pattern_type_mismatch)]
30+
#[allow(clippy::redundant_pub_crate)]
2831
struct __TupleStructProjectionRef<'pin, T, U>(
2932
::pin_project::__private::Pin<&'pin (T)>,
3033
&'pin (U),

tests/expand/tests/expand/naming-tuple_struct-none.expanded.rs

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ struct TupleStruct<T, U>(#[pin] T, U);
88
#[allow(explicit_outlives_requirements)]
99
#[allow(single_use_lifetimes)]
1010
#[allow(clippy::pattern_type_mismatch)]
11+
#[allow(clippy::redundant_pub_crate)]
1112
const _: () = {
1213
#[allow(dead_code)]
1314
#[allow(clippy::mut_mut)]
@@ -16,6 +17,7 @@ const _: () = {
1617
#[allow(explicit_outlives_requirements)]
1718
#[allow(single_use_lifetimes)]
1819
#[allow(clippy::pattern_type_mismatch)]
20+
#[allow(clippy::redundant_pub_crate)]
1921
struct __TupleStructProjection<'pin, T, U>(
2022
::pin_project::__private::Pin<&'pin mut (T)>,
2123
&'pin mut (U),
@@ -28,6 +30,7 @@ const _: () = {
2830
#[allow(explicit_outlives_requirements)]
2931
#[allow(single_use_lifetimes)]
3032
#[allow(clippy::pattern_type_mismatch)]
33+
#[allow(clippy::redundant_pub_crate)]
3134
struct __TupleStructProjectionRef<'pin, T, U>(
3235
::pin_project::__private::Pin<&'pin (T)>,
3336
&'pin (U),

0 commit comments

Comments
 (0)