Skip to content

Commit 8401f8e

Browse files
committed
Fix asserts clippy
1 parent 015daa0 commit 8401f8e

File tree

3 files changed

+16
-18
lines changed

3 files changed

+16
-18
lines changed

program/rust/src/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
#![deny(warnings)]
22
// Allow non upper case globals from C
33
#![allow(non_upper_case_globals)]
4-
#![allow(incomplete_features)]
5-
#![allow(clippy::bool_assert_comparison)]
64

75
mod c_oracle_header;
86
mod deserialize;

program/rust/src/tests/test_sma_epoch_transition.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ fn test_sma_epoch_transition() {
8787
);
8888
assert_eq!(price_data.time_machine.granularity, THIRTY_MINUTES);
8989
assert_eq!(price_data.time_machine.current_epoch_numerator, 0);
90-
assert_eq!(price_data.time_machine.current_epoch_is_valid, false);
90+
assert!(!price_data.time_machine.current_epoch_is_valid);
9191
assert_eq!(price_data.time_machine.current_epoch_denominator, 0);
9292
for i in 0..NUM_BUCKETS_THIRTY_MIN {
9393
assert_eq!(price_data.time_machine.running_sum_of_price_averages[i], 0);
@@ -120,7 +120,7 @@ fn test_sma_epoch_transition() {
120120
);
121121
assert_eq!(price_data.time_machine.granularity, THIRTY_MINUTES);
122122
assert_eq!(price_data.time_machine.current_epoch_numerator, 42 / 2 * 2);
123-
assert_eq!(price_data.time_machine.current_epoch_is_valid, false);
123+
assert!(!price_data.time_machine.current_epoch_is_valid);
124124
assert_eq!(price_data.time_machine.current_epoch_denominator, 2);
125125
for i in 0..NUM_BUCKETS_THIRTY_MIN {
126126
assert_eq!(price_data.time_machine.running_sum_of_price_averages[i], 0);
@@ -157,7 +157,7 @@ fn test_sma_epoch_transition() {
157157
price_data.time_machine.current_epoch_numerator,
158158
(80 + 42) / 2
159159
);
160-
assert_eq!(price_data.time_machine.current_epoch_is_valid, true);
160+
assert!(price_data.time_machine.current_epoch_is_valid);
161161
assert_eq!(price_data.time_machine.current_epoch_denominator, 1);
162162

163163
for i in 1..NUM_BUCKETS_THIRTY_MIN {
@@ -201,7 +201,7 @@ fn test_sma_epoch_transition() {
201201
price_data.time_machine.current_epoch_numerator,
202202
(80 + 42) / 2
203203
);
204-
assert_eq!(price_data.time_machine.current_epoch_is_valid, true);
204+
assert!(price_data.time_machine.current_epoch_is_valid);
205205
assert_eq!(price_data.time_machine.current_epoch_denominator, 1);
206206

207207
for i in 1..NUM_BUCKETS_THIRTY_MIN {
@@ -246,7 +246,7 @@ fn test_sma_epoch_transition() {
246246
price_data.time_machine.current_epoch_numerator,
247247
(40 + 80) / 2 * 28
248248
);
249-
assert_eq!(price_data.time_machine.current_epoch_is_valid, false);
249+
assert!(!price_data.time_machine.current_epoch_is_valid);
250250
assert_eq!(price_data.time_machine.current_epoch_denominator, 28);
251251

252252
for i in 2..NUM_BUCKETS_THIRTY_MIN {
@@ -297,7 +297,7 @@ fn test_sma_epoch_transition() {
297297
price_data.time_machine.current_epoch_numerator,
298298
(40 + 41) / 2
299299
);
300-
assert_eq!(price_data.time_machine.current_epoch_is_valid, true);
300+
assert!(price_data.time_machine.current_epoch_is_valid);
301301
assert_eq!(price_data.time_machine.current_epoch_denominator, 1);
302302

303303
for i in 5..NUM_BUCKETS_THIRTY_MIN {
@@ -367,7 +367,7 @@ fn test_sma_epoch_transition() {
367367
price_data.time_machine.current_epoch_numerator,
368368
(40 + 41) / 2
369369
);
370-
assert_eq!(price_data.time_machine.current_epoch_is_valid, true);
370+
assert!(price_data.time_machine.current_epoch_is_valid);
371371
assert_eq!(price_data.time_machine.current_epoch_denominator, 1);
372372

373373
for i in 5..NUM_BUCKETS_THIRTY_MIN {
@@ -434,7 +434,7 @@ fn test_sma_epoch_transition() {
434434
price_data.time_machine.current_epoch_numerator,
435435
(41 + 100) / 2 * 69
436436
);
437-
assert_eq!(price_data.time_machine.current_epoch_is_valid, false);
437+
assert!(!price_data.time_machine.current_epoch_is_valid);
438438
assert_eq!(price_data.time_machine.current_epoch_denominator, 69);
439439
for i in 0..NUM_BUCKETS_THIRTY_MIN {
440440
assert_eq!(

program/rust/src/tests/test_upd_sma.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ fn test_upd_sma() {
9494
assert_eq!(price_data.price_data.agg_.status_, PC_STATUS_UNKNOWN);
9595

9696
assert_eq!(price_data.time_machine.current_epoch_numerator, 0);
97-
assert_eq!(price_data.time_machine.current_epoch_is_valid, false);
97+
assert!(!price_data.time_machine.current_epoch_is_valid);
9898
assert_eq!(price_data.time_machine.current_epoch_denominator, 0);
9999
}
100100

@@ -129,7 +129,7 @@ fn test_upd_sma() {
129129
assert_eq!(price_data.price_data.agg_.status_, PC_STATUS_UNKNOWN);
130130

131131
assert_eq!(price_data.time_machine.current_epoch_numerator, 0);
132-
assert_eq!(price_data.time_machine.current_epoch_is_valid, false);
132+
assert!(!price_data.time_machine.current_epoch_is_valid);
133133
assert_eq!(price_data.time_machine.current_epoch_denominator, 0);
134134
}
135135

@@ -163,7 +163,7 @@ fn test_upd_sma() {
163163
assert_eq!(price_data.price_data.agg_.status_, PC_STATUS_TRADING);
164164

165165
assert_eq!(price_data.time_machine.current_epoch_numerator, 42 / 2 * 3);
166-
assert_eq!(price_data.time_machine.current_epoch_is_valid, false);
166+
assert!(!price_data.time_machine.current_epoch_is_valid);
167167
assert_eq!(price_data.time_machine.current_epoch_denominator, 3);
168168
}
169169

@@ -199,7 +199,7 @@ fn test_upd_sma() {
199199
price_data.time_machine.current_epoch_numerator,
200200
42 / 2 * 3 + (81 + 42) / 2
201201
);
202-
assert_eq!(price_data.time_machine.current_epoch_is_valid, false);
202+
assert!(!price_data.time_machine.current_epoch_is_valid);
203203
assert_eq!(price_data.time_machine.current_epoch_denominator, 3 + 1);
204204
}
205205

@@ -235,7 +235,7 @@ fn test_upd_sma() {
235235
price_data.time_machine.current_epoch_numerator,
236236
42 / 2 * 3 + (81 + 42) / 2 + 81
237237
);
238-
assert_eq!(price_data.time_machine.current_epoch_is_valid, false);
238+
assert!(!price_data.time_machine.current_epoch_is_valid);
239239
assert_eq!(price_data.time_machine.current_epoch_denominator, 3 + 1 + 1);
240240
}
241241

@@ -273,7 +273,7 @@ fn test_upd_sma() {
273273
price_data.time_machine.current_epoch_numerator,
274274
42 / 2 * 3 + (81 + 42) / 2 + 81
275275
);
276-
assert_eq!(price_data.time_machine.current_epoch_is_valid, false);
276+
assert!(!price_data.time_machine.current_epoch_is_valid);
277277
assert_eq!(price_data.time_machine.current_epoch_denominator, 3 + 1 + 1);
278278
}
279279

@@ -320,7 +320,7 @@ fn test_upd_sma() {
320320
price_data.time_machine.current_epoch_numerator,
321321
42 / 2 * 3 + (81 + 42) / 2 + 81 + 81
322322
);
323-
assert_eq!(price_data.time_machine.current_epoch_is_valid, false);
323+
assert!(!price_data.time_machine.current_epoch_is_valid);
324324
assert_eq!(
325325
price_data.time_machine.current_epoch_denominator,
326326
3 + 1 + 1 + 1
@@ -360,7 +360,7 @@ fn test_upd_sma() {
360360
price_data.time_machine.current_epoch_numerator,
361361
42 / 2 * 3 + (81 + 42) / 2 + 81 + 81
362362
);
363-
assert_eq!(price_data.time_machine.current_epoch_is_valid, false);
363+
assert!(!price_data.time_machine.current_epoch_is_valid);
364364
assert_eq!(
365365
price_data.time_machine.current_epoch_denominator,
366366
3 + 1 + 1 + 1

0 commit comments

Comments
 (0)