Skip to content
Myr

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

25 files+88 added−77 removed

modified:test_suite/tests/regression/issue2371.rs+2 added
1#![allow(dead_code)]23use serde_derive::Deserialize;45#[derive(Deserialize)]6pub struct Nested;
47 unmodified lines
modified:test_suite/tests/regression/issue2409.rs+2 added
1#![allow(dead_code)]23use serde_derive::Deserialize;45macro_rules! bug {6 ($serde_path:literal) => {
7 unmodified lines
modified: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)]23use serde_derive::{Deserialize, Serialize};45macro_rules! declare_in_macro {
28 unmodified lines
modified: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)]23use serde_derive::Deserialize;45macro_rules! declare_in_macro {
22 unmodified lines
modified:test_suite/tests/ui/conflict/alias-enum.stderr+3 added-3 removed
5 unmodified lines
67warning: unreachable pattern8 --> tests/ui/conflict/alias-enum.rs:13:99 |108 | #[serde(alias = "a", alias = "b", alias = "c")]10 8 | #[serde(alias = "a", alias = "b", alias = "c")]11 | --- matches all the relevant values12...1313 | 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 default1718warning: unreachable pattern19 --> tests/ui/conflict/alias-enum.rs:12:2520 |218 | #[serde(alias = "a", alias = "b", alias = "c")]21 8 | #[serde(alias = "a", alias = "b", alias = "c")]22 | --- matches all the relevant values23...2412 | #[serde(alias = "c")]25 | ^^^ no value can reach this
54 unmodified lines
modified:test_suite/tests/ui/conflict/alias.stderr+2 added-2 removed
5 unmodified lines
67warning: unreachable pattern8 --> tests/ui/conflict/alias.rs:10:59 |105 | #[serde(alias = "a", alias = "b", alias = "c")]10 5 | #[serde(alias = "a", alias = "b", alias = "c")]11 | --- matches all the relevant values12...1310 | 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 default1718warning: unreachable pattern19 --> tests/ui/conflict/alias.rs:9:2120 |
23 unmodified lines
modified:test_suite/tests/ui/conflict/internal-tag-alias.stderr+6 added-6 removed
1error: variant field name `conflict` conflicts with internal tag2 --> tests/ui/conflict/internal-tag-alias.rs:4:13 |44 | / #[serde(tag = "conflict")]55 | | enum E {66 | | A {77 | | #[serde(alias = "conflict")]88 | | x: (),99 | | },4 4 | / #[serde(tag = "conflict")]5 5 | | enum E {6 6 | | A {7 7 | | #[serde(alias = "conflict")]8 8 | | x: (),9 9 | | },1010 | | }11 | |_^
modified:test_suite/tests/ui/conflict/internal-tag.stderr+6 added-6 removed
1error: variant field name `conflict` conflicts with internal tag2 --> tests/ui/conflict/internal-tag.rs:4:13 |44 | / #[serde(tag = "conflict")]55 | | enum E {66 | | A {77 | | #[serde(rename = "conflict")]88 | | x: (),99 | | },4 4 | / #[serde(tag = "conflict")]5 5 | | enum E {6 6 | | A {7 7 | | #[serde(rename = "conflict")]8 8 | | x: (),9 9 | | },1010 | | }11 | |_^
modified:test_suite/tests/ui/default-attribute/incorrect_type_enum_adjacently_tagged.stderr+3 added-3 removed
1error[E0308]: `match` arms have incompatible types2 --> tests/ui/default-attribute/incorrect_type_enum_adjacently_tagged.rs:10:333 |45 | #[derive(Deserialize)]4 5 | #[derive(Deserialize)]5 | -----------6 | |7 | this is found to be of type `i8`8 | `match` arms have incompatible types
3 unmodified lines
1213error[E0308]: `match` arms have incompatible types14 --> tests/ui/default-attribute/incorrect_type_enum_adjacently_tagged.rs:12:2715 |165 | #[derive(Deserialize)]16 5 | #[derive(Deserialize)]17 | -----------18 | |19 | this is found to be of type `u8`20 | `match` arms have incompatible types
3 unmodified lines
2425error[E0308]: `match` arms have incompatible types26 --> tests/ui/default-attribute/incorrect_type_enum_adjacently_tagged.rs:15:2727 |285 | #[derive(Deserialize)]28 5 | #[derive(Deserialize)]29 | -----------30 | |31 | this is found to be of type `i8`32 | `match` arms have incompatible types
3 unmodified lines
modified:test_suite/tests/ui/default-attribute/incorrect_type_enum_externally_tagged.stderr+2 added-2 removed
11 unmodified lines
1213error[E0308]: `match` arms have incompatible types14 --> tests/ui/default-attribute/incorrect_type_enum_externally_tagged.rs:11:2715 |165 | #[derive(Deserialize)]16 5 | #[derive(Deserialize)]17 | -----------18 | |19 | this is found to be of type `u8`20 | `match` arms have incompatible types
3 unmodified lines
2425error[E0308]: `match` arms have incompatible types26 --> tests/ui/default-attribute/incorrect_type_enum_externally_tagged.rs:14:2727 |285 | #[derive(Deserialize)]28 5 | #[derive(Deserialize)]29 | -----------30 | |31 | this is found to be of type `i8`32 | `match` arms have incompatible types
3 unmodified lines
modified:test_suite/tests/ui/default-attribute/incorrect_type_enum_internally_tagged.stderr+2 added-2 removed
1error[E0308]: `match` arms have incompatible types2 --> tests/ui/default-attribute/incorrect_type_enum_internally_tagged.rs:12:273 |45 | #[derive(Deserialize)]4 5 | #[derive(Deserialize)]5 | -----------6 | |7 | this is found to be of type `u8`8 | `match` arms have incompatible types
3 unmodified lines
1213error[E0308]: `match` arms have incompatible types14 --> tests/ui/default-attribute/incorrect_type_enum_internally_tagged.rs:15:2715 |165 | #[derive(Deserialize)]16 5 | #[derive(Deserialize)]17 | -----------18 | |19 | this is found to be of type `i8`20 | `match` arms have incompatible types
3 unmodified lines
modified:test_suite/tests/ui/default-attribute/incorrect_type_enum_untagged.stderr+3 added-3 removed
1error[E0308]: `match` arms have incompatible types2 --> tests/ui/default-attribute/incorrect_type_enum_untagged.rs:10:333 |45 | #[derive(Deserialize)]4 5 | #[derive(Deserialize)]5 | -----------6 | |7 | this is found to be of type `i8`8 | `match` arms have incompatible types
3 unmodified lines
1213error[E0308]: `match` arms have incompatible types14 --> tests/ui/default-attribute/incorrect_type_enum_untagged.rs:12:2715 |165 | #[derive(Deserialize)]16 5 | #[derive(Deserialize)]17 | -----------18 | |19 | this is found to be of type `u8`20 | `match` arms have incompatible types
3 unmodified lines
2425error[E0308]: `match` arms have incompatible types26 --> tests/ui/default-attribute/incorrect_type_enum_untagged.rs:15:2727 |285 | #[derive(Deserialize)]28 5 | #[derive(Deserialize)]29 | -----------30 | |31 | this is found to be of type `i8`32 | `match` arms have incompatible types
3 unmodified lines
modified:test_suite/tests/ui/default-attribute/incorrect_type_newtype.stderr+1 added-4 removed
1error[E0308]: mismatched types2 --> tests/ui/default-attribute/incorrect_type_newtype.rs:6:193 |46 | #[serde(default = "main")]5 | ^^^^^^6 | |7 | expected `Newtype`, found `()`5 | ^^^^^^ expected `Newtype`, found `()`8 | expected due to this67error[E0308]: `match` arms have incompatible types8 --> tests/ui/default-attribute/incorrect_type_newtype.rs:7:349 |
25 unmodified lines
modified:test_suite/tests/ui/default-attribute/incorrect_type_struct.stderr+3 added-6 removed
1error[E0308]: mismatched types2 --> tests/ui/default-attribute/incorrect_type_struct.rs:6:193 |46 | #[serde(default = "main")]5 | ^^^^^^6 | |7 | expected `Struct`, found `()`5 | ^^^^^^ expected `Struct`, found `()`8 | expected due to this67error[E0308]: `match` arms have incompatible types8 --> tests/ui/default-attribute/incorrect_type_struct.rs:8:239 |
8 unmodified lines
1819error[E0308]: `match` arms have incompatible types20 --> tests/ui/default-attribute/incorrect_type_struct.rs:11:2321 |255 | #[derive(Deserialize)]22 5 | #[derive(Deserialize)]23 | -----------24 | |25 | this is found to be of type `i8`26 | `match` arms have incompatible types
20 unmodified lines
4748error[E0308]: mismatched types49 --> tests/ui/default-attribute/incorrect_type_struct.rs:11:2350 |545 | #[derive(Deserialize)]51 5 | #[derive(Deserialize)]52 | ----------- expected due to the type of this binding53...5411 | #[serde(default = "main")]55 | ^^^^^^ expected `i8`, found `()`
modified:test_suite/tests/ui/default-attribute/incorrect_type_tuple.stderr+1 added-4 removed
1error[E0308]: mismatched types2 --> tests/ui/default-attribute/incorrect_type_tuple.rs:6:193 |46 | #[serde(default = "main")]5 | ^^^^^^6 | |7 | expected `Tuple`, found `()`5 | ^^^^^^ expected `Tuple`, found `()`8 | expected due to this67error[E0308]: `match` arms have incompatible types8 --> tests/ui/default-attribute/incorrect_type_tuple.rs:7:369 |
25 unmodified lines
modified:test_suite/tests/ui/transparent/de_at_least_one.stderr+6 added-6 removed
1error: #[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 |44 | / #[serde(transparent)]55 | | struct S {66 | | #[serde(skip)]77 | | a: u8,88 | | #[serde(default)]99 | | 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,1010 | | }11 | |_^
modified:test_suite/tests/ui/with/incorrect_type.stderr+4 added-4 removed
11 unmodified lines
12 _::_serde::__private::ser::content::ContentSerializer<E>13note: required by a bound in `w::serialize`14 --> tests/ui/with/incorrect_type.rs:9:2815 |169 | 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`1819error[E0061]: this function takes 1 argument but 2 arguments were supplied20 --> tests/ui/with/incorrect_type.rs:15:25
5 unmodified lines
26 |27note: function defined here28 --> tests/ui/with/incorrect_type.rs:9:1229 |309 | 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 | ^^^^^^^^^3233error[E0277]: the trait bound `&u8: Serializer` is not satisfied34 --> tests/ui/with/incorrect_type.rs:15:25
28 unmodified lines
63 _::_serde::__private::ser::content::ContentSerializer<E>64note: required by a bound in `w::serialize`65 --> tests/ui/with/incorrect_type.rs:9:2866 |679 | 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`6970error[E0061]: this function takes 1 argument but 2 arguments were supplied71 --> tests/ui/with/incorrect_type.rs:18:35
5 unmodified lines
77 |78note: function defined here79 --> tests/ui/with/incorrect_type.rs:9:1280 |819 | 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 | ^^^^^^^^^8384error[E0277]: the trait bound `&u8: Serializer` is not satisfied85 --> tests/ui/with/incorrect_type.rs:18:35
16 unmodified lines
modified:test_suite/tests/ui/with-variant/skip_de_struct_field.stderr+5 added-5 removed
1error: 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 |45 | / #[serde(deserialize_with = "deserialize_some_other_variant")]56 | | Struct {67 | | #[serde(skip_deserializing)]78 | | f1: String,89 | | 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,910 | | },10 | |_____^
modified:test_suite/tests/ui/with-variant/skip_ser_struct_field_if.stderr+5 added-5 removed
1error: 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 |45 | / #[serde(serialize_with = "serialize_some_newtype_variant")]56 | | Struct {67 | | #[serde(skip_serializing_if = "always")]78 | | f1: String,89 | | 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,910 | | },10 | |_____^
modified:test_suite/tests/ui/with-variant/skip_ser_struct_field.stderr+5 added-5 removed
1error: 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 |45 | / #[serde(serialize_with = "serialize_some_other_variant")]56 | | Struct {67 | | #[serde(skip_serializing)]78 | | f1: String,89 | | 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,910 | | },10 | |_____^
modified:test_suite/tests/ui/on_unimplemented.stderr+15 added-5 removed
1error[E0277]: the trait bound `MyStruct: Serialize` is not satisfied2 --> tests/ui/on_unimplemented.rs:21:153 |421 | 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 |9help: the trait `Serialize` is not implemented for `MyStruct`10 --> tests/ui/on_unimplemented.rs:18:111 |1218 | 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 T
7 unmodified lines
25 and $N others26note: required by a bound in `to_string`27 --> tests/ui/on_unimplemented.rs:6:828 |244 | fn to_string<T>(_: &T) -> String29 4 | fn to_string<T>(_: &T) -> String30 | --------- required by a bound in this function265 | where276 | T: Serialize,31 5 | where32 6 | T: Serialize,33 | ^^^^^^^^^ required by this bound in `to_string`3435error[E0277]: the trait bound `MyStruct: Deserialize<'_>` is not satisfied36 --> tests/ui/on_unimplemented.rs:22:2337 |3822 | let _: MyStruct = from_str("");34 | ^^^^^^^^^^^^ the trait `Deserialize<'_>` is not implemented for `MyStruct`39 | ^^^^^^^^^^^^ unsatisfied trait bound40 |41help: the trait `Deserialize<'_>` is not implemented for `MyStruct`42 --> tests/ui/on_unimplemented.rs:18:143 |4418 | 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 Path
16 unmodified lines
modified: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)]910use serde::de::value::{BorrowedStrDeserializer, MapDeserializer};11use serde::de::{Deserialize, Deserializer, IntoDeserializer};
185 unmodified lines
modified:test_suite/tests/test_gen.rs+4 added-1 removed
16 unmodified lines
17 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)]2728use serde::de::{Deserialize, DeserializeOwned, Deserializer};
932 unmodified lines
modified:test_suite/tests/test_remote.rs+1 added-1 removed
1#![allow(clippy::redundant_field_names)]1#![allow(clippy::redundant_field_names, dead_code)]23use serde_derive::{Deserialize, Serialize};45mod remote {
258 unmodified lines
modified:test_suite/tests/test_self.rs+1 added-1 removed
1#![allow(clippy::used_underscore_binding)]1#![allow(clippy::used_underscore_binding, dead_code)]23use serde_derive::{Deserialize, Serialize};45#[test]
83 unmodified lines