We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d19d7e2 commit e7e41a8Copy full SHA for e7e41a8
library/std/src/path.rs
@@ -2087,9 +2087,12 @@ impl Path {
2087
/// assert!(path.starts_with("/etc"));
2088
/// assert!(path.starts_with("/etc/"));
2089
/// assert!(path.starts_with("/etc/passwd"));
2090
- /// assert!(path.starts_with("/etc/passwd/"));
+ /// assert!(path.starts_with("/etc/passwd/")); // extra slash(es) is okay
2091
///
2092
/// assert!(!path.starts_with("/e"));
2093
+ /// assert!(!path.starts_with("/etc/passwd.txt"));
2094
+ ///
2095
+ /// assert!(!Path::new("/etc/foo.rs").starts_with("/etc/foo"));
2096
/// ```
2097
#[stable(feature = "rust1", since = "1.0.0")]
2098
pub fn starts_with<P: AsRef<Path>>(&self, base: P) -> bool {
0 commit comments