Skip to content

Commit 0dd6ce0

Browse files
committed
docs: import Instant and Duration in doctests
1 parent 72ab91d commit 0dd6ce0

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

clippy_lints/src/instant_subtraction.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,13 @@ declare_clippy_lint! {
4949
///
5050
/// ### Example
5151
/// ```rust
52+
/// # use std::time::{Instant, Duration};
5253
/// let time_passed = Instant::now() - Duration::from_secs(5);
5354
/// ```
5455
///
5556
/// Use instead:
5657
/// ```rust
58+
/// # use std::time::{Instant, Duration};
5759
/// let time_passed = Instant::now().checked_sub(Duration::from_secs(5));
5860
/// ```
5961
///

0 commit comments

Comments
 (0)