error: field `option` is never read
--> test_suite/tests/test_gen.rs:666:9
|
665 | struct ImplicitlyBorrowedOption<'a> {
| ------------------------ field in this struct
666 | option: std::option::Option<&'a str>,
| ^^^^^^
|
note: the lint level is defined here
--> test_suite/tests/test_gen.rs:5:9
|
5 | #![deny(warnings)]
| ^^^^^^^^
= note: `#[deny(dead_code)]` implied by `#[deny(warnings)]`
error: fields `ty` and `id` are never read
--> test_suite/tests/test_gen.rs:696:9
|
695 | struct RelObject<'a> {
| --------- fields in this struct
696 | ty: &'a str,
| ^^
697 | id: String,
| ^^
error: field `field` is never read
--> test_suite/tests/test_gen.rs:740:17
|
739 | struct MacroRules<'a> {
| ---------- field in this struct
740 | field: $field,
| ^^^^^
...
745 | deriving!(&'a str);
| ------------------ in this macro invocation
|
= note: this error originates in the macro `deriving` (in Nightly builds, run with -Z macro-backtrace for more info)
error: field `f` is never read
--> test_suite/tests/test_gen.rs:756:9
|
754 | struct BorrowLifetimeInsideMacro<'a> {
| ------------------------- field in this struct
755 | #[serde(borrow = "'a")]
756 | f: mac!(Cow<'a, str>),
| ^
warning: fields `question` and `answer` are never read
--> test_suite/tests/test_annotations.rs:2969:9
|
2968 | struct Struct {
| ------ fields in this struct
2969 | question: String,
| ^^^^^^^^
2970 | answer: u32,
| ^^^^^^
|
= note: `#[warn(dead_code)]` on by default
error: explicit call to `.into_iter()` in function argument accepting `IntoIterator`
--> test_suite/tests/test_de.rs:202:12
|
202 | .chain(vec![Token::MapEnd].into_iter())
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider removing the `.into_iter()`: `vec![Token::MapEnd]`
|
note: this parameter accepts any `IntoIterator`, so you don't need to call `.into_iter()`
--> /home/david/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/iterator.rs:522:12
|
522 | U: IntoIterator<Item = Self::Item>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
= note: `-D clippy::useless-conversion` implied by `-D clippy::all`
Previously if someone wrote an enum containing:
- `A` (untagged)
- `B` (tagged)
- `C` (tagged)
- `D` (untagged)
- `E` (tagged)
- `F` (untagged)
serde_derive would produce errors referring to B and E only, saying
you're supposed to put untagged variants at the end. The choice of B and
E for this error doesn't make a lot of sense because in order to resolve
the issue, the user must either:
- move A and D down
or:
- move B, C, and E up.
This commit changes the error to appear on A and D instead.
This count should mean the number of fields expected in the serialized form,
so if some fields are skipped, they shouldn't be counted
Methods affected:
- Deserializer::deserialize_tuple
- Deserializer::deserialize_tuple_struct
- VariantAccess::tuple_variant
Without serde(bound = ""), serde_derive infers a bound of `T: Serialize`
for the generated Serialize impl and `T: Deserialize<'de> + Default` for
the Deserialize impl. `X` implements none of these so the generated code
would fail to compile.
error[E0277]: the trait bound `X: Serialize` is not satisfied
--> test_suite/tests/test_gen.rs:268:14
|
268 | assert::<PhantomDataWrapper<X>>();
| ^^^^^^^^^^^^^^^^^^^^^ the trait `Serialize` is not implemented for `X`
|
= help: the following other types implement trait `Serialize`:
&'a T
&'a mut T
()
(T0, T1)
(T0, T1, T2)
(T0, T1, T2, T3)
(T0, T1, T2, T3, T4)
(T0, T1, T2, T3, T4, T5)
and 248 others
note: required for `PhantomDataWrapper<X>` to implement `Serialize`
--> test_suite/tests/test_gen.rs:262:14
|
262 | #[derive(Serialize, Deserialize)]
| ^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro
263 | //#[serde(bound = "")]
264 | struct PhantomDataWrapper<T> {
| ^^^^^^^^^^^^^^^^^^^^^
note: required by a bound in `assert`
--> test_suite/tests/test_gen.rs:767:14
|
767 | fn assert<T: Serialize + DeserializeOwned>() {}
| ^^^^^^^^^ required by this bound in `assert`
= note: this error originates in the derive macro `Serialize` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `X: Deserialize<'_>` is not satisfied
--> test_suite/tests/test_gen.rs:268:14
|
268 | assert::<PhantomDataWrapper<X>>();
| ^^^^^^^^^^^^^^^^^^^^^ the trait `Deserialize<'_>` is not implemented for `X`
|
= help: the following other types implement trait `Deserialize<'de>`:
<&'a Path as Deserialize<'de>>
<&'a [u8] as Deserialize<'de>>
<&'a str as Deserialize<'de>>
<() as Deserialize<'de>>
<(T0, T1) as Deserialize<'de>>
<(T0, T1, T2) as Deserialize<'de>>
<(T0, T1, T2, T3) as Deserialize<'de>>
<(T0, T1, T2, T3, T4) as Deserialize<'de>>
and 331 others
note: required for `PhantomDataWrapper<X>` to implement `for<'de> Deserialize<'de>`
--> test_suite/tests/test_gen.rs:262:25
|
262 | #[derive(Serialize, Deserialize)]
| ^^^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro
263 | //#[serde(bound = "")]
264 | struct PhantomDataWrapper<T> {
| ^^^^^^^^^^^^^^^^^^^^^
= note: required for `PhantomDataWrapper<X>` to implement `DeserializeOwned`
note: required by a bound in `assert`
--> test_suite/tests/test_gen.rs:767:26
|
767 | fn assert<T: Serialize + DeserializeOwned>() {}
| ^^^^^^^^^^^^^^^^ required by this bound in `assert`
= note: this error originates in the derive macro `Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `X: Default` is not satisfied
--> test_suite/tests/test_gen.rs:268:14
|
268 | assert::<PhantomDataWrapper<X>>();
| ^^^^^^^^^^^^^^^^^^^^^ the trait `Default` is not implemented for `X`
|
note: required for `PhantomDataWrapper<X>` to implement `for<'de> Deserialize<'de>`
--> test_suite/tests/test_gen.rs:262:25
|
262 | #[derive(Serialize, Deserialize)]
| ^^^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro
263 | //#[serde(bound = "")]
264 | struct PhantomDataWrapper<T> {
| ^^^^^^^^^^^^^^^^^^^^^
= note: required for `PhantomDataWrapper<X>` to implement `DeserializeOwned`
note: required by a bound in `assert`
--> test_suite/tests/test_gen.rs:767:26
|
767 | fn assert<T: Serialize + DeserializeOwned>() {}
| ^^^^^^^^^^^^^^^^ required by this bound in `assert`
= note: this error originates in the derive macro `Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider annotating `X` with `#[derive(Default)]`
|
779 | #[derive(Default)]
|
warning: lint `unaligned_references` has been removed: converted into hard error, see issue #82523 <https://github.com/rust-lang/rust/issues/82523> for more information
--> test_suite/tests/test_macros.rs:1931:8
|
1931 | #[deny(unaligned_references)]
| ^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(renamed_and_removed_lints)]` on by default