File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -2031,9 +2031,13 @@ impl Path {
2031
2031
/// assert!(path.starts_with("/etc"));
2032
2032
/// assert!(path.starts_with("/etc/"));
2033
2033
/// assert!(path.starts_with("/etc/passwd"));
2034
- /// assert!(path.starts_with("/etc/passwd/"));
2034
+ /// assert!(path.starts_with("/etc/passwd/")); // extra slash is okay
2035
+ /// assert!(path.starts_with("/etc/passwd///")); // multiple extra slashes are okay
2035
2036
///
2036
2037
/// assert!(!path.starts_with("/e"));
2038
+ /// assert!(!path.starts_with("/etc/passwd.txt"));
2039
+ ///
2040
+ /// assert!(!Path::new("/etc/foo.rs").starts_with("/etc/foo"));
2037
2041
/// ```
2038
2042
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
2039
2043
pub fn starts_with < P : AsRef < Path > > ( & self , base : P ) -> bool {
You can’t perform that action at this time.
0 commit comments