mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-10-24 04:35:02 +00:00
Enforce unit struct for #[serde(other)]
This commit is contained in:
1 parent
0156f1355a
commit
dcd2232f69
2 files changed
+4
-5
No files matched your search
@@ -124,15 +124,14 @@ fn check_identifier(cx: &Ctxt, cont: &Container) {
|
||||
}
|
||||
|
||||
// Variant with `other` attribute must be the last one.
|
||||
(Style::Unit, Identifier::Field, true, _) | (_, Identifier::No, true, _) => {
|
||||
(Style::Unit, Identifier::Field, true, _) | (Style::Unit, Identifier::No, true, _) => {
|
||||
if i < variants.len() - 1 {
|
||||
cx.error("#[serde(other)] must be the last variant");
|
||||
}
|
||||
}
|
||||
|
||||
// Variant with `other` attribute must be a unit variant.
|
||||
// TODO: Only in field_identifier ?
|
||||
(_, Identifier::Field, true, _) => {
|
||||
(_, Identifier::Field, true, _) | (_, Identifier::No, true, _) => {
|
||||
cx.error("#[serde(other)] must be on a unit variant");
|
||||
},
|
||||
|
||||
|
||||
Reference in new issue
Block a user