Skip to content

New false positive in zero_prefixed_literal #5169

Closed
@dtolnay

Description

@dtolnay
fn main() {
    let _ = 0xF;
}
warning: this is a decimal constant
 --> src/main.rs:2:13
  |
2 |     let _ = 0xF;
  |             ^^^
  |
  = note: `#[warn(clippy::zero_prefixed_literal)]` on by default
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#zero_prefixed_literal
help: if you mean to use a decimal constant, remove the `0` to avoid confusion
  |
2 |     let _ = xF;
  |             ^^
help: if you mean to use an octal constant, use `0o`
  |
2 |     let _ = 0oxF;
  |             ^^^^

Neither of Clippy's two suggestions of xF and 0oxF are compilable.

Mentioning @JohnTitor @flip1995 because I believe this is a regression introduced in #5129.

Metadata

Metadata

Assignees

Labels

C-bugCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't have

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions