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 {
20312031 /// assert!(path.starts_with("/etc"));
20322032 /// assert!(path.starts_with("/etc/"));
20332033 /// 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
20352036 ///
20362037 /// 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"));
20372041 /// ```
20382042 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
20392043 pub fn starts_with < P : AsRef < Path > > ( & self , base : P ) -> bool {
You can’t perform that action at this time.
0 commit comments