The Container struct
struct Container {
#[serde(flatten)]
enum_field: Enum,
}
enum Enum {
Tuple(u32, u32),
}
now can be serialized to JSON as
{ "enum_field": [1, 2] }
Deserialization already works
Fixes (1):
flatten::enum_::externally_tagged::tuple
1.0.0 does not work with workspaces.
error: No such file or directory (os error 2)
--> test_suite/tests/regression.rs:2:5
|
2 | automod::dir!("tests/regression");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in the macro `automod::dir` (in Nightly builds, run with -Z macro-backtrace for more info)
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`
error: try not to call a closure in the expression where it is declared
--> serde/src/de/impls.rs:1590:76
|
1590 | <(_, u16)>::deserialize(deserializer).map(|(ip, port)| $new(ip, port))
| ^^^^^^^^^^^^^^
...
1620 | / parse_socket_impl!("IPv6 socket address" net::SocketAddrV6, |ip, port| net::SocketAddrV6::new(
1621 | | ip, port, 0, 0
1622 | | ));
| |__- in this macro invocation
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure_call
= note: `-D clippy::redundant-closure-call` implied by `-D clippy::all`
= note: this error originates in the macro `parse_socket_impl` (in Nightly builds, run with -Z macro-backtrace for more info)
error: it is more concise to loop over references to containers instead of using explicit iteration methods
--> serde/src/private/de.rs:2761:22
|
2761 | for entry in self.0.iter_mut() {
| ^^^^^^^^^^^^^^^^^ help: to write this more concisely, try: `&mut *self.0`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_iter_loop
= note: `-D clippy::explicit-iter-loop` implied by `-D clippy::pedantic`
error: it is more concise to loop over references to containers instead of using explicit iteration methods
--> serde_derive/src/internals/check.rs:202:20
|
202 | for variant in variants.iter() {
| ^^^^^^^^^^^^^^^ help: to write this more concisely, try: `variants`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_iter_loop
= note: `-D clippy::explicit-iter-loop` implied by `-D clippy::pedantic`
error: it is more concise to loop over references to containers instead of using explicit iteration methods
--> serde_derive/src/bound.rs:262:28
|
262 | for variant in variants.iter() {
| ^^^^^^^^^^^^^^^ help: to write this more concisely, try: `variants`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_iter_loop