Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tuple struct length does not account for skip_serializing_if #1049

Closed
dtolnay opened this issue Sep 9, 2017 · 1 comment
Closed

Tuple struct length does not account for skip_serializing_if #1049

dtolnay opened this issue Sep 9, 2017 · 1 comment
Assignees

Comments

@dtolnay
Copy link
Member

dtolnay commented Sep 9, 2017

#[derive(Serialize)]
struct S {
    a: usize,
    #[serde(skip_serializing_if = "f")]
    b: usize,
}

#[derive(Serialize)]
struct T(usize, #[serde(skip_serializing_if = "f")] usize);

Struct S invokes serialize_struct with a length of 1 or 2 depending on whether the field is skipped. Tuple struct T invokes serialize_tuple_struct with a length of 2 even if the field is later skipped.

@dtolnay dtolnay self-assigned this May 7, 2018
@dtolnay
Copy link
Member Author

dtolnay commented May 8, 2018

Fixed in 67777eb.

@dtolnay dtolnay closed this as completed May 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant