@@ -106,8 +106,10 @@ impl Duration {
106
106
/// Basic usage:
107
107
///
108
108
/// ```
109
+ /// use std::time::Duration;
110
+ ///
109
111
/// 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);
111
113
/// ```
112
114
#[ unstable( feature = "duration_checked_ops" , issue = "35774" ) ]
113
115
#[ inline]
@@ -140,6 +142,8 @@ impl Duration {
140
142
/// Basic usage:
141
143
///
142
144
/// ```
145
+ /// use std::time::Duration;
146
+ ///
143
147
/// assert_eq!(Duration::new(0, 1).checked_sub(Duration::new(0, 0)), Some(Duration::new(0, 1)));
144
148
/// assert_eq!(Duration::new(0, 0).checked_sub(Duration::new(0, 1)), None);
145
149
/// ```
@@ -172,8 +176,10 @@ impl Duration {
172
176
/// Basic usage:
173
177
///
174
178
/// ```
179
+ /// use std::time::Duration;
180
+ ///
175
181
/// 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);
177
183
/// ```
178
184
#[ unstable( feature = "duration_checked_ops" , issue = "35774" ) ]
179
185
#[ inline]
@@ -203,6 +209,8 @@ impl Duration {
203
209
/// Basic usage:
204
210
///
205
211
/// ```
212
+ /// use std::time::Duration;
213
+ ///
206
214
/// assert_eq!(Duration::new(2, 0).checked_div(2), Some(Duration::new(1, 0)));
207
215
/// assert_eq!(Duration::new(1, 0).checked_div(2), Some(Duration::new(0, 500_000_000)));
208
216
/// assert_eq!(Duration::new(2, 0).checked_div(0), None);
0 commit comments