cleanup whitespace in message.cc
PiperOrigin-RevId: 582344807
diff --git a/src/google/protobuf/compiler/rust/message.cc b/src/google/protobuf/compiler/rust/message.cc
index cd01d7a..c70af33 100644
--- a/src/google/protobuf/compiler/rust/message.cc
+++ b/src/google/protobuf/compiler/rust/message.cc
@@ -216,74 +216,70 @@
return;
}
msg.Emit(
- {
- {"Msg", msg.desc().name()},
- {"Msg::new", [&] { MessageNew(msg); }},
- {"Msg::serialize", [&] { MessageSerialize(msg); }},
- {"Msg::deserialize", [&] { MessageDeserialize(msg); }},
- {"Msg::drop", [&] { MessageDrop(msg); }},
- {"Msg_externs", [&] { MessageExterns(msg); }},
- {"accessor_fns",
- [&] {
- for (int i = 0; i < msg.desc().field_count(); ++i) {
- auto field = msg.WithDesc(*msg.desc().field(i));
- msg.Emit({{"comment", FieldInfoComment(field)}}, R"rs(
+ {{"Msg", msg.desc().name()},
+ {"Msg::new", [&] { MessageNew(msg); }},
+ {"Msg::serialize", [&] { MessageSerialize(msg); }},
+ {"Msg::deserialize", [&] { MessageDeserialize(msg); }},
+ {"Msg::drop", [&] { MessageDrop(msg); }},
+ {"Msg_externs", [&] { MessageExterns(msg); }},
+ {"accessor_fns",
+ [&] {
+ for (int i = 0; i < msg.desc().field_count(); ++i) {
+ auto field = msg.WithDesc(*msg.desc().field(i));
+ msg.Emit({{"comment", FieldInfoComment(field)}}, R"rs(
// $comment$
)rs");
- GenerateAccessorMsgImpl(field);
- msg.printer().PrintRaw("\n");
- }
- }},
- {"oneof_accessor_fns",
- [&] {
- for (int i = 0; i < msg.desc().real_oneof_decl_count(); ++i) {
- GenerateOneofAccessors(
- msg.WithDesc(*msg.desc().real_oneof_decl(i)));
- msg.printer().PrintRaw("\n");
- }
- }},
- {"accessor_externs",
- [&] {
- for (int i = 0; i < msg.desc().field_count(); ++i) {
- GenerateAccessorExternC(msg.WithDesc(*msg.desc().field(i)));
- msg.printer().PrintRaw("\n");
- }
- }},
- {"oneof_externs",
- [&] {
- for (int i = 0; i < msg.desc().real_oneof_decl_count(); ++i) {
- GenerateOneofExternC(
- msg.WithDesc(*msg.desc().real_oneof_decl(i)));
- msg.printer().PrintRaw("\n");
- }
- }},
- {"nested_msgs",
- [&] {
- // If we have no nested types or oneofs, bail out without emitting
- // an empty mod SomeMsg_.
- if (msg.desc().nested_type_count() == 0 &&
- msg.desc().real_oneof_decl_count() == 0) {
- return;
- }
- msg.Emit({{"Msg", msg.desc().name()},
- {"nested_msgs",
- [&] {
- for (int i = 0; i < msg.desc().nested_type_count();
- ++i) {
- auto nested_msg =
- msg.WithDesc(msg.desc().nested_type(i));
- GenerateRs(nested_msg);
- }
- }},
- {"oneofs",
- [&] {
- for (int i = 0;
- i < msg.desc().real_oneof_decl_count(); ++i) {
- GenerateOneofDefinition(
- msg.WithDesc(*msg.desc().real_oneof_decl(i)));
- }
- }}},
- R"rs(
+ GenerateAccessorMsgImpl(field);
+ msg.printer().PrintRaw("\n");
+ }
+ }},
+ {"oneof_accessor_fns",
+ [&] {
+ for (int i = 0; i < msg.desc().real_oneof_decl_count(); ++i) {
+ GenerateOneofAccessors(
+ msg.WithDesc(*msg.desc().real_oneof_decl(i)));
+ msg.printer().PrintRaw("\n");
+ }
+ }},
+ {"accessor_externs",
+ [&] {
+ for (int i = 0; i < msg.desc().field_count(); ++i) {
+ GenerateAccessorExternC(msg.WithDesc(*msg.desc().field(i)));
+ msg.printer().PrintRaw("\n");
+ }
+ }},
+ {"oneof_externs",
+ [&] {
+ for (int i = 0; i < msg.desc().real_oneof_decl_count(); ++i) {
+ GenerateOneofExternC(msg.WithDesc(*msg.desc().real_oneof_decl(i)));
+ msg.printer().PrintRaw("\n");
+ }
+ }},
+ {"nested_msgs",
+ [&] {
+ // If we have no nested types or oneofs, bail out without emitting
+ // an empty mod SomeMsg_.
+ if (msg.desc().nested_type_count() == 0 &&
+ msg.desc().real_oneof_decl_count() == 0) {
+ return;
+ }
+ msg.Emit(
+ {{"Msg", msg.desc().name()},
+ {"nested_msgs",
+ [&] {
+ for (int i = 0; i < msg.desc().nested_type_count(); ++i) {
+ auto nested_msg = msg.WithDesc(msg.desc().nested_type(i));
+ GenerateRs(nested_msg);
+ }
+ }},
+ {"oneofs",
+ [&] {
+ for (int i = 0; i < msg.desc().real_oneof_decl_count(); ++i) {
+ GenerateOneofDefinition(
+ msg.WithDesc(*msg.desc().real_oneof_decl(i)));
+ }
+ }}},
+ R"rs(
#[allow(non_snake_case)]
pub mod $Msg$_ {
$nested_msgs$
@@ -291,9 +287,9 @@
$oneofs$
} // mod $Msg$_
)rs");
- }},
- {"accessor_fns_for_views", [&] {AccessorsForViewOrMut(msg, false);}},
- {"accessor_fns_for_muts", [&] {AccessorsForViewOrMut(msg, true);}}},
+ }},
+ {"accessor_fns_for_views", [&] { AccessorsForViewOrMut(msg, false); }},
+ {"accessor_fns_for_muts", [&] { AccessorsForViewOrMut(msg, true); }}},
R"rs(
#[allow(non_camel_case_types)]
// TODO: Implement support for debug redaction