diff options
| author | bors <bors@rust-lang.org> | 2015-08-27 16:51:57 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-08-27 16:51:57 +0000 |
| commit | b28f0b18875601ffaa0cfde2ec0a114bcf0a460b (patch) | |
| tree | ab7c25e876ae7e50fd1a1ad565e63a3083714e95 /src/libstd/path.rs | |
| parent | ccf831769459fb1b306387e6796a0155d63eb012 (diff) | |
| parent | cf3d6b569c00c0092cb7af50381d3ef42687040a (diff) | |
| download | rust-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.rs | 6 |
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 { |
