Skip to content

Commit

Permalink
Debug impl for punctuated::Pairs superseded by Punctuated
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Dec 25, 2023
1 parent 3f12d65 commit 131b40b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 19 deletions.
18 changes: 1 addition & 17 deletions tests/debug/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{self, Punctuated};
use syn::punctuated::Punctuated;

#[derive(RefCast)]
#[repr(transparent)]
Expand Down Expand Up @@ -128,22 +128,6 @@ where
}
}

impl<'a, T, P> Debug for Lite<punctuated::Pairs<'a, T, P>>
where
Lite<T>: Debug,
Lite<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.map(Lite));
}
list.finish()
}
}

struct Present;

impl Debug for Present {
Expand Down
4 changes: 2 additions & 2 deletions tests/test_parse_quote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ fn test_pat() {
#[test]
fn test_punctuated() {
let punctuated: Punctuated<Lit, Token![|]> = parse_quote!(true | true);
snapshot!(punctuated.pairs(), @r###"
snapshot!(punctuated, @r###"
[
Lit::Bool {
value: true,
Expand All @@ -126,7 +126,7 @@ fn test_punctuated() {
"###);

let punctuated: Punctuated<Lit, Token![|]> = parse_quote!(true | true |);
snapshot!(punctuated.pairs(), @r###"
snapshot!(punctuated, @r###"
[
Lit::Bool {
value: true,
Expand Down

0 comments on commit 131b40b

Please sign in to comment.