about summary refs log tree commit diff
path: root/src/libsyntax_pos
diff options
context:
space:
mode:
authorNicholas Nethercote <nnethercote@mozilla.com>2019-10-18 09:24:56 +1100
committerNicholas Nethercote <nnethercote@mozilla.com>2019-10-18 13:26:03 +1100
commitd8fca9ee4ea9399dc8244f744f0198821d233ecf (patch)
tree0670f80f3fb32588e8ca53922762da197611df68 /src/libsyntax_pos
parentfa0f7d0080d8e7e9eb20aa9cbf8013f96c81287f (diff)
downloadrust-d8fca9ee4ea9399dc8244f744f0198821d233ecf.tar.gz
rust-d8fca9ee4ea9399dc8244f744f0198821d233ecf.zip
Use `with` in `Symbol` trait methods.
Instead of `as_str()`, which unnecessarily involves `LocalInternedString`.
Diffstat (limited to 'src/libsyntax_pos')
-rw-r--r--src/libsyntax_pos/symbol.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libsyntax_pos/symbol.rs b/src/libsyntax_pos/symbol.rs
index 8845b66a7ce..e4f309259e7 100644
--- a/src/libsyntax_pos/symbol.rs
+++ b/src/libsyntax_pos/symbol.rs
@@ -934,19 +934,19 @@ impl Symbol {
 
 impl fmt::Debug for Symbol {
     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        fmt::Display::fmt(self, f)
+        self.with(|str| fmt::Display::fmt(&str, f))
     }
 }
 
 impl fmt::Display for Symbol {
     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
-        fmt::Display::fmt(&self.as_str(), f)
+        self.with(|str| fmt::Display::fmt(&str, f))
     }
 }
 
 impl Encodable for Symbol {
     fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
-        s.emit_str(&self.as_str())
+        self.with(|string| s.emit_str(string))
     }
 }