diff options
| author | bors <bors@rust-lang.org> | 2017-01-10 14:08:21 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2017-01-10 14:08:21 +0000 |
| commit | 7bffede97cf58f7159e261eac592f9cf88ce209d (patch) | |
| tree | ffa2c2c7fbc25c4c6e6684d28f98331c78e2779d /src/libstd/path.rs | |
| parent | 78c892d8659ae1cf1717b9a8a4bb407d8667f672 (diff) | |
| parent | db74f11f78e13fe2bbfb4e284c832d520fa5cf87 (diff) | |
| download | rust-7bffede97cf58f7159e261eac592f9cf88ce209d.tar.gz rust-7bffede97cf58f7159e261eac592f9cf88ce209d.zip | |
Auto merge of #38958 - sanxiyn:rollup, r=sanxiyn
Rollup of 11 pull requests - Successful merges: #38606, #38607, #38623, #38664, #38799, #38816, #38836, #38839, #38841, #38849, #38874 - Failed merges: #38845
Diffstat (limited to 'src/libstd/path.rs')
| -rw-r--r-- | src/libstd/path.rs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/libstd/path.rs b/src/libstd/path.rs index d13baea40a9..3f9bf70adde 100644 --- a/src/libstd/path.rs +++ b/src/libstd/path.rs @@ -1428,8 +1428,8 @@ impl Path { /// ``` /// use std::path::Path; /// - /// let path_str = Path::new("foo.txt").to_str(); - /// assert_eq!(path_str, Some("foo.txt")); + /// let path = Path::new("foo.txt"); + /// assert_eq!(path.to_str(), Some("foo.txt")); /// ``` #[stable(feature = "rust1", since = "1.0.0")] pub fn to_str(&self) -> Option<&str> { @@ -1444,12 +1444,17 @@ impl Path { /// /// # Examples /// + /// Calling `to_string_lossy` on a `Path` with valid unicode: + /// /// ``` /// use std::path::Path; /// - /// let path_str = Path::new("foo.txt").to_string_lossy(); - /// assert_eq!(path_str, "foo.txt"); + /// let path = Path::new("foo.txt"); + /// assert_eq!(path.to_string_lossy(), "foo.txt"); /// ``` + /// + /// Had `os_str` contained invalid unicode, the `to_string_lossy` call might + /// have returned `"fo�.txt"`. #[stable(feature = "rust1", since = "1.0.0")] pub fn to_string_lossy(&self) -> Cow<str> { self.inner.to_string_lossy() |
