From 0fcdad044f330f4c32e2f3b1230271669d1951ea Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Tue, 12 Dec 2023 14:42:22 -0800 Subject: [PATCH] Support punctuated Pairs iterator in snapshot tests --- tests/debug/mod.rs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/tests/debug/mod.rs b/tests/debug/mod.rs index caf9eed804..707de0e2f0 100644 --- a/tests/debug/mod.rs +++ b/tests/debug/mod.rs @@ -11,7 +11,7 @@ use proc_macro2::{Ident, Literal, TokenStream}; use ref_cast::RefCast; use std::fmt::{self, Debug}; use std::ops::Deref; -use syn::punctuated::Punctuated; +use syn::punctuated::{self, Punctuated}; #[derive(RefCast)] #[repr(transparent)] @@ -124,6 +124,22 @@ where } } +impl<'a, T, P> Debug for Lite> +where + Lite: Debug, + P: Debug, +{ + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + let mut list = formatter.debug_list(); + for pair in self.value.clone() { + let (node, punct) = pair.into_tuple(); + list.entry(Lite(node)); + list.entries(punct); + } + list.finish() + } +} + struct Present; impl Debug for Present {