about summary refs log tree commit diff
diff options
context:
space:
mode:
authorIvan Tham <pickfire@riseup.net>2020-08-08 18:01:34 +0800
committerGitHub <noreply@github.com>2020-08-08 18:01:34 +0800
commit6dffd2d18e3bb52ec967abef45f7e524a7f91ad9 (patch)
tree46ae8c64b4b68d93398c59668d3c2541aa1036f7
parentd19d7e27552b8da17932384b8db53927a1f4e00e (diff)
downloadrust-6dffd2d18e3bb52ec967abef45f7e524a7f91ad9.tar.gz
rust-6dffd2d18e3bb52ec967abef45f7e524a7f91ad9.zip
Separate example for Path strip_prefix
-rw-r--r--library/std/src/path.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/library/std/src/path.rs b/library/std/src/path.rs
index 392c815ef28..09bef61f017 100644
--- a/library/std/src/path.rs
+++ b/library/std/src/path.rs
@@ -2053,8 +2053,9 @@ impl Path {
     /// assert_eq!(path.strip_prefix("/test/"), Ok(Path::new("haha/foo.txt")));
     /// assert_eq!(path.strip_prefix("/test/haha/foo.txt"), Ok(Path::new("")));
     /// assert_eq!(path.strip_prefix("/test/haha/foo.txt/"), Ok(Path::new("")));
-    /// assert_eq!(path.strip_prefix("test").is_ok(), false);
-    /// assert_eq!(path.strip_prefix("/haha").is_ok(), false);
+    ///
+    /// assert!(path.strip_prefix("test").is_err());
+    /// assert!(path.strip_prefix("/haha").is_err());
     ///
     /// let prefix = PathBuf::from("/test/");
     /// assert_eq!(path.strip_prefix(prefix), Ok(Path::new("haha/foo.txt")));