-
-
Notifications
You must be signed in to change notification settings - Fork 84
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
serde_with::apply fails to apply attributes to data attributes added in macros. See below error.
use serde_with;
macro_rules! t {
($($param:ident : $ty:ty),*) => {
#[derive(Default)]
#[serde_with::apply(
Option => #[serde(skip_serializing_if = "Option::is_none")],
)]
#[derive(serde::Serialize)]
struct Data {
a: Option<String>,
b: Option<u64>,
c: Option<String>,
$(
pub $param: $ty),*
}
}}
t!(d: Option<bool>);
#[test]
fn t() {
let golden = r#"{}"#;
let data: Data = Default::default();
assert_eq!(serde_json::to_string(&data).unwrap(), golden);
}This fails with
---- t stdout ----
thread 't' panicked at 'assertion failed: `(left == right)`
left: `"{\"d\":null}"`,
right: `"{}"`', doveadm_types/src/lib.rs:34:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working