Use with
in Symbol
trait methods.
Instead of `as_str()`, which unnecessarily involves `LocalInternedString`.
This commit is contained in:
parent
fa0f7d0080
commit
d8fca9ee4e
1 changed files with 3 additions and 3 deletions
|
@ -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))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue