]> git.lizzy.rs Git - rust.git/commitdiff
Fix doc-tests for Duration
authorEugene Bulkin <ebulkin@caltech.edu>
Wed, 14 Sep 2016 22:41:19 +0000 (15:41 -0700)
committerEugene Bulkin <ebulkin@caltech.edu>
Wed, 14 Sep 2016 22:41:19 +0000 (15:41 -0700)
src/libstd/time/duration.rs

index a3493f0593c8c5f0a738736991a5bfa54ccd783d..6931c8d6315270e455e55c4e374bd8e592b55185 100644 (file)
@@ -106,8 +106,10 @@ pub fn subsec_nanos(&self) -> u32 { self.nanos }
     /// Basic usage:
     ///
     /// ```
+    /// use std::time::Duration;
+    ///
     /// assert_eq!(Duration::new(0, 0).checked_add(Duration::new(0, 1)), Some(Duration::new(0, 1)));
-    /// assert_eq!(Duration::new(1, 0).checked_add(Duration::new(::u64::MAX, 0)), None);
+    /// assert_eq!(Duration::new(1, 0).checked_add(Duration::new(std::u64::MAX, 0)), None);
     /// ```
     #[unstable(feature = "duration_checked_ops", issue = "35774")]
     #[inline]
@@ -140,6 +142,8 @@ pub fn checked_add(self, rhs: Duration) -> Option<Duration> {
     /// Basic usage:
     ///
     /// ```
+    /// use std::time::Duration;
+    ///
     /// assert_eq!(Duration::new(0, 1).checked_sub(Duration::new(0, 0)), Some(Duration::new(0, 1)));
     /// assert_eq!(Duration::new(0, 0).checked_sub(Duration::new(0, 1)), None);
     /// ```
@@ -172,8 +176,10 @@ pub fn checked_sub(self, rhs: Duration) -> Option<Duration> {
     /// Basic usage:
     ///
     /// ```
+    /// use std::time::Duration;
+    ///
     /// assert_eq!(Duration::new(0, 500_000_001).checked_mul(2), Some(Duration::new(1, 2)));
-    /// assert_eq!(Duration::new(::u64::MAX - 1, 0).checked_mul(2), None);
+    /// assert_eq!(Duration::new(std::u64::MAX - 1, 0).checked_mul(2), None);
     /// ```
     #[unstable(feature = "duration_checked_ops", issue = "35774")]
     #[inline]
@@ -203,6 +209,8 @@ pub fn checked_mul(self, rhs: u32) -> Option<Duration> {
     /// Basic usage:
     ///
     /// ```
+    /// use std::time::Duration;
+    ///
     /// assert_eq!(Duration::new(2, 0).checked_div(2), Some(Duration::new(1, 0)));
     /// assert_eq!(Duration::new(1, 0).checked_div(2), Some(Duration::new(0, 500_000_000)));
     /// assert_eq!(Duration::new(2, 0).checked_div(0), None);