Search code examples
rustphysicsexponentrust-clippy

Expected at least one digit in exponent


I am writing a physics-based Rust project using Clippy as the analysis tool, and have the following code:

const G: f64 = 6.67430e-11;
const C: i32 = 299792458;
const PLANK_CONSTANT: f64 = 6.62607015e−34; // error

The error states that I should have at least one digit in the exponent, but as you can see there are many digits. I have tried removing the decimal place, adding spaces, but it still gives the error, even though it doesn't give the error for the variable G.

The full error if it helps:

Expected at least one digit in exponent. '(', '+', '-', ';', or '[' expected, got '−'. Unknown start of token: \u{2212}

I feel like I am missing something stupid but I have read my code many times!


Solution

  • const G: f64 = 6.67430e-11;
    const C: i32 = 299792458;
    const PLANK_CONSTANT: f64 = 6.62607015e-34;
    

    Surprise, it works :)

    I've just replaced (a dash) with - (a minus).