Skip to content

Commit 61b4b95

Browse files
authored
style(prost-build): Use enum getter (#1238)
Use enum getter function to compare enum values instead of `i32` values.
1 parent 60abdc9 commit 61b4b95

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

prost-build/src/code_generator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ impl<'b> CodeGenerator<'_, 'b> {
383383

384384
fn append_field(&mut self, fq_message_name: &str, field: &Field) {
385385
let type_ = field.descriptor.r#type();
386-
let repeated = field.descriptor.label == Some(Label::Repeated as i32);
386+
let repeated = field.descriptor.label() == Label::Repeated;
387387
let deprecated = self.deprecated(&field.descriptor);
388388
let optional = self.optional(&field.descriptor);
389389
let boxed = self

prost-build/src/context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ impl<'a> Context<'a> {
141141
oneof: Option<&str>,
142142
field: &FieldDescriptorProto,
143143
) -> bool {
144-
let repeated = field.label == Some(Label::Repeated as i32);
144+
let repeated = field.label() == Label::Repeated;
145145
let fd_type = field.r#type();
146146
if !repeated
147147
&& (fd_type == Type::Message || fd_type == Type::Group)

0 commit comments

Comments
 (0)