dropbox / pb-jelly

A protobuf code generation framework for the Rust language developed at Dropbox.
Apache License 2.0
611 stars 25 forks source link

Avoid extra logic for oneofs with only 1 possible value #133

Closed cyang1 closed 2 years ago

cyang1 commented 2 years ago

Fixes an unreachable pattern compiler warning that occurs for non-nullable oneofs with only one possible variant.

nipunn1313 commented 2 years ago

Add a test!

cyang1 commented 2 years ago

I was looking at that, but it's not really clear to me how the pb-test protos are structured. I could toss something into an arbitrarily chosen one of those, but that seemed to me like it would cause more confusion than it would help.

nipunn1313 commented 2 years ago

Yeah throw one in either pbtest2.proto or pbtest3.proto.

It'll help - currently there's no validation that such a case even compiles, let alone executes correctly. Tests that prove it compiles would be great. It also has this (secretly selfish) benefit, that we can see some example generated code in the PR

nipunn1313 commented 2 years ago

Cool! Lg! Add a changelog entry and merge it!