Remove clear thunk from repeated fields.

This thunk is unused, the preferred spelling for clearing repeated fields is `msg.somefield_mut().clear();`

PiperOrigin-RevId: 648756314
pull/17312/head
Protobuf Team Bot 8 months ago committed by Copybara-Service
parent 27d8304aa8
commit 2f1e142a83
  1. 9
      src/google/protobuf/compiler/rust/accessors/repeated_field.cc

@ -63,7 +63,6 @@ void RepeatedField::InMsgImpl(Context& ctx, const FieldDescriptor& field,
)rs"); )rs");
} }
}}, }},
{"clearer_thunk", ThunkName(ctx, field, "clear")},
{"getter_mut", {"getter_mut",
[&] { [&] {
if (accessor_case == AccessorCase::VIEW) { if (accessor_case == AccessorCase::VIEW) {
@ -181,10 +180,8 @@ void RepeatedField::InExternC(Context& ctx,
fn $move_setter_thunk$(raw_msg: $pbr$::RawMessage, value: $pbr$::RawRepeatedField); fn $move_setter_thunk$(raw_msg: $pbr$::RawMessage, value: $pbr$::RawRepeatedField);
)rs"); )rs");
} }
}}, }}},
{"clearer_thunk", ThunkName(ctx, field, "clear")}},
R"rs( R"rs(
fn $clearer_thunk$(raw_msg: $pbr$::RawMessage);
$getter$ $getter$
)rs"); )rs");
} }
@ -226,7 +223,6 @@ void RepeatedField::InThunkCc(Context& ctx,
{"ElementType", CppElementType(field)}, {"ElementType", CppElementType(field)},
{"ContainerType", CppRepeatedContainerType(field)}, {"ContainerType", CppRepeatedContainerType(field)},
{"QualifiedMsg", cpp::QualifiedClassName(field.containing_type())}, {"QualifiedMsg", cpp::QualifiedClassName(field.containing_type())},
{"clearer_thunk", ThunkName(ctx, field, "clear")},
{"getter_thunk", ThunkName(ctx, field, "get")}, {"getter_thunk", ThunkName(ctx, field, "get")},
{"getter_mut_thunk", ThunkName(ctx, field, "get_mut")}, {"getter_mut_thunk", ThunkName(ctx, field, "get_mut")},
{"repeated_copy_from_thunk", {"repeated_copy_from_thunk",
@ -236,9 +232,6 @@ void RepeatedField::InThunkCc(Context& ctx,
[&] { [&] {
ctx.Emit( ctx.Emit(
R"cc( R"cc(
void $clearer_thunk$($QualifiedMsg$* msg) {
msg->clear_$field$();
}
$ContainerType$<$ElementType$>* $getter_mut_thunk$($QualifiedMsg$* msg) { $ContainerType$<$ElementType$>* $getter_mut_thunk$($QualifiedMsg$* msg) {
return msg->mutable_$field$(); return msg->mutable_$field$();
} }

Loading…
Cancel
Save