From 6fdcc0beb452a113577e8288e7faf29fae5613f4 Mon Sep 17 00:00:00 2001 From: Protobuf Team Bot Date: Wed, 31 Jul 2024 12:18:11 -0700 Subject: [PATCH] Remove clear_and_parse inherent method in favor of a trait fn. PiperOrigin-RevId: 658098868 --- src/google/protobuf/compiler/rust/message.cc | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/google/protobuf/compiler/rust/message.cc b/src/google/protobuf/compiler/rust/message.cc index 4665f44bf6f7..cebd031092a3 100644 --- a/src/google/protobuf/compiler/rust/message.cc +++ b/src/google/protobuf/compiler/rust/message.cc @@ -1012,7 +1012,7 @@ void GenerateRs(Context& ctx, const Descriptor& msg) { impl $pb$::ClearAndParse for $Msg$ { fn clear_and_parse(&mut self, data: &[u8]) -> Result<(), $pb$::ParseError> { - self.clear_and_parse(data) + $Msg::clear_and_parse$ } } @@ -1235,12 +1235,9 @@ void GenerateRs(Context& ctx, const Descriptor& msg) { $raw_arena_getter_for_message$ - pub fn clear_and_parse(&mut self, data: &[u8]) -> Result<(), $pb$::ParseError> { - $Msg::clear_and_parse$ - } pub fn parse(data: &[u8]) -> Result { let mut msg = Self::new(); - msg.clear_and_parse(data).map(|_| msg) + $pb$::ClearAndParse::clear_and_parse(&mut msg, data).map(|_| msg) } pub fn as_view(&self) -> $Msg$View {