Skip to content

Commit

Permalink
Unrolled build for rust-lang#133419
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#133419 - CromFr:add-path-strip_prefix-test-example, r=Amanieu

Added a doc test for std::path::strip_prefix

I was about 90% sure `Path::new("/test/haha/foo.txt").strip_prefix("/te")` would return an Err, but I couldn't find an example to confirm this behaviour.

This should be an easy merge :)
  • Loading branch information
rust-timer authored Nov 26, 2024
2 parents f2abf82 + f3ad32b commit 225744b
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions library/std/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2504,6 +2504,7 @@ impl Path {
/// assert_eq!(path.strip_prefix("/test/haha/foo.txt/"), Ok(Path::new("")));
///
/// assert!(path.strip_prefix("test").is_err());
/// assert!(path.strip_prefix("/te").is_err());
/// assert!(path.strip_prefix("/haha").is_err());
///
/// let prefix = PathBuf::from("/test/");
Expand Down

0 comments on commit 225744b

Please sign in to comment.