Skip to content

Commit ab1e899

Browse files
committed
feat: add dead code annotations for floating point constants in RawFloat trait
1 parent b951f74 commit ab1e899

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

sonic-number/src/float.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,13 @@ pub trait RawFloat:
2828
+ Copy
2929
+ Debug
3030
{
31+
#[allow(dead_code)]
3132
const INFINITY: Self;
33+
#[allow(dead_code)]
3234
const NEG_INFINITY: Self;
35+
#[allow(dead_code)]
3336
const NAN: Self;
37+
#[allow(dead_code)]
3438
const NEG_NAN: Self;
3539

3640
/// The number of bits in the significand, *excluding* the hidden bit.
@@ -58,13 +62,16 @@ pub trait RawFloat:
5862
const MAX_EXPONENT_ROUND_TO_EVEN: i32;
5963

6064
// Minimum exponent that for a fast path case, or `-⌊(MANTISSA_EXPLICIT_BITS+1)/log2(5)⌋`
65+
#[allow(dead_code)]
6166
const MIN_EXPONENT_FAST_PATH: i64;
6267

6368
// Maximum exponent that for a fast path case, or `⌊(MANTISSA_EXPLICIT_BITS+1)/log2(5)⌋`
69+
#[allow(dead_code)]
6470
const MAX_EXPONENT_FAST_PATH: i64;
6571

6672
// Maximum exponent that can be represented for a disguised-fast path case.
6773
// This is `MAX_EXPONENT_FAST_PATH + ⌊(MANTISSA_EXPLICIT_BITS+1)/log2(10)⌋`
74+
#[allow(dead_code)]
6875
const MAX_EXPONENT_DISGUISED_FAST_PATH: i64;
6976

7077
// Minimum exponent value `-(1 << (EXP_BITS - 1)) + 1`.
@@ -74,6 +81,7 @@ pub trait RawFloat:
7481
const INFINITE_POWER: i32;
7582

7683
// Index (in bits) of the sign.
84+
#[allow(dead_code)]
7785
const SIGN_INDEX: usize;
7886

7987
// Smallest decimal exponent for a non-zero value.
@@ -83,6 +91,7 @@ pub trait RawFloat:
8391
const LARGEST_POWER_OF_TEN: i32;
8492

8593
// Maximum mantissa for the fast-path (`1 << 53` for f64).
94+
#[allow(dead_code)]
8695
const MAX_MANTISSA_FAST_PATH: u64 = 2_u64 << Self::MANTISSA_EXPLICIT_BITS;
8796

8897
/// Convert integer into float through an as cast.

0 commit comments

Comments
 (0)