Rollup merge of #75286 - pickfire:patch-9, r=jyn514
Add additional case for Path starts with Show what happens if there is an extra extension
This commit is contained in:
commit
df2da4637f
1 changed files with 5 additions and 1 deletions
|
@ -2031,9 +2031,13 @@ 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 is okay
|
||||
/// assert!(path.starts_with("/etc/passwd///")); // multiple extra slashes are 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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue