about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYuki Okushi <huyuumi.dev@gmail.com>2020-08-09 06:41:23 +0900
committerGitHub <noreply@github.com>2020-08-09 06:41:23 +0900
commitcbc6914baaf2e6d6549294bd2021dc9eec83a215 (patch)
tree546d8421e5611f4abe7fcf6773aabeb3af78e91e
parentc85075d522c908f3aaf3716134027c91871930ea (diff)
parent06cf40f8a160698aa894507d9c7c9cd29fdbdc66 (diff)
downloadrust-cbc6914baaf2e6d6549294bd2021dc9eec83a215.tar.gz
rust-cbc6914baaf2e6d6549294bd2021dc9eec83a215.zip
Rollup merge of #75262 - pickfire:patch-6, r=jyn514
Show multi extension example for Path in doctests
-rw-r--r--library/std/src/path.rs10
1 files changed, 4 insertions, 6 deletions
diff --git a/library/std/src/path.rs b/library/std/src/path.rs
index 392c815ef28..f26a0939892 100644
--- a/library/std/src/path.rs
+++ b/library/std/src/path.rs
@@ -2140,9 +2140,8 @@ impl Path {
     /// ```
     /// use std::path::Path;
     ///
-    /// let path = Path::new("foo.rs");
-    ///
-    /// assert_eq!("foo", path.file_stem().unwrap());
+    /// assert_eq!("foo", Path::new("foo.rs").file_stem().unwrap());
+    /// assert_eq!("foo.tar", Path::new("foo.tar.gz").file_stem().unwrap());
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn file_stem(&self) -> Option<&OsStr> {
@@ -2166,9 +2165,8 @@ impl Path {
     /// ```
     /// use std::path::Path;
     ///
-    /// let path = Path::new("foo.rs");
-    ///
-    /// assert_eq!("rs", path.extension().unwrap());
+    /// assert_eq!("rs", Path::new("foo.rs").extension().unwrap());
+    /// assert_eq!("gz", Path::new("foo.tar.gz").extension().unwrap());
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn extension(&self) -> Option<&OsStr> {