2018-03-20 22:04:12 +01:00
|
|
|
// Copyright 2018 Serde Developers
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
|
|
|
|
#[macro_use]
|
|
|
|
extern crate serde_derive;
|
|
|
|
|
2018-06-02 22:19:39 -07:00
|
|
|
#[derive(Serialize)]
|
2018-03-20 22:04:12 +01:00
|
|
|
struct Foo {
|
2018-06-02 22:30:55 -07:00
|
|
|
#[serde(flatten, skip_serializing_if = "Option::is_none")]
|
2018-06-02 22:19:39 -07:00
|
|
|
//~^^^ ERROR: #[serde(flatten] can not be combined with #[serde(skip_serializing_if = "...")]
|
2018-03-20 22:04:12 +01:00
|
|
|
other: Option<Other>,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Serialize)]
|
|
|
|
struct Other {
|
2018-06-02 22:30:55 -07:00
|
|
|
x: u32,
|
2018-03-20 22:04:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|