mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
Add additonal case for Path starts with
Show what happens if there is an extra extension
This commit is contained in:
parent
d19d7e2755
commit
e7e41a8465
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user