Skip to content

Commit f2eb4f1

Browse files
author
Eugene Bulkin
committed
Fix doc-tests for Duration
1 parent b1bcd18 commit f2eb4f1

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/libstd/time/duration.rs

+10-2
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,10 @@ impl Duration {
106106
/// Basic usage:
107107
///
108108
/// ```
109+
/// use std::time::Duration;
110+
///
109111
/// assert_eq!(Duration::new(0, 0).checked_add(Duration::new(0, 1)), Some(Duration::new(0, 1)));
110-
/// assert_eq!(Duration::new(1, 0).checked_add(Duration::new(::u64::MAX, 0)), None);
112+
/// assert_eq!(Duration::new(1, 0).checked_add(Duration::new(std::u64::MAX, 0)), None);
111113
/// ```
112114
#[unstable(feature = "duration_checked_ops", issue = "35774")]
113115
#[inline]
@@ -140,6 +142,8 @@ impl Duration {
140142
/// Basic usage:
141143
///
142144
/// ```
145+
/// use std::time::Duration;
146+
///
143147
/// assert_eq!(Duration::new(0, 1).checked_sub(Duration::new(0, 0)), Some(Duration::new(0, 1)));
144148
/// assert_eq!(Duration::new(0, 0).checked_sub(Duration::new(0, 1)), None);
145149
/// ```
@@ -172,8 +176,10 @@ impl Duration {
172176
/// Basic usage:
173177
///
174178
/// ```
179+
/// use std::time::Duration;
180+
///
175181
/// assert_eq!(Duration::new(0, 500_000_001).checked_mul(2), Some(Duration::new(1, 2)));
176-
/// assert_eq!(Duration::new(::u64::MAX - 1, 0).checked_mul(2), None);
182+
/// assert_eq!(Duration::new(std::u64::MAX - 1, 0).checked_mul(2), None);
177183
/// ```
178184
#[unstable(feature = "duration_checked_ops", issue = "35774")]
179185
#[inline]
@@ -203,6 +209,8 @@ impl Duration {
203209
/// Basic usage:
204210
///
205211
/// ```
212+
/// use std::time::Duration;
213+
///
206214
/// assert_eq!(Duration::new(2, 0).checked_div(2), Some(Duration::new(1, 0)));
207215
/// assert_eq!(Duration::new(1, 0).checked_div(2), Some(Duration::new(0, 500_000_000)));
208216
/// assert_eq!(Duration::new(2, 0).checked_div(0), None);

0 commit comments

Comments
 (0)