Skip to content

Commit 87302a2

Browse files
authored
Rollup merge of #76162 - abrausch:documentation-fix-duration_since, r=jyn514
Make duration_since documentation more clear
2 parents 5099914 + 98231bf commit 87302a2

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

library/std/src/time.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -460,12 +460,13 @@ impl SystemTime {
460460
///
461461
/// # Examples
462462
///
463-
/// ```
463+
/// ```no_run
464464
/// use std::time::SystemTime;
465465
///
466466
/// let sys_time = SystemTime::now();
467-
/// let difference = sys_time.duration_since(sys_time)
468-
/// .expect("Clock may have gone backwards");
467+
/// let new_sys_time = SystemTime::now();
468+
/// let difference = new_sys_time.duration_since(sys_time)
469+
/// .expect("Clock may have gone backwards");
469470
/// println!("{:?}", difference);
470471
/// ```
471472
#[stable(feature = "time2", since = "1.8.0")]

0 commit comments

Comments
 (0)