Skip to content

Commit d86ff17

Browse files
committed
Reset formatting options to display each token
1 parent a491780 commit d86ff17

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/fallback.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -222,13 +222,13 @@ impl Display for TokenStream {
222222
}
223223
joint = false;
224224
match tt {
225-
TokenTree::Group(tt) => Display::fmt(tt, f),
226-
TokenTree::Ident(tt) => Display::fmt(tt, f),
225+
TokenTree::Group(tt) => write!(f, "{}", tt),
226+
TokenTree::Ident(tt) => write!(f, "{}", tt),
227227
TokenTree::Punct(tt) => {
228228
joint = tt.spacing() == Spacing::Joint;
229-
Display::fmt(tt, f)
229+
write!(f, "{}", tt)
230230
}
231-
TokenTree::Literal(tt) => Display::fmt(tt, f),
231+
TokenTree::Literal(tt) => write!(f, "{}", tt),
232232
}?;
233233
}
234234

tests/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,7 @@ fn test_debug_ident() {
722722
fn test_display_tokenstream() {
723723
let tts = TokenStream::from_str("[a + 1]").unwrap();
724724
assert_eq!(format!("{tts}"), "[a + 1]");
725-
assert_eq!(format!("{tts:-^5}"), "[--a-- --+-- --1--]"); // FIXME
725+
assert_eq!(format!("{tts:-^5}"), "[a + 1]");
726726
}
727727

728728
#[test]

0 commit comments

Comments
 (0)