From 0dd6ce0b1931e3e5c274daf4bbf50e96a322befd Mon Sep 17 00:00:00 2001 From: Nadir Fejzic Date: Mon, 14 Nov 2022 22:37:25 +0100 Subject: [PATCH] docs: import Instant and Duration in doctests --- clippy_lints/src/instant_subtraction.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/clippy_lints/src/instant_subtraction.rs b/clippy_lints/src/instant_subtraction.rs index 716c11becd9..60754b224fc 100644 --- a/clippy_lints/src/instant_subtraction.rs +++ b/clippy_lints/src/instant_subtraction.rs @@ -49,11 +49,13 @@ declare_clippy_lint! { /// /// ### Example /// ```rust + /// # use std::time::{Instant, Duration}; /// let time_passed = Instant::now() - Duration::from_secs(5); /// ``` /// /// Use instead: /// ```rust + /// # use std::time::{Instant, Duration}; /// let time_passed = Instant::now().checked_sub(Duration::from_secs(5)); /// ``` ///