4

handle exponent without digits in `numeric_literal` by y21 · Pull Request #10914...

 11 months ago
source link: https://github.com/rust-lang/rust-clippy/pull/10914
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Contributor

@y21 y21

commented

Jun 9, 2023

edited

Fixes #10912

The numeric literal util module didn't check for exponents with no digits.
So:

exponent here would be the empty string, which passed the != "0" check (when it shouldn't have, it should probably be treated as if the user wrote E0), then later fails when counting the digits and subtracting one (0 - 1 = overflow).

Also, interestingly I can't even write a test for this because exponents with no digits is some kind of error by itself and cargo dev fmt fails on it.

changelog: [unreadable_literal]: don't (debug) ICE on numeric literal with empty exponent


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK