diff options
| author | Nicholas Nethercote <nnethercote@mozilla.com> | 2019-10-18 09:24:56 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <nnethercote@mozilla.com> | 2019-10-18 13:26:03 +1100 |
| commit | d8fca9ee4ea9399dc8244f744f0198821d233ecf (patch) | |
| tree | 0670f80f3fb32588e8ca53922762da197611df68 /src/libsyntax_pos | |
| parent | fa0f7d0080d8e7e9eb20aa9cbf8013f96c81287f (diff) | |
| download | rust-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.rs | 6 |
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)) } } |
