-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't have
Description
Summary
Rust sadly doesn't support non-decimal floating point numbers.
Lint Name
clippy::unnecessary_cast
Reproducer
I tried this code:
-0x400 as f32I saw this happen:
warning: casting integer literal to `f32` is unnecessary
--> src/world/layer.rs:26:29
|
26 | Vector::new(-0x400 as f32, 0x40 as f32),
| ^^^^^^^^^^^^^ help: try: `-0x400_f32`
I expected to see this happen:
I expected it not to work anymore after following the hint, and that's what happened.
Version
rustc 1.64.0 (a55dd71d5 2022-09-19)
binary: rustc
commit-hash: a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52
commit-date: 2022-09-19
host: x86_64-unknown-linux-gnu
release: 1.64.0
LLVM version: 14.0.6
Additional Labels
No response
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't have