Skip to content

Commit c910252

Browse files
author
elszben
committed
Replaced wrapper functions with no_run and as_str().unwrap() with display()
1 parent c0e8dc6 commit c910252

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/libstd/io/tempfile.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ use sync::atomic;
2626
///
2727
/// # Examples
2828
///
29-
/// ```
30-
/// # fn main() {}
31-
/// # fn foo () {
29+
/// ```no_run
3230
/// use std::io::TempDir;
3331
///
3432
/// {
@@ -41,7 +39,7 @@ use sync::atomic;
4139
/// // get the path of the temporary directory without affecting the wrapper
4240
/// let tmppath = tmpdir.path();
4341
///
44-
/// println!("The path of temporary directory is {}", tmppath.as_str().unwrap());
42+
/// println!("The path of temporary directory is {}", tmppath.display());
4543
///
4644
/// // the temporary directory is automatically removed when tmpdir goes
4745
/// // out of scope at the end of the block
@@ -56,7 +54,7 @@ use sync::atomic;
5654
/// // get the path of the temporary directory and disable automatic deletion in the wrapper
5755
/// let tmppath = tmpdir.into_inner();
5856
///
59-
/// println!("The path of the not-so-temporary directory is {}", tmppath.as_str().unwrap());
57+
/// println!("The path of the not-so-temporary directory is {}", tmppath.display());
6058
///
6159
/// // the temporary directory is not removed here
6260
/// // because the directory is detached from the wrapper
@@ -74,7 +72,6 @@ use sync::atomic;
7472
/// Err(e) => panic!("couldn't remove temporary directory: {}", e)
7573
/// };
7674
/// }
77-
/// # }
7875
/// ```
7976
pub struct TempDir {
8077
path: Option<Path>,

0 commit comments

Comments
 (0)