Skip to content

Commit d8fca9e

Browse files
committed
Use with in Symbol trait methods.
Instead of `as_str()`, which unnecessarily involves `LocalInternedString`.
1 parent fa0f7d0 commit d8fca9e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/libsyntax_pos/symbol.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -934,19 +934,19 @@ impl Symbol {
934934

935935
impl fmt::Debug for Symbol {
936936
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
937-
fmt::Display::fmt(self, f)
937+
self.with(|str| fmt::Display::fmt(&str, f))
938938
}
939939
}
940940

941941
impl fmt::Display for Symbol {
942942
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
943-
fmt::Display::fmt(&self.as_str(), f)
943+
self.with(|str| fmt::Display::fmt(&str, f))
944944
}
945945
}
946946

947947
impl Encodable for Symbol {
948948
fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
949-
s.emit_str(&self.as_str())
949+
self.with(|string| s.emit_str(string))
950950
}
951951
}
952952

0 commit comments

Comments
 (0)