Allow more dead code
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Oli Scherer · committed by Oli Scherer · parent 363deb8 · Browse files · 25 files·+88 added−77 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
25 files+88 added−77 removed
- tests:+88 added−77 removed
Provenance
- Commit
c85e424- Tree
8f5e412- Author
Oli Scherer <github@oli-obk.de>- Committer
Oli Scherer <github@oli-obk.de>- Parent
363deb8
25 files changed+88 added−77 removed
modified:test_suite/tests/regression/issue2371.rs+2 added
1+#![allow(dead_code)]2+3 use serde_derive::Deserialize;4 5 #[derive(Deserialize)]6 pub struct Nested;47 unmodified linesmodified:test_suite/tests/regression/issue2409.rs+2 added
1+#![allow(dead_code)]2+3 use serde_derive::Deserialize;4 5 macro_rules! bug {6 ($serde_path:literal) => {7 unmodified linesmodified:test_suite/tests/regression/issue2844.rs+1 added-1 removed
1-#![allow(clippy::trivially_copy_pass_by_ref)]1+#![allow(clippy::trivially_copy_pass_by_ref, dead_code)]2 3 use serde_derive::{Deserialize, Serialize};4 5 macro_rules! declare_in_macro {28 unmodified linesmodified:test_suite/tests/regression/issue2846.rs+1 added-1 removed
1-#![allow(clippy::trivially_copy_pass_by_ref)]1+#![allow(clippy::trivially_copy_pass_by_ref, dead_code)]2 3 use serde_derive::Deserialize;4 5 macro_rules! declare_in_macro {22 unmodified linesmodified:test_suite/tests/ui/conflict/alias-enum.stderr+3 added-3 removed
5 unmodified lines6 7 warning: unreachable pattern8 --> tests/ui/conflict/alias-enum.rs:13:99 |10-8 | #[serde(alias = "a", alias = "b", alias = "c")]10+ 8 | #[serde(alias = "a", alias = "b", alias = "c")]11 | --- matches all the relevant values12 ...13 13 | b: (),14 | ^ no value can reach this15 |16- = note: `#[warn(unreachable_patterns)]` on by default16+ = note: `#[warn(unreachable_patterns)]` (part of `#[warn(unused)]`) on by default17 18 warning: unreachable pattern19 --> tests/ui/conflict/alias-enum.rs:12:2520 |21-8 | #[serde(alias = "a", alias = "b", alias = "c")]21+ 8 | #[serde(alias = "a", alias = "b", alias = "c")]22 | --- matches all the relevant values23 ...24 12 | #[serde(alias = "c")]25 | ^^^ no value can reach this54 unmodified linesmodified:test_suite/tests/ui/conflict/alias.stderr+2 added-2 removed
5 unmodified lines6 7 warning: unreachable pattern8 --> tests/ui/conflict/alias.rs:10:59 |10-5 | #[serde(alias = "a", alias = "b", alias = "c")]10+ 5 | #[serde(alias = "a", alias = "b", alias = "c")]11 | --- matches all the relevant values12 ...13 10 | b: (),14 | ^ no value can reach this15 |16- = note: `#[warn(unreachable_patterns)]` on by default16+ = note: `#[warn(unreachable_patterns)]` (part of `#[warn(unused)]`) on by default17 18 warning: unreachable pattern19 --> tests/ui/conflict/alias.rs:9:2120 |23 unmodified linesmodified:test_suite/tests/ui/conflict/internal-tag-alias.stderr+6 added-6 removed
1 error: variant field name `conflict` conflicts with internal tag2 --> tests/ui/conflict/internal-tag-alias.rs:4:13 |4-4 | / #[serde(tag = "conflict")]5-5 | | enum E {6-6 | | A {7-7 | | #[serde(alias = "conflict")]8-8 | | x: (),9-9 | | },4+ 4 | / #[serde(tag = "conflict")]5+ 5 | | enum E {6+ 6 | | A {7+ 7 | | #[serde(alias = "conflict")]8+ 8 | | x: (),9+ 9 | | },10 10 | | }11 | |_^modified:test_suite/tests/ui/conflict/internal-tag.stderr+6 added-6 removed
1 error: variant field name `conflict` conflicts with internal tag2 --> tests/ui/conflict/internal-tag.rs:4:13 |4-4 | / #[serde(tag = "conflict")]5-5 | | enum E {6-6 | | A {7-7 | | #[serde(rename = "conflict")]8-8 | | x: (),9-9 | | },4+ 4 | / #[serde(tag = "conflict")]5+ 5 | | enum E {6+ 6 | | A {7+ 7 | | #[serde(rename = "conflict")]8+ 8 | | x: (),9+ 9 | | },10 10 | | }11 | |_^modified:test_suite/tests/ui/default-attribute/incorrect_type_enum_adjacently_tagged.stderr+3 added-3 removed
1 error[E0308]: `match` arms have incompatible types2 --> tests/ui/default-attribute/incorrect_type_enum_adjacently_tagged.rs:10:333 |4-5 | #[derive(Deserialize)]4+ 5 | #[derive(Deserialize)]5 | -----------6 | |7 | this is found to be of type `i8`8 | `match` arms have incompatible types3 unmodified lines12 13 error[E0308]: `match` arms have incompatible types14 --> tests/ui/default-attribute/incorrect_type_enum_adjacently_tagged.rs:12:2715 |16-5 | #[derive(Deserialize)]16+ 5 | #[derive(Deserialize)]17 | -----------18 | |19 | this is found to be of type `u8`20 | `match` arms have incompatible types3 unmodified lines24 25 error[E0308]: `match` arms have incompatible types26 --> tests/ui/default-attribute/incorrect_type_enum_adjacently_tagged.rs:15:2727 |28-5 | #[derive(Deserialize)]28+ 5 | #[derive(Deserialize)]29 | -----------30 | |31 | this is found to be of type `i8`32 | `match` arms have incompatible types3 unmodified linesmodified:test_suite/tests/ui/default-attribute/incorrect_type_enum_externally_tagged.stderr+2 added-2 removed
11 unmodified lines12 13 error[E0308]: `match` arms have incompatible types14 --> tests/ui/default-attribute/incorrect_type_enum_externally_tagged.rs:11:2715 |16-5 | #[derive(Deserialize)]16+ 5 | #[derive(Deserialize)]17 | -----------18 | |19 | this is found to be of type `u8`20 | `match` arms have incompatible types3 unmodified lines24 25 error[E0308]: `match` arms have incompatible types26 --> tests/ui/default-attribute/incorrect_type_enum_externally_tagged.rs:14:2727 |28-5 | #[derive(Deserialize)]28+ 5 | #[derive(Deserialize)]29 | -----------30 | |31 | this is found to be of type `i8`32 | `match` arms have incompatible types3 unmodified linesmodified:test_suite/tests/ui/default-attribute/incorrect_type_enum_internally_tagged.stderr+2 added-2 removed
1 error[E0308]: `match` arms have incompatible types2 --> tests/ui/default-attribute/incorrect_type_enum_internally_tagged.rs:12:273 |4-5 | #[derive(Deserialize)]4+ 5 | #[derive(Deserialize)]5 | -----------6 | |7 | this is found to be of type `u8`8 | `match` arms have incompatible types3 unmodified lines12 13 error[E0308]: `match` arms have incompatible types14 --> tests/ui/default-attribute/incorrect_type_enum_internally_tagged.rs:15:2715 |16-5 | #[derive(Deserialize)]16+ 5 | #[derive(Deserialize)]17 | -----------18 | |19 | this is found to be of type `i8`20 | `match` arms have incompatible types3 unmodified linesmodified:test_suite/tests/ui/default-attribute/incorrect_type_enum_untagged.stderr+3 added-3 removed
1 error[E0308]: `match` arms have incompatible types2 --> tests/ui/default-attribute/incorrect_type_enum_untagged.rs:10:333 |4-5 | #[derive(Deserialize)]4+ 5 | #[derive(Deserialize)]5 | -----------6 | |7 | this is found to be of type `i8`8 | `match` arms have incompatible types3 unmodified lines12 13 error[E0308]: `match` arms have incompatible types14 --> tests/ui/default-attribute/incorrect_type_enum_untagged.rs:12:2715 |16-5 | #[derive(Deserialize)]16+ 5 | #[derive(Deserialize)]17 | -----------18 | |19 | this is found to be of type `u8`20 | `match` arms have incompatible types3 unmodified lines24 25 error[E0308]: `match` arms have incompatible types26 --> tests/ui/default-attribute/incorrect_type_enum_untagged.rs:15:2727 |28-5 | #[derive(Deserialize)]28+ 5 | #[derive(Deserialize)]29 | -----------30 | |31 | this is found to be of type `i8`32 | `match` arms have incompatible types3 unmodified linesmodified:test_suite/tests/ui/default-attribute/incorrect_type_newtype.stderr+1 added-4 removed
1 error[E0308]: mismatched types2 --> tests/ui/default-attribute/incorrect_type_newtype.rs:6:193 |4 6 | #[serde(default = "main")]5- | ^^^^^^6- | |7- | expected `Newtype`, found `()`5+ | ^^^^^^ expected `Newtype`, found `()`8- | expected due to this6 7 error[E0308]: `match` arms have incompatible types8 --> tests/ui/default-attribute/incorrect_type_newtype.rs:7:349 |25 unmodified linesmodified:test_suite/tests/ui/default-attribute/incorrect_type_struct.stderr+3 added-6 removed
1 error[E0308]: mismatched types2 --> tests/ui/default-attribute/incorrect_type_struct.rs:6:193 |4 6 | #[serde(default = "main")]5- | ^^^^^^6- | |7- | expected `Struct`, found `()`5+ | ^^^^^^ expected `Struct`, found `()`8- | expected due to this6 7 error[E0308]: `match` arms have incompatible types8 --> tests/ui/default-attribute/incorrect_type_struct.rs:8:239 |8 unmodified lines18 19 error[E0308]: `match` arms have incompatible types20 --> tests/ui/default-attribute/incorrect_type_struct.rs:11:2321 |25-5 | #[derive(Deserialize)]22+ 5 | #[derive(Deserialize)]23 | -----------24 | |25 | this is found to be of type `i8`26 | `match` arms have incompatible types20 unmodified lines47 48 error[E0308]: mismatched types49 --> tests/ui/default-attribute/incorrect_type_struct.rs:11:2350 |54-5 | #[derive(Deserialize)]51+ 5 | #[derive(Deserialize)]52 | ----------- expected due to the type of this binding53 ...54 11 | #[serde(default = "main")]55 | ^^^^^^ expected `i8`, found `()`modified:test_suite/tests/ui/default-attribute/incorrect_type_tuple.stderr+1 added-4 removed
1 error[E0308]: mismatched types2 --> tests/ui/default-attribute/incorrect_type_tuple.rs:6:193 |4 6 | #[serde(default = "main")]5- | ^^^^^^6- | |7- | expected `Tuple`, found `()`5+ | ^^^^^^ expected `Tuple`, found `()`8- | expected due to this6 7 error[E0308]: `match` arms have incompatible types8 --> tests/ui/default-attribute/incorrect_type_tuple.rs:7:369 |25 unmodified linesmodified:test_suite/tests/ui/transparent/de_at_least_one.stderr+6 added-6 removed
1 error: #[serde(transparent)] requires at least one field that is neither skipped nor has a default2 --> tests/ui/transparent/de_at_least_one.rs:4:13 |4-4 | / #[serde(transparent)]5-5 | | struct S {6-6 | | #[serde(skip)]7-7 | | a: u8,8-8 | | #[serde(default)]9-9 | | b: u8,4+ 4 | / #[serde(transparent)]5+ 5 | | struct S {6+ 6 | | #[serde(skip)]7+ 7 | | a: u8,8+ 8 | | #[serde(default)]9+ 9 | | b: u8,10 10 | | }11 | |_^modified:test_suite/tests/ui/with/incorrect_type.stderr+4 added-4 removed
11 unmodified lines12 _::_serde::__private::ser::content::ContentSerializer<E>13 note: required by a bound in `w::serialize`14 --> tests/ui/with/incorrect_type.rs:9:2815 |16-9 | pub fn serialize<T, S: Serializer>(_: S) -> Result<S::Ok, S::Error> {16+ 9 | pub fn serialize<T, S: Serializer>(_: S) -> Result<S::Ok, S::Error> {17 | ^^^^^^^^^^ required by this bound in `serialize`18 19 error[E0061]: this function takes 1 argument but 2 arguments were supplied20 --> tests/ui/with/incorrect_type.rs:15:255 unmodified lines26 |27 note: function defined here28 --> tests/ui/with/incorrect_type.rs:9:1229 |30-9 | pub fn serialize<T, S: Serializer>(_: S) -> Result<S::Ok, S::Error> {30+ 9 | pub fn serialize<T, S: Serializer>(_: S) -> Result<S::Ok, S::Error> {31 | ^^^^^^^^^32 33 error[E0277]: the trait bound `&u8: Serializer` is not satisfied34 --> tests/ui/with/incorrect_type.rs:15:2528 unmodified lines63 _::_serde::__private::ser::content::ContentSerializer<E>64 note: required by a bound in `w::serialize`65 --> tests/ui/with/incorrect_type.rs:9:2866 |67-9 | pub fn serialize<T, S: Serializer>(_: S) -> Result<S::Ok, S::Error> {67+ 9 | pub fn serialize<T, S: Serializer>(_: S) -> Result<S::Ok, S::Error> {68 | ^^^^^^^^^^ required by this bound in `serialize`69 70 error[E0061]: this function takes 1 argument but 2 arguments were supplied71 --> tests/ui/with/incorrect_type.rs:18:355 unmodified lines77 |78 note: function defined here79 --> tests/ui/with/incorrect_type.rs:9:1280 |81-9 | pub fn serialize<T, S: Serializer>(_: S) -> Result<S::Ok, S::Error> {81+ 9 | pub fn serialize<T, S: Serializer>(_: S) -> Result<S::Ok, S::Error> {82 | ^^^^^^^^^83 84 error[E0277]: the trait bound `&u8: Serializer` is not satisfied85 --> tests/ui/with/incorrect_type.rs:18:3516 unmodified linesmodified:test_suite/tests/ui/with-variant/skip_de_struct_field.stderr+5 added-5 removed
1 error: variant `Struct` cannot have both #[serde(deserialize_with)] and a field `f1` marked with #[serde(skip_deserializing)]2 --> tests/ui/with-variant/skip_de_struct_field.rs:5:53 |4-5 | / #[serde(deserialize_with = "deserialize_some_other_variant")]5-6 | | Struct {6-7 | | #[serde(skip_deserializing)]7-8 | | f1: String,8-9 | | f2: u8,4+ 5 | / #[serde(deserialize_with = "deserialize_some_other_variant")]5+ 6 | | Struct {6+ 7 | | #[serde(skip_deserializing)]7+ 8 | | f1: String,8+ 9 | | f2: u8,9 10 | | },10 | |_____^modified:test_suite/tests/ui/with-variant/skip_ser_struct_field_if.stderr+5 added-5 removed
1 error: variant `Struct` cannot have both #[serde(serialize_with)] and a field `f1` marked with #[serde(skip_serializing_if)]2 --> tests/ui/with-variant/skip_ser_struct_field_if.rs:5:53 |4-5 | / #[serde(serialize_with = "serialize_some_newtype_variant")]5-6 | | Struct {6-7 | | #[serde(skip_serializing_if = "always")]7-8 | | f1: String,8-9 | | f2: u8,4+ 5 | / #[serde(serialize_with = "serialize_some_newtype_variant")]5+ 6 | | Struct {6+ 7 | | #[serde(skip_serializing_if = "always")]7+ 8 | | f1: String,8+ 9 | | f2: u8,9 10 | | },10 | |_____^modified:test_suite/tests/ui/with-variant/skip_ser_struct_field.stderr+5 added-5 removed
1 error: variant `Struct` cannot have both #[serde(serialize_with)] and a field `f1` marked with #[serde(skip_serializing)]2 --> tests/ui/with-variant/skip_ser_struct_field.rs:5:53 |4-5 | / #[serde(serialize_with = "serialize_some_other_variant")]5-6 | | Struct {6-7 | | #[serde(skip_serializing)]7-8 | | f1: String,8-9 | | f2: u8,4+ 5 | / #[serde(serialize_with = "serialize_some_other_variant")]5+ 6 | | Struct {6+ 7 | | #[serde(skip_serializing)]7+ 8 | | f1: String,8+ 9 | | f2: u8,9 10 | | },10 | |_____^modified:test_suite/tests/ui/on_unimplemented.stderr+15 added-5 removed
1 error[E0277]: the trait bound `MyStruct: Serialize` is not satisfied2 --> tests/ui/on_unimplemented.rs:21:153 |4 21 | to_string(&MyStruct);5- | --------- ^^^^^^^^^ the trait `Serialize` is not implemented for `MyStruct`5+ | --------- ^^^^^^^^^ unsatisfied trait bound6 | |7 | required by a bound introduced by this call8 |9+help: the trait `Serialize` is not implemented for `MyStruct`10+ --> tests/ui/on_unimplemented.rs:18:111+ |12+18 | struct MyStruct;13+ | ^^^^^^^^^^^^^^^14 = note: for local types consider adding `#[derive(serde::Serialize)]` to your `MyStruct` type15 = note: for types from other crates check whether the crate offers a `serde` feature flag16 = help: the following other types implement trait `Serialize`:17 &'a T7 unmodified lines25 and $N others26 note: required by a bound in `to_string`27 --> tests/ui/on_unimplemented.rs:6:828 |24-4 | fn to_string<T>(_: &T) -> String29+ 4 | fn to_string<T>(_: &T) -> String30 | --------- required by a bound in this function26-5 | where27-6 | T: Serialize,31+ 5 | where32+ 6 | T: Serialize,33 | ^^^^^^^^^ required by this bound in `to_string`34 35 error[E0277]: the trait bound `MyStruct: Deserialize<'_>` is not satisfied36 --> tests/ui/on_unimplemented.rs:22:2337 |38 22 | let _: MyStruct = from_str("");34- | ^^^^^^^^^^^^ the trait `Deserialize<'_>` is not implemented for `MyStruct`39+ | ^^^^^^^^^^^^ unsatisfied trait bound40 |41+help: the trait `Deserialize<'_>` is not implemented for `MyStruct`42+ --> tests/ui/on_unimplemented.rs:18:143+ |44+18 | struct MyStruct;45+ | ^^^^^^^^^^^^^^^46 = note: for local types consider adding `#[derive(serde::Deserialize)]` to your `MyStruct` type47 = note: for types from other crates check whether the crate offers a `serde` feature flag48 = help: the following other types implement trait `Deserialize<'de>`:49 &'a Path16 unmodified linesmodified:test_suite/tests/test_borrow.rs+4 added-1 removed
1 #![allow(2 clippy::derive_partial_eq_without_eq,3 clippy::items_after_statements,4- clippy::used_underscore_binding4+ clippy::used_underscore_binding,5+ // We use lots of declarations inside function bodies to avoid conflicts,6+ // but they aren't used. We just want to make sure they compile.7+ dead_code,8 )]9 10 use serde::de::value::{BorrowedStrDeserializer, MapDeserializer};11 use serde::de::{Deserialize, Deserializer, IntoDeserializer};185 unmodified linesmodified:test_suite/tests/test_gen.rs+4 added-1 removed
16 unmodified lines17 clippy::nonstandard_macro_braces,18 clippy::ptr_arg,19 clippy::too_many_lines,20 clippy::trivially_copy_pass_by_ref,21- clippy::type_repetition_in_bounds21+ clippy::type_repetition_in_bounds,22+ // We use lots of declarations inside function bodies to avoid conflicts,23+ // but they aren't used. We just want to make sure they compile.24+ dead_code,25 )]26 #![deny(clippy::collection_is_never_read)]27 28 use serde::de::{Deserialize, DeserializeOwned, Deserializer};932 unmodified linesmodified:test_suite/tests/test_remote.rs+1 added-1 removed
1-#![allow(clippy::redundant_field_names)]1+#![allow(clippy::redundant_field_names, dead_code)]2 3 use serde_derive::{Deserialize, Serialize};4 5 mod remote {258 unmodified linesmodified:test_suite/tests/test_self.rs+1 added-1 removed
1-#![allow(clippy::used_underscore_binding)]1+#![allow(clippy::used_underscore_binding, dead_code)]2 3 use serde_derive::{Deserialize, Serialize};4 5 #[test]83 unmodified lines