From e0dce6ec8df23adbe7c45c07ed080caf3d81a14b Mon Sep 17 00:00:00 2001 From: Nika Layzell Date: Sun, 3 Jul 2022 00:54:17 -0400 Subject: [PATCH] proc_macro: Specialize Punct::to_string This was removed in a previous part, however it should be specialized for to_string performance and consistency. --- library/proc_macro/src/lib.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/library/proc_macro/src/lib.rs b/library/proc_macro/src/lib.rs index 9ab5061c6680..80f28a502965 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")]