Skip to content

Commit 66848ac

Browse files
committed
Revert "Default to packed repeated primitive fields in proto3."
This reverts commit 1467b81.
1 parent 939b77e commit 66848ac

File tree

1 file changed

+1
-30
lines changed
  • protobuf-codegen/src/gen/field

1 file changed

+1
-30
lines changed

protobuf-codegen/src/gen/field/mod.rs

+1-30
Original file line numberDiff line numberDiff line change
@@ -188,36 +188,7 @@ impl<'a> FieldGen<'a> {
188188

189189
FieldKind::Repeated(RepeatedField {
190190
elem,
191-
packed: field
192-
.field
193-
.proto()
194-
.options
195-
.get_or_default()
196-
.packed
197-
.unwrap_or(match field.message.scope.file_scope.syntax() {
198-
Syntax::Proto2 => false,
199-
// in proto3, repeated primitive types are packed by default
200-
Syntax::Proto3 => match field.field.proto().type_() {
201-
Type::TYPE_DOUBLE
202-
| Type::TYPE_FLOAT
203-
| Type::TYPE_INT64
204-
| Type::TYPE_UINT64
205-
| Type::TYPE_INT32
206-
| Type::TYPE_FIXED64
207-
| Type::TYPE_FIXED32
208-
| Type::TYPE_BOOL
209-
| Type::TYPE_UINT32
210-
| Type::TYPE_SFIXED32
211-
| Type::TYPE_SFIXED64
212-
| Type::TYPE_SINT32
213-
| Type::TYPE_SINT64 => true,
214-
Type::TYPE_STRING
215-
| Type::TYPE_GROUP
216-
| Type::TYPE_MESSAGE
217-
| Type::TYPE_BYTES
218-
| Type::TYPE_ENUM => false,
219-
},
220-
}),
191+
packed: field.field.proto().options.get_or_default().packed(),
221192
})
222193
}
223194
RuntimeFieldType::Singular(..) => {

0 commit comments

Comments
 (0)