Skip to content

Commit b28f0b1

Browse files
committed
Auto merge of #28030 - tshepang:improve-example, r=alexcrichton
2 parents ccf8317 + cf3d6b5 commit b28f0b1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/libstd/path.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -632,9 +632,11 @@ impl<'a> Components<'a> {
632632
/// ```
633633
/// use std::path::Path;
634634
///
635-
/// let path = Path::new("/tmp/foo/bar.txt");
635+
/// let mut components = Path::new("/tmp/foo/bar.txt").components();
636+
/// components.next();
637+
/// components.next();
636638
///
637-
/// println!("{:?}", path.components().as_path());
639+
/// assert_eq!(Path::new("foo/bar.txt"), components.as_path());
638640
/// ```
639641
#[stable(feature = "rust1", since = "1.0.0")]
640642
pub fn as_path(&self) -> &'a Path {

0 commit comments

Comments
 (0)