Skip to content

Commit 097c880

Browse files
committed
fix: Address clippy lints in util module
- Use consistent digit grouping in large numbers (time.rs) - Allow field_reassign_with_default in test that intentionally tests multiple values sequentially (instrument.rs)
1 parent 32d9aea commit 097c880

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/util/instrument.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ mod tests {
140140
use super::*;
141141

142142
#[test]
143+
#[allow(clippy::field_reassign_with_default)]
143144
fn test_price_precision() {
144145
let mut info = InstrumentInfo::default();
145146

src/util/time.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
/// ```
1010
/// use rithmic_rs::rithmic_to_unix_nanos;
1111
///
12-
/// let nanos = rithmic_to_unix_nanos(1704067200, 500000);
13-
/// assert_eq!(nanos, 1704067200_500_000_000);
12+
/// let nanos = rithmic_to_unix_nanos(1_704_067_200, 500_000);
13+
/// assert_eq!(nanos, 1_704_067_200_500_000_000);
1414
/// ```
1515
pub fn rithmic_to_unix_nanos(ssboe: i32, usecs: i32) -> u64 {
1616
debug_assert!(ssboe >= 0, "ssboe must be non-negative, got {}", ssboe);
@@ -27,8 +27,8 @@ pub fn rithmic_to_unix_nanos(ssboe: i32, usecs: i32) -> u64 {
2727
/// use rithmic_rs::rithmic_to_unix_nanos_precise;
2828
///
2929
/// // With nanoseconds from exchange
30-
/// let nanos = rithmic_to_unix_nanos_precise(1704067200, 500000, Some(123));
31-
/// assert_eq!(nanos, 1704067200_500_000_123);
30+
/// let nanos = rithmic_to_unix_nanos_precise(1_704_067_200, 500_000, Some(123));
31+
/// assert_eq!(nanos, 1_704_067_200_500_000_123);
3232
/// ```
3333
pub fn rithmic_to_unix_nanos_precise(ssboe: i32, usecs: i32, nsecs: Option<i32>) -> u64 {
3434
debug_assert!(ssboe >= 0, "ssboe must be non-negative, got {}", ssboe);
@@ -53,8 +53,8 @@ mod tests {
5353
assert_eq!(rithmic_to_unix_nanos(1, 1), 1_000_001_000);
5454
assert_eq!(rithmic_to_unix_nanos(1, 999999), 1_999_999_000);
5555
assert_eq!(
56-
rithmic_to_unix_nanos(1704067200, 500000),
57-
1704067200_500_000_000
56+
rithmic_to_unix_nanos(1_704_067_200, 500_000),
57+
1_704_067_200_500_000_000
5858
);
5959
}
6060

0 commit comments

Comments
 (0)