Skip to content

chore: remove dead UnionAsMapOptions fields - #42

Merged
lalinsky merged 1 commit into
mainfrom
chore/remove-dead-union-options
Sep 5, 2026
Merged

chore: remove dead UnionAsMapOptions fields#42
lalinsky merged 1 commit into
mainfrom
chore/remove-dead-union-options

Conversation

@lalinsky

@lalinsky lalinsky commented Sep 5, 2026

Copy link
Copy Markdown
Owner

Fixes #36.

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

Both are copy-paste from StructAsMapOptions, where they are genuinely used by isStructFieldUsed on the encode side. Here nothing consults them in either direction.

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

Same category as the dead surface removed in #27. No behaviour change, since nothing read them.

Breaking only for code that set them explicitly, which could only ever have been a no-op. Recorded in the changelog under Removed.

zig build test: 183/183 pass.

Noticed while adding skip_unknown_fields in #28 and deferred to keep that PR focused.

omit_nulls and omit_defaults were declared on UnionAsMapOptions and never read,
in either direction. 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), one entry for the active variant, so there is nothing
to omit.

Same category as the surface removed in #27, and no behaviour change since
nothing consulted them.
@coderabbitai

coderabbitai Bot commented Sep 5, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 17 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Team

Run ID: 9f9974df-b246-4b9e-b69d-d5d6f8554f99

📥 Commits

Reviewing files that changed from the base of the PR and between db7dc86 and 1881559.

📒 Files selected for processing (2)
  • CHANGELOG.md
  • src/union.zig

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@lalinsky
lalinsky merged commit 52b624d into main Sep 5, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UnionAsMapOptions.omit_nulls and .omit_defaults are never read

1 participant