Skip to content

Commit

Permalink
Add test of flatten in enum
Browse files Browse the repository at this point in the history
    error: collection is never read
       --> test_suite/tests/test_gen.rs:728:25
        |
    728 |     #[derive(Serialize, Deserialize)]
        |                         ^^^^^^^^^^^
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collection_is_never_read
        = note: this error originates in the derive macro `Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info)
  • Loading branch information
dtolnay committed Aug 8, 2024
1 parent 8764353 commit c3df337
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test_suite/tests/test_gen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,19 @@ fn test_gen() {
flat: T,
}

#[derive(Serialize, Deserialize)]
#[serde(untagged)]
pub enum Inner<T> {
Builder {
s: T,
#[serde(flatten)]
o: T,
},
Default {
s: T,
},
}

// https://github.com/serde-rs/serde/issues/1804
#[derive(Serialize, Deserialize)]
pub enum Message {
Expand Down

0 comments on commit c3df337

Please sign in to comment.