11error: constructing a `Duration` using a smaller unit when a larger unit would be more readable
22 --> tests/ui/duration_suboptimal_units.rs:26:15
33 |
4- LL | let dur = Duration::from_secs(59 + 1 );
4+ LL | let dur = Duration::from_secs(60 * 3 );
55 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
66 |
77 = note: `-D clippy::duration-suboptimal-units` implied by `-D warnings`
88 = help: to override `-D warnings` add `#[allow(clippy::duration_suboptimal_units)]`
99help: try using from_mins
1010 |
11- LL - let dur = Duration::from_secs(59 + 1);
12- LL + let dur = Duration::from_mins(1);
13- |
14-
15- error: constructing a `Duration` using a smaller unit when a larger unit would be more readable
16- --> tests/ui/duration_suboptimal_units.rs:39:15
17- |
18- LL | let dur = Duration::from_millis(20_000);
19- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
20- |
21- help: try using from_secs
22- |
23- LL - let dur = Duration::from_millis(20_000);
24- LL + let dur = Duration::from_secs(20);
25- |
26-
27- error: constructing a `Duration` using a smaller unit when a larger unit would be more readable
28- --> tests/ui/duration_suboptimal_units.rs:41:15
29- |
30- LL | let dur = Duration::from_mins(720);
31- | ^^^^^^^^^^^^^^^^^^^^^^^^
32- |
33- help: try using from_hours
34- |
35- LL - let dur = Duration::from_mins(720);
36- LL + let dur = Duration::from_hours(12);
37- |
38-
39- error: constructing a `Duration` using a smaller unit when a larger unit would be more readable
40- --> tests/ui/duration_suboptimal_units.rs:43:15
41- |
42- LL | let dur = Duration::from_secs(660);
43- | ^^^^^^^^^^^^^^^^^^^^^^^^
44- |
45- help: try using from_mins
46- |
47- LL - let dur = Duration::from_secs(660);
48- LL + let dur = Duration::from_mins(11);
49- |
50-
51- error: constructing a `Duration` using a smaller unit when a larger unit would be more readable
52- --> tests/ui/duration_suboptimal_units.rs:46:15
53- |
54- LL | let dur = Duration::from_secs(60 * 3);
55- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
56- |
57- help: try using from_mins
58- |
5911LL - let dur = Duration::from_secs(60 * 3);
6012LL + let dur = Duration::from_mins(3);
6113 |
6214
6315error: constructing a `Duration` using a smaller unit when a larger unit would be more readable
64- --> tests/ui/duration_suboptimal_units.rs:48 :15
16+ --> tests/ui/duration_suboptimal_units.rs:28 :15
6517 |
6618LL | let dur = Duration::from_secs(10 * 60);
6719 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -73,7 +25,7 @@ LL + let dur = Duration::from_mins(10);
7325 |
7426
7527error: constructing a `Duration` using a smaller unit when a larger unit would be more readable
76- --> tests/ui/duration_suboptimal_units.rs:50 :15
28+ --> tests/ui/duration_suboptimal_units.rs:30 :15
7729 |
7830LL | let dur = Duration::from_mins(24 * 60);
7931 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -85,7 +37,7 @@ LL + let dur = Duration::from_hours(24);
8537 |
8638
8739error: constructing a `Duration` using a smaller unit when a larger unit would be more readable
88- --> tests/ui/duration_suboptimal_units.rs:52 :15
40+ --> tests/ui/duration_suboptimal_units.rs:32 :15
8941 |
9042LL | let dur = Duration::from_millis(5 * 1000);
9143 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -97,7 +49,7 @@ LL + let dur = Duration::from_secs(5);
9749 |
9850
9951error: constructing a `Duration` using a smaller unit when a larger unit would be more readable
100- --> tests/ui/duration_suboptimal_units.rs:54 :15
52+ --> tests/ui/duration_suboptimal_units.rs:34 :15
10153 |
10254LL | let dur = Duration::from_nanos(13 * 60 * 60 * 1_000 * 1_000 * 1_000);
10355 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -109,7 +61,7 @@ LL + let dur = Duration::from_hours(13);
10961 |
11062
11163error: constructing a `Duration` using a smaller unit when a larger unit would be more readable
112- --> tests/ui/duration_suboptimal_units.rs:66 :19
64+ --> tests/ui/duration_suboptimal_units.rs:46 :19
11365 |
11466LL | let dur = Duration::from_millis(1000 * 5);
11567 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -121,7 +73,7 @@ LL + let dur = Duration::from_secs(5);
12173 |
12274
12375error: constructing a `Duration` using a smaller unit when a larger unit would be more readable
124- --> tests/ui/duration_suboptimal_units.rs:68 :19
76+ --> tests/ui/duration_suboptimal_units.rs:48 :19
12577 |
12678LL | let dur = Duration::from_millis(11000);
12779 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -133,7 +85,7 @@ LL + let dur = Duration::from_secs(11);
13385 |
13486
13587error: constructing a `Duration` using a smaller unit when a larger unit would be more readable
136- --> tests/ui/duration_suboptimal_units.rs:73 :19
88+ --> tests/ui/duration_suboptimal_units.rs:53 :19
13789 |
13890LL | let dur = Duration::from_secs(39600);
13991 | ^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -145,7 +97,7 @@ LL + let dur = Duration::from_hours(11);
14597 |
14698
14799error: constructing a `Duration` using a smaller unit when a larger unit would be more readable
148- --> tests/ui/duration_suboptimal_units.rs:75 :19
100+ --> tests/ui/duration_suboptimal_units.rs:55 :19
149101 |
150102LL | let dur = Duration::from_secs(3 * 60);
151103 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -157,7 +109,7 @@ LL + let dur = Duration::from_mins(3);
157109 |
158110
159111error: constructing a `Duration` using a smaller unit when a larger unit would be more readable
160- --> tests/ui/duration_suboptimal_units.rs:77 :19
112+ --> tests/ui/duration_suboptimal_units.rs:57 :19
161113 |
162114LL | let dur = Duration::from_mins(24 * 60);
163115 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -169,7 +121,7 @@ LL + let dur = Duration::from_hours(24);
169121 |
170122
171123error: constructing a `Duration` using a smaller unit when a larger unit would be more readable
172- --> tests/ui/duration_suboptimal_units.rs:84 :5
124+ --> tests/ui/duration_suboptimal_units.rs:64 :5
173125 |
174126LL | std::time::Duration::from_secs(12 * 60);
175127 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -181,7 +133,7 @@ LL + std::time::Duration::from_mins(12);
181133 |
182134
183135error: constructing a `Duration` using a smaller unit when a larger unit would be more readable
184- --> tests/ui/duration_suboptimal_units.rs:89 :16
136+ --> tests/ui/duration_suboptimal_units.rs:69 :16
185137 |
186138LL | assert_eq!(Duration::from_secs(60 * 60), Duration::from_mins(6));
187139 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -209,7 +161,7 @@ LL + Duration::from_mins(5)
209161 |
210162
211163error: constructing a `Duration` using a smaller unit when a larger unit would be more readable
212- --> tests/ui/duration_suboptimal_units.rs:132 :9
164+ --> tests/ui/duration_suboptimal_units.rs:112 :9
213165 |
214166LL | _ = Duration::from_secs(67_768_040_922_076_800);
215167 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -220,5 +172,41 @@ LL - _ = Duration::from_secs(67_768_040_922_076_800);
220172LL + _ = Duration::from_hours(18824455811688);
221173 |
222174
223- error: aborting due to 18 previous errors
175+ error: constructing a `Duration` using a smaller unit when a larger unit would be more readable
176+ --> tests/ui/duration_suboptimal_units.rs:127:15
177+ |
178+ LL | let dur = Duration::from_millis(20_000);
179+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
180+ |
181+ help: try using from_secs
182+ |
183+ LL - let dur = Duration::from_millis(20_000);
184+ LL + let dur = Duration::from_secs(20);
185+ |
186+
187+ error: constructing a `Duration` using a smaller unit when a larger unit would be more readable
188+ --> tests/ui/duration_suboptimal_units.rs:129:15
189+ |
190+ LL | let dur = Duration::from_mins(720);
191+ | ^^^^^^^^^^^^^^^^^^^^^^^^
192+ |
193+ help: try using from_hours
194+ |
195+ LL - let dur = Duration::from_mins(720);
196+ LL + let dur = Duration::from_hours(12);
197+ |
198+
199+ error: constructing a `Duration` using a smaller unit when a larger unit would be more readable
200+ --> tests/ui/duration_suboptimal_units.rs:131:15
201+ |
202+ LL | let dur = Duration::from_secs(660);
203+ | ^^^^^^^^^^^^^^^^^^^^^^^^
204+ |
205+ help: try using from_mins
206+ |
207+ LL - let dur = Duration::from_secs(660);
208+ LL + let dur = Duration::from_mins(11);
209+ |
210+
211+ error: aborting due to 17 previous errors
224212
0 commit comments