diff options
| author | Cameron Steffen <cam.steffen94@gmail.com> | 2022-10-27 16:14:48 -0500 |
|---|---|---|
| committer | Cameron Steffen <cam.steffen94@gmail.com> | 2022-10-28 16:42:47 -0500 |
| commit | 298253af98db70ce5dd0294698dfb89cb3bd09ab (patch) | |
| tree | 5f7a4b17e3c77d739d047db9a1ec5f48acefaaba /compiler/rustc_span/src | |
| parent | 0da281b6068a7d889ae89a9bd8991284cc9b7535 (diff) | |
| download | rust-298253af98db70ce5dd0294698dfb89cb3bd09ab.tar.gz rust-298253af98db70ce5dd0294698dfb89cb3bd09ab.zip | |
Specialize ToString for Symbol
Diffstat (limited to 'compiler/rustc_span/src')
| -rw-r--r-- | compiler/rustc_span/src/symbol.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index 3fe79370c37..7f16da52b44 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -1901,6 +1901,13 @@ impl fmt::Display for Symbol { } } +// takes advantage of `str::to_string` specialization +impl ToString for Symbol { + fn to_string(&self) -> String { + self.as_str().to_string() + } +} + impl<S: Encoder> Encodable<S> for Symbol { default fn encode(&self, s: &mut S) { s.emit_str(self.as_str()); |
