From cf3d6b569c00c0092cb7af50381d3ef42687040a Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Wed, 26 Aug 2015 23:40:36 +0200 Subject: [PATCH] doc: improve as_path example --- src/libstd/path.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/libstd/path.rs b/src/libstd/path.rs index 71aed040871..6ec4b5c02a7 100644 --- a/src/libstd/path.rs +++ b/src/libstd/path.rs @@ -632,9 +632,11 @@ fn is_sep_byte(&self, b: u8) -> bool { /// ``` /// use std::path::Path; /// - /// let path = Path::new("/tmp/foo/bar.txt"); + /// let mut components = Path::new("/tmp/foo/bar.txt").components(); + /// components.next(); + /// components.next(); /// - /// println!("{:?}", path.components().as_path()); + /// assert_eq!(Path::new("foo/bar.txt"), components.as_path()); /// ``` #[stable(feature = "rust1", since = "1.0.0")] pub fn as_path(&self) -> &'a Path {