Skip to content

Commit 3d8645b

Browse files
committed
fix: satisfy clippy with feature-gated usage of DECIMAL_BINARY_FORMAT_TYPE
1 parent 457b77a commit 3d8645b

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

questdb-rs/src/ingress/decimal.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ impl DecimalSerializer for &str {
125125
}
126126
}
127127

128+
#[cfg(any(feature = "rust_decimal", feature = "bigdecimal"))]
128129
use crate::ingress::DECIMAL_BINARY_FORMAT_TYPE;
129130

130131
/// Helper to format decimal values directly to a byte buffer without heap allocation.
@@ -160,11 +161,6 @@ impl DecimalSerializer for &rust_decimal::Decimal {
160161
// rust_decimal::Decimal guarantees:
161162
// - MAX_SCALE is 28, which is within QuestDB's limit of 76
162163
// - Mantissa is always 96 bits (12 bytes), never exceeds this size
163-
debug_assert!(rust_decimal::Decimal::MAX_SCALE <= 76);
164-
debug_assert!(
165-
rust_decimal::Decimal::MAX.mantissa() & 0x7FFF_FFFF_0000_0000_0000_0000_0000_0000i128
166-
== 0
167-
);
168164

169165
out.push(self.scale() as u8);
170166

questdb-rs/src/ingress/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ pub const MAX_ARRAY_DIM_LEN: usize = 0x0FFF_FFFF; // 1 << 28 - 1
7474

7575
pub(crate) const ARRAY_BINARY_FORMAT_TYPE: u8 = 14;
7676
pub(crate) const DOUBLE_BINARY_FORMAT_TYPE: u8 = 16;
77+
#[allow(dead_code)]
7778
pub(crate) const DECIMAL_BINARY_FORMAT_TYPE: u8 = 23;
7879

7980
/// The version of InfluxDB Line Protocol used to communicate with the server.

questdb-rs/src/tests/decimal.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*
2323
******************************************************************************/
2424

25-
use crate::ingress::{Buffer, DecimalSerializer, ProtocolVersion, DECIMAL_BINARY_FORMAT_TYPE};
25+
use crate::ingress::{Buffer, DecimalSerializer, ProtocolVersion};
2626
use crate::tests::TestResult;
2727
use crate::ErrorCode;
2828

@@ -140,6 +140,8 @@ fn test_str_rejects_backslash() -> TestResult {
140140
#[cfg(any(feature = "rust_decimal", feature = "bigdecimal"))]
141141
fn parse_binary_decimal(bytes: &[u8]) -> (u8, i128) {
142142
// Validate format markers
143+
144+
use crate::ingress::DECIMAL_BINARY_FORMAT_TYPE;
143145
assert_eq!(bytes[0], b'=', "Missing binary format marker");
144146
assert_eq!(
145147
bytes[1], DECIMAL_BINARY_FORMAT_TYPE,

0 commit comments

Comments
 (0)