about summary refs log tree commit diff
path: root/src/libstd/path.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-08-27 16:51:57 +0000
committerbors <bors@rust-lang.org>2015-08-27 16:51:57 +0000
commitb28f0b18875601ffaa0cfde2ec0a114bcf0a460b (patch)
treeab7c25e876ae7e50fd1a1ad565e63a3083714e95 /src/libstd/path.rs
parentccf831769459fb1b306387e6796a0155d63eb012 (diff)
parentcf3d6b569c00c0092cb7af50381d3ef42687040a (diff)
downloadrust-b28f0b18875601ffaa0cfde2ec0a114bcf0a460b.tar.gz
rust-b28f0b18875601ffaa0cfde2ec0a114bcf0a460b.zip
Auto merge of #28030 - tshepang:improve-example, r=alexcrichton
Diffstat (limited to 'src/libstd/path.rs')
-rw-r--r--src/libstd/path.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/libstd/path.rs b/src/libstd/path.rs
index 3ee4ce80bd5..b5e08752344 100644
--- a/src/libstd/path.rs
+++ b/src/libstd/path.rs
@@ -632,9 +632,11 @@ impl<'a> Components<'a> {
     /// ```
     /// 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 {