Skip to content

Commit

Permalink
Use with in Symbol trait methods.
Browse files Browse the repository at this point in the history
Instead of `as_str()`, which unnecessarily involves `LocalInternedString`.
  • Loading branch information
nnethercote committed Oct 18, 2019
1 parent fa0f7d0 commit d8fca9e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/libsyntax_pos/symbol.rs
Expand Up @@ -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))
}
}

Expand Down

0 comments on commit d8fca9e

Please sign in to comment.