diff options
| author | Yuki Okushi <huyuumi.dev@gmail.com> | 2020-08-10 09:07:52 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-10 09:07:52 +0900 |
| commit | df2da4637f8f8832b52c736452c51034bf48dd59 (patch) | |
| tree | 482a75f4616ba725639e5e16b60d56c7fec3cf69 | |
| parent | 62e5488198e6de212ff3d6818c8aa448ef770622 (diff) | |
| parent | 4b549fa043486b10673d69ba547522238bb2f25f (diff) | |
| download | rust-df2da4637f8f8832b52c736452c51034bf48dd59.tar.gz rust-df2da4637f8f8832b52c736452c51034bf48dd59.zip | |
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
| -rw-r--r-- | library/std/src/path.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/library/std/src/path.rs b/library/std/src/path.rs index a468f6b4b8d..e3d529df7de 100644 --- a/library/std/src/path.rs +++ b/library/std/src/path.rs @@ -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 { |
