Skip to content

Commit 54c2fd2

Browse files
bors[bot]taiki-e
andauthored
Merge #303
303: Suppress clippy::unknown_clippy_lints r=taiki-e a=taiki-e diem/diem#6677 (comment) Co-authored-by: Taiki Endo <te316e89@gmail.com>
2 parents 1dfb4a1 + 13b09b4 commit 54c2fd2

37 files changed

+298
-183
lines changed

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

+6-3
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@ fn global_allowed_lints() -> TokenStream {
105105
#[allow(explicit_outlives_requirements)] // https://github.com/rust-lang/rust/issues/60993
106106
#[allow(single_use_lifetimes)] // https://github.com/rust-lang/rust/issues/55058
107107
#[allow(unreachable_pub)] // This lint warns `pub` field in private struct.
108+
// This lint warns of `clippy::*` generated by external macros.
109+
// We allow this lint for compatibility with older compilers.
110+
#[allow(clippy::unknown_clippy_lints)]
108111
#[allow(clippy::pattern_type_mismatch)]
109112
#[allow(clippy::redundant_pub_crate)] // This lint warns `pub(crate)` field in private struct.
110113
}
@@ -122,20 +125,20 @@ fn proj_allowed_lints(kind: TypeKind) -> (TokenStream, TokenStream, TokenStream)
122125
};
123126
let global_allowed_lints = global_allowed_lints();
124127
let proj_mut = quote! {
128+
#global_allowed_lints
125129
#[allow(dead_code)] // This lint warns unused fields/variants.
126130
#[allow(clippy::mut_mut)] // This lint warns `&mut &mut <ty>`.
127131
#[allow(clippy::type_repetition_in_bounds)] // https://github.com/rust-lang/rust-clippy/issues/4326}
128-
#global_allowed_lints
129132
};
130133
let proj_ref = quote! {
134+
#global_allowed_lints
131135
#[allow(dead_code)] // This lint warns unused fields/variants.
132136
#[allow(clippy::type_repetition_in_bounds)] // https://github.com/rust-lang/rust-clippy/issues/4326
133-
#global_allowed_lints
134137
};
135138
let proj_own = quote! {
139+
#global_allowed_lints
136140
#[allow(dead_code)] // This lint warns unused fields/variants.
137141
#large_enum_variant
138-
#global_allowed_lints
139142
};
140143
(proj_mut, proj_ref, proj_own)
141144
}

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

+8-5
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,16 @@ enum Enum<T, U> {
99
Tuple(#[pin] T, U),
1010
Unit,
1111
}
12-
#[allow(dead_code)]
13-
#[allow(clippy::mut_mut)]
14-
#[allow(clippy::type_repetition_in_bounds)]
1512
#[allow(box_pointers)]
1613
#[allow(explicit_outlives_requirements)]
1714
#[allow(single_use_lifetimes)]
1815
#[allow(unreachable_pub)]
16+
#[allow(clippy::unknown_clippy_lints)]
1917
#[allow(clippy::pattern_type_mismatch)]
2018
#[allow(clippy::redundant_pub_crate)]
19+
#[allow(dead_code)]
20+
#[allow(clippy::mut_mut)]
21+
#[allow(clippy::type_repetition_in_bounds)]
2122
enum EnumProj<'pin, T, U>
2223
where
2324
Enum<T, U>: 'pin,
@@ -29,14 +30,15 @@ where
2930
Tuple(::pin_project::__private::Pin<&'pin mut (T)>, &'pin mut (U)),
3031
Unit,
3132
}
32-
#[allow(dead_code)]
33-
#[allow(clippy::type_repetition_in_bounds)]
3433
#[allow(box_pointers)]
3534
#[allow(explicit_outlives_requirements)]
3635
#[allow(single_use_lifetimes)]
3736
#[allow(unreachable_pub)]
37+
#[allow(clippy::unknown_clippy_lints)]
3838
#[allow(clippy::pattern_type_mismatch)]
3939
#[allow(clippy::redundant_pub_crate)]
40+
#[allow(dead_code)]
41+
#[allow(clippy::type_repetition_in_bounds)]
4042
enum EnumProjRef<'pin, T, U>
4143
where
4244
Enum<T, U>: 'pin,
@@ -52,6 +54,7 @@ where
5254
#[allow(explicit_outlives_requirements)]
5355
#[allow(single_use_lifetimes)]
5456
#[allow(unreachable_pub)]
57+
#[allow(clippy::unknown_clippy_lints)]
5558
#[allow(clippy::pattern_type_mismatch)]
5659
#[allow(clippy::redundant_pub_crate)]
5760
#[allow(clippy::used_underscore_binding)]

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

+8-5
Original file line numberDiff line numberDiff line change
@@ -9,34 +9,37 @@ struct Struct<T, U> {
99
#[allow(explicit_outlives_requirements)]
1010
#[allow(single_use_lifetimes)]
1111
#[allow(unreachable_pub)]
12+
#[allow(clippy::unknown_clippy_lints)]
1213
#[allow(clippy::pattern_type_mismatch)]
1314
#[allow(clippy::redundant_pub_crate)]
1415
#[allow(clippy::used_underscore_binding)]
1516
const _: () = {
16-
#[allow(dead_code)]
17-
#[allow(clippy::mut_mut)]
18-
#[allow(clippy::type_repetition_in_bounds)]
1917
#[allow(box_pointers)]
2018
#[allow(explicit_outlives_requirements)]
2119
#[allow(single_use_lifetimes)]
2220
#[allow(unreachable_pub)]
21+
#[allow(clippy::unknown_clippy_lints)]
2322
#[allow(clippy::pattern_type_mismatch)]
2423
#[allow(clippy::redundant_pub_crate)]
24+
#[allow(dead_code)]
25+
#[allow(clippy::mut_mut)]
26+
#[allow(clippy::type_repetition_in_bounds)]
2527
struct __StructProjection<'pin, T, U>
2628
where
2729
Struct<T, U>: 'pin,
2830
{
2931
pinned: ::pin_project::__private::Pin<&'pin mut (T)>,
3032
unpinned: &'pin mut (U),
3133
}
32-
#[allow(dead_code)]
33-
#[allow(clippy::type_repetition_in_bounds)]
3434
#[allow(box_pointers)]
3535
#[allow(explicit_outlives_requirements)]
3636
#[allow(single_use_lifetimes)]
3737
#[allow(unreachable_pub)]
38+
#[allow(clippy::unknown_clippy_lints)]
3839
#[allow(clippy::pattern_type_mismatch)]
3940
#[allow(clippy::redundant_pub_crate)]
41+
#[allow(dead_code)]
42+
#[allow(clippy::type_repetition_in_bounds)]
4043
struct __StructProjectionRef<'pin, T, U>
4144
where
4245
Struct<T, U>: 'pin,

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

+8-5
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,36 @@ struct TupleStruct<T, U>(#[pin] T, U);
55
#[allow(explicit_outlives_requirements)]
66
#[allow(single_use_lifetimes)]
77
#[allow(unreachable_pub)]
8+
#[allow(clippy::unknown_clippy_lints)]
89
#[allow(clippy::pattern_type_mismatch)]
910
#[allow(clippy::redundant_pub_crate)]
1011
#[allow(clippy::used_underscore_binding)]
1112
const _: () = {
12-
#[allow(dead_code)]
13-
#[allow(clippy::mut_mut)]
14-
#[allow(clippy::type_repetition_in_bounds)]
1513
#[allow(box_pointers)]
1614
#[allow(explicit_outlives_requirements)]
1715
#[allow(single_use_lifetimes)]
1816
#[allow(unreachable_pub)]
17+
#[allow(clippy::unknown_clippy_lints)]
1918
#[allow(clippy::pattern_type_mismatch)]
2019
#[allow(clippy::redundant_pub_crate)]
20+
#[allow(dead_code)]
21+
#[allow(clippy::mut_mut)]
22+
#[allow(clippy::type_repetition_in_bounds)]
2123
struct __TupleStructProjection<'pin, T, U>(
2224
::pin_project::__private::Pin<&'pin mut (T)>,
2325
&'pin mut (U),
2426
)
2527
where
2628
TupleStruct<T, U>: 'pin;
27-
#[allow(dead_code)]
28-
#[allow(clippy::type_repetition_in_bounds)]
2929
#[allow(box_pointers)]
3030
#[allow(explicit_outlives_requirements)]
3131
#[allow(single_use_lifetimes)]
3232
#[allow(unreachable_pub)]
33+
#[allow(clippy::unknown_clippy_lints)]
3334
#[allow(clippy::pattern_type_mismatch)]
3435
#[allow(clippy::redundant_pub_crate)]
36+
#[allow(dead_code)]
37+
#[allow(clippy::type_repetition_in_bounds)]
3538
struct __TupleStructProjectionRef<'pin, T, U>(
3639
::pin_project::__private::Pin<&'pin (T)>,
3740
&'pin (U),

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

+12-8
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,16 @@ enum Enum<T, U> {
1212
Tuple(#[pin] T, #[pin] T, U, U),
1313
Unit,
1414
}
15-
#[allow(dead_code)]
16-
#[allow(clippy::mut_mut)]
17-
#[allow(clippy::type_repetition_in_bounds)]
1815
#[allow(box_pointers)]
1916
#[allow(explicit_outlives_requirements)]
2017
#[allow(single_use_lifetimes)]
2118
#[allow(unreachable_pub)]
19+
#[allow(clippy::unknown_clippy_lints)]
2220
#[allow(clippy::pattern_type_mismatch)]
2321
#[allow(clippy::redundant_pub_crate)]
22+
#[allow(dead_code)]
23+
#[allow(clippy::mut_mut)]
24+
#[allow(clippy::type_repetition_in_bounds)]
2425
enum EnumProj<'pin, T, U>
2526
where
2627
Enum<T, U>: 'pin,
@@ -39,14 +40,15 @@ where
3940
),
4041
Unit,
4142
}
42-
#[allow(dead_code)]
43-
#[allow(clippy::type_repetition_in_bounds)]
4443
#[allow(box_pointers)]
4544
#[allow(explicit_outlives_requirements)]
4645
#[allow(single_use_lifetimes)]
4746
#[allow(unreachable_pub)]
47+
#[allow(clippy::unknown_clippy_lints)]
4848
#[allow(clippy::pattern_type_mismatch)]
4949
#[allow(clippy::redundant_pub_crate)]
50+
#[allow(dead_code)]
51+
#[allow(clippy::type_repetition_in_bounds)]
5052
enum EnumProjRef<'pin, T, U>
5153
where
5254
Enum<T, U>: 'pin,
@@ -65,15 +67,16 @@ where
6567
),
6668
Unit,
6769
}
68-
#[allow(dead_code)]
69-
#[allow(variant_size_differences)]
70-
#[allow(clippy::large_enum_variant)]
7170
#[allow(box_pointers)]
7271
#[allow(explicit_outlives_requirements)]
7372
#[allow(single_use_lifetimes)]
7473
#[allow(unreachable_pub)]
74+
#[allow(clippy::unknown_clippy_lints)]
7575
#[allow(clippy::pattern_type_mismatch)]
7676
#[allow(clippy::redundant_pub_crate)]
77+
#[allow(dead_code)]
78+
#[allow(variant_size_differences)]
79+
#[allow(clippy::large_enum_variant)]
7780
enum EnumProjOwn<T, U> {
7881
Struct {
7982
pinned1: ::pin_project::__private::PhantomData<T>,
@@ -93,6 +96,7 @@ enum EnumProjOwn<T, U> {
9396
#[allow(explicit_outlives_requirements)]
9497
#[allow(single_use_lifetimes)]
9598
#[allow(unreachable_pub)]
99+
#[allow(clippy::unknown_clippy_lints)]
96100
#[allow(clippy::pattern_type_mismatch)]
97101
#[allow(clippy::redundant_pub_crate)]
98102
#[allow(clippy::used_underscore_binding)]

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

+10-6
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,21 @@ struct Struct<T, U> {
1212
#[allow(explicit_outlives_requirements)]
1313
#[allow(single_use_lifetimes)]
1414
#[allow(unreachable_pub)]
15+
#[allow(clippy::unknown_clippy_lints)]
1516
#[allow(clippy::pattern_type_mismatch)]
1617
#[allow(clippy::redundant_pub_crate)]
1718
#[allow(clippy::used_underscore_binding)]
1819
const _: () = {
19-
#[allow(dead_code)]
20-
#[allow(clippy::mut_mut)]
21-
#[allow(clippy::type_repetition_in_bounds)]
2220
#[allow(box_pointers)]
2321
#[allow(explicit_outlives_requirements)]
2422
#[allow(single_use_lifetimes)]
2523
#[allow(unreachable_pub)]
24+
#[allow(clippy::unknown_clippy_lints)]
2625
#[allow(clippy::pattern_type_mismatch)]
2726
#[allow(clippy::redundant_pub_crate)]
27+
#[allow(dead_code)]
28+
#[allow(clippy::mut_mut)]
29+
#[allow(clippy::type_repetition_in_bounds)]
2830
struct __StructProjection<'pin, T, U>
2931
where
3032
Struct<T, U>: 'pin,
@@ -34,14 +36,15 @@ const _: () = {
3436
unpinned1: &'pin mut (U),
3537
unpinned2: &'pin mut (U),
3638
}
37-
#[allow(dead_code)]
38-
#[allow(clippy::type_repetition_in_bounds)]
3939
#[allow(box_pointers)]
4040
#[allow(explicit_outlives_requirements)]
4141
#[allow(single_use_lifetimes)]
4242
#[allow(unreachable_pub)]
43+
#[allow(clippy::unknown_clippy_lints)]
4344
#[allow(clippy::pattern_type_mismatch)]
4445
#[allow(clippy::redundant_pub_crate)]
46+
#[allow(dead_code)]
47+
#[allow(clippy::type_repetition_in_bounds)]
4548
struct __StructProjectionRef<'pin, T, U>
4649
where
4750
Struct<T, U>: 'pin,
@@ -51,13 +54,14 @@ const _: () = {
5154
unpinned1: &'pin (U),
5255
unpinned2: &'pin (U),
5356
}
54-
#[allow(dead_code)]
5557
#[allow(box_pointers)]
5658
#[allow(explicit_outlives_requirements)]
5759
#[allow(single_use_lifetimes)]
5860
#[allow(unreachable_pub)]
61+
#[allow(clippy::unknown_clippy_lints)]
5962
#[allow(clippy::pattern_type_mismatch)]
6063
#[allow(clippy::redundant_pub_crate)]
64+
#[allow(dead_code)]
6165
struct __StructProjectionOwned<T, U> {
6266
pinned1: ::pin_project::__private::PhantomData<T>,
6367
pinned2: ::pin_project::__private::PhantomData<T>,

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

+10-6
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,21 @@ struct TupleStruct<T, U>(#[pin] T, #[pin] T, U, U);
55
#[allow(explicit_outlives_requirements)]
66
#[allow(single_use_lifetimes)]
77
#[allow(unreachable_pub)]
8+
#[allow(clippy::unknown_clippy_lints)]
89
#[allow(clippy::pattern_type_mismatch)]
910
#[allow(clippy::redundant_pub_crate)]
1011
#[allow(clippy::used_underscore_binding)]
1112
const _: () = {
12-
#[allow(dead_code)]
13-
#[allow(clippy::mut_mut)]
14-
#[allow(clippy::type_repetition_in_bounds)]
1513
#[allow(box_pointers)]
1614
#[allow(explicit_outlives_requirements)]
1715
#[allow(single_use_lifetimes)]
1816
#[allow(unreachable_pub)]
17+
#[allow(clippy::unknown_clippy_lints)]
1918
#[allow(clippy::pattern_type_mismatch)]
2019
#[allow(clippy::redundant_pub_crate)]
20+
#[allow(dead_code)]
21+
#[allow(clippy::mut_mut)]
22+
#[allow(clippy::type_repetition_in_bounds)]
2123
struct __TupleStructProjection<'pin, T, U>(
2224
::pin_project::__private::Pin<&'pin mut (T)>,
2325
::pin_project::__private::Pin<&'pin mut (T)>,
@@ -26,14 +28,15 @@ const _: () = {
2628
)
2729
where
2830
TupleStruct<T, U>: 'pin;
29-
#[allow(dead_code)]
30-
#[allow(clippy::type_repetition_in_bounds)]
3131
#[allow(box_pointers)]
3232
#[allow(explicit_outlives_requirements)]
3333
#[allow(single_use_lifetimes)]
3434
#[allow(unreachable_pub)]
35+
#[allow(clippy::unknown_clippy_lints)]
3536
#[allow(clippy::pattern_type_mismatch)]
3637
#[allow(clippy::redundant_pub_crate)]
38+
#[allow(dead_code)]
39+
#[allow(clippy::type_repetition_in_bounds)]
3740
struct __TupleStructProjectionRef<'pin, T, U>(
3841
::pin_project::__private::Pin<&'pin (T)>,
3942
::pin_project::__private::Pin<&'pin (T)>,
@@ -42,13 +45,14 @@ const _: () = {
4245
)
4346
where
4447
TupleStruct<T, U>: 'pin;
45-
#[allow(dead_code)]
4648
#[allow(box_pointers)]
4749
#[allow(explicit_outlives_requirements)]
4850
#[allow(single_use_lifetimes)]
4951
#[allow(unreachable_pub)]
52+
#[allow(clippy::unknown_clippy_lints)]
5053
#[allow(clippy::pattern_type_mismatch)]
5154
#[allow(clippy::redundant_pub_crate)]
55+
#[allow(dead_code)]
5256
struct __TupleStructProjectionOwned<T, U>(
5357
::pin_project::__private::PhantomData<T>,
5458
::pin_project::__private::PhantomData<T>,

0 commit comments

Comments
 (0)