Skip to content

Commit 36abeb7

Browse files
emilkclaude
andcommitted
feat: enable clippy::lossy_float_literal
Catches float literals that silently round, e.g. `let x: f32 = 0.1234567890123;`. The three existing hits are false positives: they spell out exact powers of two (2^64 and 2^64-2^41), which float `Display` renders with fewer digits, so the lint thinks precision was lost. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
1 parent d82dc41 commit 36abeb7

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

‎Cargo.toml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ large_include_file = "warn"
252252
large_stack_arrays = "warn"
253253
large_stack_frames = "warn"
254254
linkedlist = "warn"
255+
lossy_float_literal = "warn"
255256
macro_use_imports = "warn"
256257
manual_ilog2 = "warn"
257258
manual_instant_elapsed = "warn"

‎datafusion/common/src/scalar/mod.rs‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9628,6 +9628,10 @@ mod tests {
96289628
}
96299629

96309630
#[test]
9631+
#[expect(
9632+
clippy::lossy_float_literal,
9633+
reason = "The literals below spell out exact powers of two, which float `Display` renders differently"
9634+
)]
96319635
fn test_scalar_distance_u64_boundaries() {
96329636
// 1. Full-domain integer ranges
96339637
// i64::MIN to i64::MAX -> distance is u64::MAX

0 commit comments

Comments
 (0)