1
Fork 0

proc_macro: Specialize Punct::to_string

This was removed in a previous part, however it should be specialized for
to_string performance and consistency.
This commit is contained in:
Nika Layzell 2022-07-03 00:54:17 -04:00
parent 17e96879d8
commit e0dce6ec8d

View file

@ -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")]