mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 23:34:48 +00:00
docs: import Instant and Duration in doctests
This commit is contained in:
parent
72ab91d806
commit
0dd6ce0b19
@ -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));
|
||||
/// ```
|
||||
///
|
||||
|
Loading…
Reference in New Issue
Block a user