about summary refs log tree commit diff
path: root/library/proc_macro/src
diff options
context:
space:
mode:
authorNika Layzell <nika@thelayzells.com>2022-07-03 00:54:17 -0400
committerNika Layzell <nika@thelayzells.com>2022-07-18 12:59:14 -0400
commite0dce6ec8df23adbe7c45c07ed080caf3d81a14b (patch)
tree10ba7ab382e886f2bc6c727240bd97d678563eea /library/proc_macro/src
parent17e96879d8ea81ff9b4194ad6529df1a5784a70c (diff)
downloadrust-e0dce6ec8df23adbe7c45c07ed080caf3d81a14b.tar.gz
rust-e0dce6ec8df23adbe7c45c07ed080caf3d81a14b.zip
proc_macro: Specialize Punct::to_string
This was removed in a previous part, however it should be specialized for
to_string performance and consistency.
Diffstat (limited to 'library/proc_macro/src')
-rw-r--r--library/proc_macro/src/lib.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/library/proc_macro/src/lib.rs b/library/proc_macro/src/lib.rs
index 9ab5061c668..80f28a50296 100644
--- a/library/proc_macro/src/lib.rs
+++ b/library/proc_macro/src/lib.rs
@@ -1004,6 +1004,13 @@ impl Punct {
     }
 }
 
+#[stable(feature = "proc_macro_lib2", since = "1.29.0")]
+impl ToString for Punct {
+    fn to_string(&self) -> String {
+        self.as_char().to_string()
+    }
+}
+
 /// Prints the punctuation character as a string that should be losslessly convertible
 /// back into the same character.
 #[stable(feature = "proc_macro_lib2", since = "1.29.0")]