Rollup merge of #75285 - pickfire:patch-8, r=jonas-schievink

Separate example for Path strip_prefix
This commit is contained in:
Yuki Okushi 2020-08-09 06:41:28 +09:00 committed by GitHub
commit 28ab318f57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2060,8 +2060,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")));