Skip to content

Commit

Permalink
Rollup merge of #75284 - pickfire:patch-7, r=LukasKalbertodt
Browse files Browse the repository at this point in the history
Show relative example for Path ancestors
  • Loading branch information
JohnTitor authored Aug 8, 2020
2 parents cb75fea + a11c279 commit 27b864b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions library/std/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1992,6 +1992,13 @@ impl Path {
/// assert_eq!(ancestors.next(), Some(Path::new("/foo")));
/// assert_eq!(ancestors.next(), Some(Path::new("/")));
/// assert_eq!(ancestors.next(), None);
///
/// let mut ancestors = Path::new("../foo/bar").ancestors();
/// assert_eq!(ancestors.next(), Some(Path::new("../foo/bar")));
/// assert_eq!(ancestors.next(), Some(Path::new("../foo")));
/// assert_eq!(ancestors.next(), Some(Path::new("..")));
/// assert_eq!(ancestors.next(), Some(Path::new("")));
/// assert_eq!(ancestors.next(), None);
/// ```
///
/// [`None`]: ../../std/option/enum.Option.html#variant.None
Expand Down

0 comments on commit 27b864b

Please sign in to comment.