Skip to content

Commit

Permalink
Revert "Default to packed repeated primitive fields in proto3."
Browse files Browse the repository at this point in the history
This reverts commit 0e3bf94.
  • Loading branch information
stepancheg committed Feb 25, 2024
1 parent 869670a commit 3b8d84e
Showing 1 changed file with 1 addition and 30 deletions.
31 changes: 1 addition & 30 deletions protobuf-codegen/src/gen/field/mod.rs
Expand Up @@ -188,36 +188,7 @@ impl<'a> FieldGen<'a> {

FieldKind::Repeated(RepeatedField {
elem,
packed: field
.field
.proto()
.options
.get_or_default()
.packed
.unwrap_or(match field.message.scope.file_scope.syntax() {
Syntax::Proto2 => false,
// in proto3, repeated primitive types are packed by default
Syntax::Proto3 => match field.field.proto().type_() {
Type::TYPE_DOUBLE
| Type::TYPE_FLOAT
| Type::TYPE_INT64
| Type::TYPE_UINT64
| Type::TYPE_INT32
| Type::TYPE_FIXED64
| Type::TYPE_FIXED32
| Type::TYPE_BOOL
| Type::TYPE_UINT32
| Type::TYPE_SFIXED32
| Type::TYPE_SFIXED64
| Type::TYPE_SINT32
| Type::TYPE_SINT64 => true,
Type::TYPE_STRING
| Type::TYPE_GROUP
| Type::TYPE_MESSAGE
| Type::TYPE_BYTES
| Type::TYPE_ENUM => false,
},
}),
packed: field.field.proto().options.get_or_default().packed(),
})
}
RuntimeFieldType::Singular(..) => {
Expand Down

0 comments on commit 3b8d84e

Please sign in to comment.