From a818029b8d8bdf60bff8b9caf16744ff46346631 Mon Sep 17 00:00:00 2001 From: Xinye Tao Date: Tue, 25 Feb 2025 13:37:55 +0800 Subject: [PATCH] harden ref mut according to edition 2024 Signed-off-by: Xinye Tao --- prost-build/src/message_graph.rs | 10 +++------- prost-derive/src/lib.rs | 2 +- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/prost-build/src/message_graph.rs b/prost-build/src/message_graph.rs index 7d43aeceb..92486c742 100644 --- a/prost-build/src/message_graph.rs +++ b/prost-build/src/message_graph.rs @@ -41,15 +41,11 @@ impl MessageGraph { } fn get_or_insert_index(&mut self, msg_name: String) -> NodeIndex { - let MessageGraph { - ref mut index, - ref mut graph, - .. - } = *self; assert_eq!(b'.', msg_name.as_bytes()[0]); - *index + *self + .index .entry(msg_name.clone()) - .or_insert_with(|| graph.add_node(msg_name)) + .or_insert_with(|| self.graph.add_node(msg_name)) } /// Adds message to graph IFF it contains a non-repeated field containing another message. diff --git a/prost-derive/src/lib.rs b/prost-derive/src/lib.rs index bc56d2249..bd5f32357 100644 --- a/prost-derive/src/lib.rs +++ b/prost-derive/src/lib.rs @@ -441,7 +441,7 @@ fn try_oneof(input: TokenStream) -> Result { quote! { #tag => { match field { - ::core::option::Option::Some(#ident::#variant_ident(ref mut value)) => { + &mut ::core::option::Option::Some(#ident::#variant_ident(ref mut value)) => { #merge }, _ => {