Skip to content

Commit 364cd8d

Browse files
committed
Ignore dead code lint in tests
New in nightly-2024-03-24 from rust-lang/rust#119552. warning: fields `nested` and `string` are never read --> test_suite/tests/regression/issue2371.rs:10:9 | 8 | Flatten { | ------- fields in this variant 9 | #[serde(flatten)] 10 | nested: Nested, | ^^^^^^ 11 | string: &'static str, | ^^^^^^ | = note: `#[warn(dead_code)]` on by default warning: fields `nested` and `string` are never read --> test_suite/tests/regression/issue2371.rs:20:9 | 18 | Flatten { | ------- fields in this variant 19 | #[serde(flatten)] 20 | nested: Nested, | ^^^^^^ 21 | string: &'static str, | ^^^^^^ warning: fields `nested` and `string` are never read --> test_suite/tests/regression/issue2371.rs:30:9 | 28 | Flatten { | ------- fields in this variant 29 | #[serde(flatten)] 30 | nested: Nested, | ^^^^^^ 31 | string: &'static str, | ^^^^^^ warning: fields `nested` and `string` are never read --> test_suite/tests/regression/issue2371.rs:40:9 | 38 | Flatten { | ------- fields in this variant 39 | #[serde(flatten)] 40 | nested: Nested, | ^^^^^^ 41 | string: &'static str, | ^^^^^^ warning: field `0` is never read --> test_suite/tests/test_gen.rs:690:33 | 690 | Single(#[serde(borrow)] RelObject<'a>), | ------ ^^^^^^^^^^^^^ | | | field in this variant | = note: `#[warn(dead_code)]` on by default help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field | 690 | Single(#[serde(borrow)] ()), | ~~ warning: field `0` is never read --> test_suite/tests/test_gen.rs:691:31 | 691 | Many(#[serde(borrow)] Vec<RelObject<'a>>), | ---- ^^^^^^^^^^^^^^^^^^ | | | field in this variant | help: consider changing the field to be of unit type to suppress this warning while preserving the field numbering, or remove the field | 691 | Many(#[serde(borrow)] ()), | ~~
1 parent 9f8c579 commit 364cd8d

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

test_suite/tests/regression/issue2371.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ pub struct Nested;
77
pub enum ExternallyTagged {
88
Flatten {
99
#[serde(flatten)]
10+
#[allow(dead_code)]
1011
nested: Nested,
12+
#[allow(dead_code)]
1113
string: &'static str,
1214
},
1315
}
@@ -17,7 +19,9 @@ pub enum ExternallyTagged {
1719
pub enum InternallyTagged {
1820
Flatten {
1921
#[serde(flatten)]
22+
#[allow(dead_code)]
2023
nested: Nested,
24+
#[allow(dead_code)]
2125
string: &'static str,
2226
},
2327
}
@@ -27,7 +31,9 @@ pub enum InternallyTagged {
2731
pub enum AdjacentlyTagged {
2832
Flatten {
2933
#[serde(flatten)]
34+
#[allow(dead_code)]
3035
nested: Nested,
36+
#[allow(dead_code)]
3137
string: &'static str,
3238
},
3339
}
@@ -37,7 +43,9 @@ pub enum AdjacentlyTagged {
3743
pub enum UntaggedWorkaround {
3844
Flatten {
3945
#[serde(flatten)]
46+
#[allow(dead_code)]
4047
nested: Nested,
48+
#[allow(dead_code)]
4149
string: &'static str,
4250
},
4351
}

test_suite/tests/test_gen.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -687,8 +687,16 @@ fn test_gen() {
687687
#[derive(Deserialize)]
688688
#[serde(untagged)]
689689
pub enum UntaggedWithBorrow<'a> {
690-
Single(#[serde(borrow)] RelObject<'a>),
691-
Many(#[serde(borrow)] Vec<RelObject<'a>>),
690+
Single(
691+
#[serde(borrow)]
692+
#[allow(dead_code)]
693+
RelObject<'a>,
694+
),
695+
Many(
696+
#[serde(borrow)]
697+
#[allow(dead_code)]
698+
Vec<RelObject<'a>>,
699+
),
692700
}
693701

694702
#[derive(Deserialize)]

0 commit comments

Comments
 (0)