Skip to content

Commit

Permalink
Another lexical const that is unused, though not in test
Browse files Browse the repository at this point in the history
    warning: associated constant `SIGN_MASK` is never used
       --> src/lexical/num.rs:210:11
        |
    175 | pub trait Float: Number {
        |           ----- associated constant in this trait
    ...
    210 |     const SIGN_MASK: Self::Unsigned;
        |           ^^^^^^^^^
        |
        = note: `#[warn(dead_code)]` on by default
  • Loading branch information
dtolnay committed Jun 8, 2024
1 parent 4c894ea commit 24d868f
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 5 deletions.
4 changes: 0 additions & 4 deletions src/lexical/num.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,6 @@ pub trait Float: Number {

// MASKS

/// Bitmask for the sign bit.
const SIGN_MASK: Self::Unsigned;
/// Bitmask for the exponent, including the hidden bit.
const EXPONENT_MASK: Self::Unsigned;
/// Bitmask for the hidden bit in exponent, which is an implicit 1 in the fraction.
Expand Down Expand Up @@ -313,7 +311,6 @@ impl Float for f32 {

const ZERO: f32 = 0.0;
const MAX_DIGITS: usize = 114;
const SIGN_MASK: u32 = 0x80000000;
const EXPONENT_MASK: u32 = 0x7F800000;
const HIDDEN_BIT_MASK: u32 = 0x00800000;
const MANTISSA_MASK: u32 = 0x007FFFFF;
Expand Down Expand Up @@ -371,7 +368,6 @@ impl Float for f64 {

const ZERO: f64 = 0.0;
const MAX_DIGITS: usize = 769;
const SIGN_MASK: u64 = 0x8000000000000000;
const EXPONENT_MASK: u64 = 0x7FF0000000000000;
const HIDDEN_BIT_MASK: u64 = 0x0010000000000000;
const MANTISSA_MASK: u64 = 0x000FFFFFFFFFFFFF;
Expand Down
1 change: 0 additions & 1 deletion tests/lexical/num.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ fn check_float<T: Float>(x: T) {
assert!(T::from_bits(x.to_bits()) == x);

// Check properties
let _ = x.to_bits() & T::SIGN_MASK;
let _ = x.to_bits() & T::EXPONENT_MASK;
let _ = x.to_bits() & T::HIDDEN_BIT_MASK;
let _ = x.to_bits() & T::MANTISSA_MASK;
Expand Down

0 comments on commit 24d868f

Please sign in to comment.