Skip to content

Commit e0dce6e

Browse files
committed
proc_macro: Specialize Punct::to_string
This was removed in a previous part, however it should be specialized for to_string performance and consistency.
1 parent 17e9687 commit e0dce6e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

library/proc_macro/src/lib.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,6 +1004,13 @@ impl Punct {
10041004
}
10051005
}
10061006

1007+
#[stable(feature = "proc_macro_lib2", since = "1.29.0")]
1008+
impl ToString for Punct {
1009+
fn to_string(&self) -> String {
1010+
self.as_char().to_string()
1011+
}
1012+
}
1013+
10071014
/// Prints the punctuation character as a string that should be losslessly convertible
10081015
/// back into the same character.
10091016
#[stable(feature = "proc_macro_lib2", since = "1.29.0")]

0 commit comments

Comments
 (0)