about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--library/std/src/path.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/library/std/src/path.rs b/library/std/src/path.rs
index 392c815ef28..e8aa9e27c0f 100644
--- a/library/std/src/path.rs
+++ b/library/std/src/path.rs
@@ -2087,9 +2087,12 @@ impl Path {
     /// assert!(path.starts_with("/etc"));
     /// assert!(path.starts_with("/etc/"));
     /// assert!(path.starts_with("/etc/passwd"));
-    /// assert!(path.starts_with("/etc/passwd/"));
+    /// assert!(path.starts_with("/etc/passwd/")); // extra slash(es) is okay
     ///
     /// assert!(!path.starts_with("/e"));
+    /// assert!(!path.starts_with("/etc/passwd.txt"));
+    ///
+    /// assert!(!Path::new("/etc/foo.rs").starts_with("/etc/foo"));
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn starts_with<P: AsRef<Path>>(&self, base: P) -> bool {