diff options
| author | Stepan Koltsov <stepan.koltsov@gmail.com> | 2017-06-12 22:21:53 +0300 |
|---|---|---|
| committer | Stepan Koltsov <stepan.koltsov@gmail.com> | 2017-06-15 20:42:37 +0100 |
| commit | ac96fd77874bb7968b7d82bed5a410d3941bc4c8 (patch) | |
| tree | 57bf556685e5b2c29ef59dd13fb3b45177b66054 /src/libstd/path.rs | |
| parent | ea149b8571d538fc8bb2117e46161d442aef48a4 (diff) | |
| download | rust-ac96fd77874bb7968b7d82bed5a410d3941bc4c8.tar.gz rust-ac96fd77874bb7968b7d82bed5a410d3941bc4c8.zip | |
Avoid allocations in Debug for os_str
Fixes #38879
Diffstat (limited to 'src/libstd/path.rs')
| -rw-r--r-- | src/libstd/path.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libstd/path.rs b/src/libstd/path.rs index e128a4164d7..42a54ed6d75 100644 --- a/src/libstd/path.rs +++ b/src/libstd/path.rs @@ -2281,8 +2281,8 @@ impl AsRef<OsStr> for Path { #[stable(feature = "rust1", since = "1.0.0")] impl fmt::Debug for Path { - fn fmt(&self, formatter: &mut fmt::Formatter) -> Result<(), fmt::Error> { - self.inner.fmt(formatter) + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + fmt::Debug::fmt(&self.inner, formatter) } } @@ -2314,14 +2314,14 @@ pub struct Display<'a> { #[stable(feature = "rust1", since = "1.0.0")] impl<'a> fmt::Debug for Display<'a> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - fmt::Debug::fmt(&self.path.to_string_lossy(), f) + fmt::Debug::fmt(&self.path, f) } } #[stable(feature = "rust1", since = "1.0.0")] impl<'a> fmt::Display for Display<'a> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - fmt::Display::fmt(&self.path.to_string_lossy(), f) + self.path.inner.display(f) } } |
