about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlexander Brausch <alexander.brausch@caperwhite.com>2020-08-31 16:20:24 +0200
committerAlexander Brausch <alexander.brausch@caperwhite.com>2020-09-08 23:27:24 +0200
commit98231bfb953406fd7b5dcbdfa7229d44554776a0 (patch)
treef7493641bda472f1800bcff5fd610de2f2641692
parent8ed5cb56b5e5cc216eb6820a44dd4f7ef65107b0 (diff)
downloadrust-98231bfb953406fd7b5dcbdfa7229d44554776a0.tar.gz
rust-98231bfb953406fd7b5dcbdfa7229d44554776a0.zip
Make duration_since documentation more clear
-rw-r--r--library/std/src/time.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/library/std/src/time.rs b/library/std/src/time.rs
index c8aee1da39b..0085136417b 100644
--- a/library/std/src/time.rs
+++ b/library/std/src/time.rs
@@ -457,12 +457,13 @@ impl SystemTime {
     ///
     /// # Examples
     ///
-    /// ```
+    /// ```no_run
     /// use std::time::SystemTime;
     ///
     /// let sys_time = SystemTime::now();
-    /// let difference = sys_time.duration_since(sys_time)
-    ///                          .expect("Clock may have gone backwards");
+    /// let new_sys_time = SystemTime::now();
+    /// let difference = new_sys_time.duration_since(sys_time)
+    ///     .expect("Clock may have gone backwards");
     /// println!("{:?}", difference);
     /// ```
     #[stable(feature = "time2", since = "1.8.0")]