From db2f308a46fe4e66311ed7d05f2b4f7597c6a7b3 Mon Sep 17 00:00:00 2001 From: Nick Hamann Date: Mon, 20 Apr 2015 20:45:02 -0500 Subject: [PATCH 1/3] Add two examples for Path::new --- src/libstd/path.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/libstd/path.rs b/src/libstd/path.rs index 1ad1508ae2d07..c5646e014eba4 100644 --- a/src/libstd/path.rs +++ b/src/libstd/path.rs @@ -1248,6 +1248,13 @@ impl Path { /// use std::path::Path; /// /// Path::new("foo.txt"); + /// + /// // Strings work too + /// let s = String::from("bar.txt"); + /// let p = Path::new(&s); + /// + /// // As do other Paths + /// Path::new(&p); /// ``` #[stable(feature = "rust1", since = "1.0.0")] pub fn new + ?Sized>(s: &S) -> &Path { From e178495a5e3db9b8dcafce1ec9bbac4906bb92ad Mon Sep 17 00:00:00 2001 From: Nick Hamann Date: Mon, 20 Apr 2015 21:01:13 -0500 Subject: [PATCH 2/3] Address some nits --- src/libstd/path.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libstd/path.rs b/src/libstd/path.rs index c5646e014eba4..b4a359080d786 100644 --- a/src/libstd/path.rs +++ b/src/libstd/path.rs @@ -1249,11 +1249,11 @@ impl Path { /// /// Path::new("foo.txt"); /// - /// // Strings work too + /// // Strings work too: /// let s = String::from("bar.txt"); /// let p = Path::new(&s); /// - /// // As do other Paths + /// // As do other `Path`s: /// Path::new(&p); /// ``` #[stable(feature = "rust1", since = "1.0.0")] From ba4d55d130f9577eddf577b9bf99562a8c65857b Mon Sep 17 00:00:00 2001 From: Nick Hamann Date: Tue, 21 Apr 2015 01:15:51 -0500 Subject: [PATCH 3/3] Separate code into two code blocks --- src/libstd/path.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/libstd/path.rs b/src/libstd/path.rs index b4a359080d786..0a13c77018f71 100644 --- a/src/libstd/path.rs +++ b/src/libstd/path.rs @@ -1248,12 +1248,13 @@ impl Path { /// use std::path::Path; /// /// Path::new("foo.txt"); + /// ``` + /// + /// You can create `Path`s from `String`s, or even other `Path`s: /// - /// // Strings work too: + /// ``` /// let s = String::from("bar.txt"); /// let p = Path::new(&s); - /// - /// // As do other `Path`s: /// Path::new(&p); /// ``` #[stable(feature = "rust1", since = "1.0.0")]