Skip to content

UnionAsMapOptions.omit_nulls and .omit_defaults are never read #36

Description

@lalinsky

UnionAsMapOptions declares two fields that are never read, in either direction:

pub const UnionAsMapOptions = struct {
    key: union(enum) { field_name, field_name_prefix: u8, field_index },
    omit_nulls: bool = true,
    omit_defaults: bool = false,
};

grep for omit_nulls/omit_defaults in src/union.zig finds only these two declarations. They are copy-paste from StructAsMapOptions, where both are genuinely used by isStructFieldUsed on the encode side.

They are also meaningless here: packUnionAsMap always writes packMapHeader(writer, 1) — exactly one entry, the active variant — so there is nothing to omit.

Same category as the dead surface removed in #27. Two lines, and no behaviour change since nothing reads them.

Noted while adding skip_unknown_fields in #28 and left out to keep that PR focused.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions