Skip to content

Commit 699bf3a

Browse files
authored
Merge pull request #2026 from hyd-dev/warning
Allow only `unused_extern_crates` instead of the whole `rust_2018_idioms` lint group in `serde_derive`-generated code
2 parents 6366f17 + dd29825 commit 699bf3a

12 files changed

+23
-23
lines changed

serde_derive/src/dummy.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub fn wrap_in_const(
2323
use #path as _serde;
2424
},
2525
None => quote! {
26-
#[allow(rust_2018_idioms, clippy::useless_attribute)]
26+
#[allow(unused_extern_crates, clippy::useless_attribute)]
2727
extern crate serde as _serde;
2828
},
2929
};

test_suite/tests/expand/de_enum.expanded.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ enum DeEnum<B, C, D> {
1010
#[doc(hidden)]
1111
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
1212
const _: () = {
13-
#[allow(rust_2018_idioms, clippy::useless_attribute)]
13+
#[allow(unused_extern_crates, clippy::useless_attribute)]
1414
extern crate serde as _serde;
1515
#[automatically_derived]
1616
impl<B, C, D> _serde::Serialize for DeEnum<B, C, D>
@@ -265,7 +265,7 @@ const _: () = {
265265
#[doc(hidden)]
266266
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
267267
const _: () = {
268-
#[allow(rust_2018_idioms, clippy::useless_attribute)]
268+
#[allow(unused_extern_crates, clippy::useless_attribute)]
269269
extern crate serde as _serde;
270270
#[automatically_derived]
271271
impl<'de, B, C, D> _serde::Deserialize<'de> for DeEnum<B, C, D>

test_suite/tests/expand/default_ty_param.expanded.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ struct DefaultTyParam<T: AssociatedType<X = i32> = i32> {
1111
#[doc(hidden)]
1212
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
1313
const _: () = {
14-
#[allow(rust_2018_idioms, clippy::useless_attribute)]
14+
#[allow(unused_extern_crates, clippy::useless_attribute)]
1515
extern crate serde as _serde;
1616
#[automatically_derived]
1717
impl<T: AssociatedType<X = i32>> _serde::Serialize for DefaultTyParam<T> {
@@ -49,7 +49,7 @@ const _: () = {
4949
#[doc(hidden)]
5050
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
5151
const _: () = {
52-
#[allow(rust_2018_idioms, clippy::useless_attribute)]
52+
#[allow(unused_extern_crates, clippy::useless_attribute)]
5353
extern crate serde as _serde;
5454
#[automatically_derived]
5555
impl<'de, T: AssociatedType<X = i32>> _serde::Deserialize<'de> for DefaultTyParam<T> {

test_suite/tests/expand/generic_enum.expanded.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ pub enum GenericEnum<T, U> {
88
#[doc(hidden)]
99
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
1010
const _: () = {
11-
#[allow(rust_2018_idioms, clippy::useless_attribute)]
11+
#[allow(unused_extern_crates, clippy::useless_attribute)]
1212
extern crate serde as _serde;
1313
#[automatically_derived]
1414
impl<T, U> _serde::Serialize for GenericEnum<T, U>
@@ -114,7 +114,7 @@ const _: () = {
114114
#[doc(hidden)]
115115
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
116116
const _: () = {
117-
#[allow(rust_2018_idioms, clippy::useless_attribute)]
117+
#[allow(unused_extern_crates, clippy::useless_attribute)]
118118
extern crate serde as _serde;
119119
#[automatically_derived]
120120
impl<'de, T, U> _serde::Deserialize<'de> for GenericEnum<T, U>

test_suite/tests/expand/generic_struct.expanded.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ pub struct GenericStruct<T> {
55
#[doc(hidden)]
66
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
77
const _: () = {
8-
#[allow(rust_2018_idioms, clippy::useless_attribute)]
8+
#[allow(unused_extern_crates, clippy::useless_attribute)]
99
extern crate serde as _serde;
1010
#[automatically_derived]
1111
impl<T> _serde::Serialize for GenericStruct<T>
@@ -42,7 +42,7 @@ const _: () = {
4242
#[doc(hidden)]
4343
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
4444
const _: () = {
45-
#[allow(rust_2018_idioms, clippy::useless_attribute)]
45+
#[allow(unused_extern_crates, clippy::useless_attribute)]
4646
extern crate serde as _serde;
4747
#[automatically_derived]
4848
impl<'de, T> _serde::Deserialize<'de> for GenericStruct<T>
@@ -410,7 +410,7 @@ pub struct GenericNewTypeStruct<T>(T);
410410
#[doc(hidden)]
411411
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
412412
const _: () = {
413-
#[allow(rust_2018_idioms, clippy::useless_attribute)]
413+
#[allow(unused_extern_crates, clippy::useless_attribute)]
414414
extern crate serde as _serde;
415415
#[automatically_derived]
416416
impl<T> _serde::Serialize for GenericNewTypeStruct<T>
@@ -435,7 +435,7 @@ const _: () = {
435435
#[doc(hidden)]
436436
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
437437
const _: () = {
438-
#[allow(rust_2018_idioms, clippy::useless_attribute)]
438+
#[allow(unused_extern_crates, clippy::useless_attribute)]
439439
extern crate serde as _serde;
440440
#[automatically_derived]
441441
impl<'de, T> _serde::Deserialize<'de> for GenericNewTypeStruct<T>

test_suite/tests/expand/generic_tuple_struct.expanded.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ pub struct GenericTupleStruct<T, U>(T, U);
33
#[doc(hidden)]
44
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
55
const _: () = {
6-
#[allow(rust_2018_idioms, clippy::useless_attribute)]
6+
#[allow(unused_extern_crates, clippy::useless_attribute)]
77
extern crate serde as _serde;
88
#[automatically_derived]
99
impl<'de, T, U> _serde::Deserialize<'de> for GenericTupleStruct<T, U>

test_suite/tests/expand/lifetimes.expanded.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ enum Lifetimes<'a> {
88
#[doc(hidden)]
99
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
1010
const _: () = {
11-
#[allow(rust_2018_idioms, clippy::useless_attribute)]
11+
#[allow(unused_extern_crates, clippy::useless_attribute)]
1212
extern crate serde as _serde;
1313
#[automatically_derived]
1414
impl<'a> _serde::Serialize for Lifetimes<'a> {
@@ -95,7 +95,7 @@ const _: () = {
9595
#[doc(hidden)]
9696
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
9797
const _: () = {
98-
#[allow(rust_2018_idioms, clippy::useless_attribute)]
98+
#[allow(unused_extern_crates, clippy::useless_attribute)]
9999
extern crate serde as _serde;
100100
#[automatically_derived]
101101
impl<'de, 'a> _serde::Deserialize<'de> for Lifetimes<'a> {

test_suite/tests/expand/named_map.expanded.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ struct SerNamedMap<'a, 'b, A: 'a, B: 'b, C> {
77
#[doc(hidden)]
88
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
99
const _: () = {
10-
#[allow(rust_2018_idioms, clippy::useless_attribute)]
10+
#[allow(unused_extern_crates, clippy::useless_attribute)]
1111
extern crate serde as _serde;
1212
#[automatically_derived]
1313
impl<'a, 'b, A: 'a, B: 'b, C> _serde::Serialize for SerNamedMap<'a, 'b, A, B, C>
@@ -63,7 +63,7 @@ struct DeNamedMap<A, B, C> {
6363
#[doc(hidden)]
6464
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
6565
const _: () = {
66-
#[allow(rust_2018_idioms, clippy::useless_attribute)]
66+
#[allow(unused_extern_crates, clippy::useless_attribute)]
6767
extern crate serde as _serde;
6868
#[automatically_derived]
6969
impl<'de, A, B, C> _serde::Deserialize<'de> for DeNamedMap<A, B, C>

test_suite/tests/expand/named_tuple.expanded.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ struct SerNamedTuple<'a, 'b, A: 'a, B: 'b, C>(&'a A, &'b mut B, C);
33
#[doc(hidden)]
44
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
55
const _: () = {
6-
#[allow(rust_2018_idioms, clippy::useless_attribute)]
6+
#[allow(unused_extern_crates, clippy::useless_attribute)]
77
extern crate serde as _serde;
88
#[automatically_derived]
99
impl<'a, 'b, A: 'a, B: 'b, C> _serde::Serialize for SerNamedTuple<'a, 'b, A, B, C>
@@ -55,7 +55,7 @@ struct DeNamedTuple<A, B, C>(A, B, C);
5555
#[doc(hidden)]
5656
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
5757
const _: () = {
58-
#[allow(rust_2018_idioms, clippy::useless_attribute)]
58+
#[allow(unused_extern_crates, clippy::useless_attribute)]
5959
extern crate serde as _serde;
6060
#[automatically_derived]
6161
impl<'de, A, B, C> _serde::Deserialize<'de> for DeNamedTuple<A, B, C>

test_suite/tests/expand/named_unit.expanded.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ struct NamedUnit;
33
#[doc(hidden)]
44
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
55
const _: () = {
6-
#[allow(rust_2018_idioms, clippy::useless_attribute)]
6+
#[allow(unused_extern_crates, clippy::useless_attribute)]
77
extern crate serde as _serde;
88
#[automatically_derived]
99
impl _serde::Serialize for NamedUnit {
@@ -21,7 +21,7 @@ const _: () = {
2121
#[doc(hidden)]
2222
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
2323
const _: () = {
24-
#[allow(rust_2018_idioms, clippy::useless_attribute)]
24+
#[allow(unused_extern_crates, clippy::useless_attribute)]
2525
extern crate serde as _serde;
2626
#[automatically_derived]
2727
impl<'de> _serde::Deserialize<'de> for NamedUnit {

test_suite/tests/expand/ser_enum.expanded.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ where
1313
#[doc(hidden)]
1414
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
1515
const _: () = {
16-
#[allow(rust_2018_idioms, clippy::useless_attribute)]
16+
#[allow(unused_extern_crates, clippy::useless_attribute)]
1717
extern crate serde as _serde;
1818
#[automatically_derived]
1919
impl<'a, B: 'a, C: 'a, D> _serde::Serialize for SerEnum<'a, B, C, D>

test_suite/tests/expand/void.expanded.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ enum Void {}
33
#[doc(hidden)]
44
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
55
const _: () = {
6-
#[allow(rust_2018_idioms, clippy::useless_attribute)]
6+
#[allow(unused_extern_crates, clippy::useless_attribute)]
77
extern crate serde as _serde;
88
#[automatically_derived]
99
impl _serde::Serialize for Void {
@@ -21,7 +21,7 @@ const _: () = {
2121
#[doc(hidden)]
2222
#[allow(non_upper_case_globals, unused_attributes, unused_qualifications)]
2323
const _: () = {
24-
#[allow(rust_2018_idioms, clippy::useless_attribute)]
24+
#[allow(unused_extern_crates, clippy::useless_attribute)]
2525
extern crate serde as _serde;
2626
#[automatically_derived]
2727
impl<'de> _serde::Deserialize<'de> for Void {

0 commit comments

Comments
 (0)