From 9eb2e31933454708a083e0963cf691ff0f7f299c Mon Sep 17 00:00:00 2001 From: Kent Ross Date: Thu, 23 May 2024 21:55:36 -0700 Subject: [PATCH] update the other instance of the .tuple_windows() trick to use .duplicates() --- prost-derive/src/lib.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/prost-derive/src/lib.rs b/prost-derive/src/lib.rs index 8b2f1e717..d90559468 100644 --- a/prost-derive/src/lib.rs +++ b/prost-derive/src/lib.rs @@ -90,12 +90,11 @@ fn try_message(input: TokenStream) -> Result { fields.sort_by_key(|(_, field)| field.tags().into_iter().min().unwrap()); let fields = fields; - if let Some((duplicate_tag, _)) = fields + if let Some(duplicate_tag) = fields .iter() .flat_map(|(_, field)| field.tags()) - .sorted_unstable() - .tuple_windows() - .find(|(a, b)| a == b) + .duplicates() + .next() { bail!( "message {} has multiple fields with tag {}",