Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/proc-macro-srv/src/token_stream.rs')
-rw-r--r--crates/proc-macro-srv/src/token_stream.rs16
1 files changed, 6 insertions, 10 deletions
diff --git a/crates/proc-macro-srv/src/token_stream.rs b/crates/proc-macro-srv/src/token_stream.rs
index 931ed12c99..e134a47f8c 100644
--- a/crates/proc-macro-srv/src/token_stream.rs
+++ b/crates/proc-macro-srv/src/token_stream.rs
@@ -475,7 +475,7 @@ fn display_token_tree<S>(
}
TokenTree::Punct(Punct { ch, joint, span: _ }) => {
*emit_whitespace = !*joint;
- write!(f, "{ch}")?;
+ write!(f, "{}", *ch as char)?;
}
TokenTree::Ident(Ident { sym, is_raw, span: _ }) => {
if *is_raw {
@@ -745,14 +745,10 @@ mod tests {
use super::*;
#[test]
- fn roundtrip() {
- let token_stream = TokenStream::from_str("struct T {\"string\"}", ()).unwrap();
- assert_eq!(token_stream.to_string(), "struct T {\"string\"}");
- }
-
- #[test]
- fn ident_ts_no_trailing_whitespace_to_string() {
- let token_stream = TokenStream::from_str("this_is_an_ident", ()).unwrap();
- assert_eq!(token_stream.to_string(), "this_is_an_ident");
+ fn ts_to_string() {
+ let token_stream =
+ TokenStream::from_str("{} () [] <> ;/., \"gfhdgfuiofghd\" 0f32 r#\"dff\"# 'r#lt", ())
+ .unwrap();
+ assert_eq!(token_stream.to_string(), "{}()[]<> ;/., \"gfhdgfuiofghd\"0f32 r#\"dff\"#'r#lt");
}
}