File tree Expand file tree Collapse file tree 3 files changed +35
-1
lines changed
Expand file tree Collapse file tree 3 files changed +35
-1
lines changed Original file line number Diff line number Diff line change @@ -94,3 +94,14 @@ fn issue16457() {
9494 // Methods taking something else than `u64` are not covered
9595 _ = Duration::from_nanos_u128(1 << 90);
9696}
97+
98+ #[clippy::msrv = "1.90"]
99+ fn insufficient_msrv() {
100+ _ = Duration::from_secs(67_768_040_922_076_800);
101+ }
102+
103+ #[clippy::msrv = "1.91"]
104+ fn sufficient_msrv() {
105+ _ = Duration::from_hours(18824455811688);
106+ //~^ duration_suboptimal_units
107+ }
Original file line number Diff line number Diff line change @@ -94,3 +94,14 @@ fn issue16457() {
9494 // Methods taking something else than `u64` are not covered
9595 _ = Duration :: from_nanos_u128 ( 1 << 90 ) ;
9696}
97+
98+ #[ clippy:: msrv = "1.90" ]
99+ fn insufficient_msrv ( ) {
100+ _ = Duration :: from_secs ( 67_768_040_922_076_800 ) ;
101+ }
102+
103+ #[ clippy:: msrv = "1.91" ]
104+ fn sufficient_msrv ( ) {
105+ _ = Duration :: from_secs ( 67_768_040_922_076_800 ) ;
106+ //~^ duration_suboptimal_units
107+ }
Original file line number Diff line number Diff line change @@ -148,5 +148,17 @@ LL - Duration::from_secs(300)
148148LL + Duration::from_mins(5)
149149 |
150150
151- error: aborting due to 12 previous errors
151+ error: constructing a `Duration` using a smaller unit when a larger unit would be more readable
152+ --> tests/ui/duration_suboptimal_units.rs:105:9
153+ |
154+ LL | _ = Duration::from_secs(67_768_040_922_076_800);
155+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
156+ |
157+ help: try using from_hours
158+ |
159+ LL - _ = Duration::from_secs(67_768_040_922_076_800);
160+ LL + _ = Duration::from_hours(18824455811688);
161+ |
162+
163+ error: aborting due to 13 previous errors
152164
You can’t perform that action at this time.
0 commit comments