Skip to content

illegal_floating_point_literal_pattern warns twice  #86600

Closed
@rylev

Description

@rylev

With the following code (playground):

fn main() {
    let x = 42.0;

    match x {
        5.0 => {}
        _ => {}
    }
}

I expected to see one warning.

Instead, this happened:

warning: floating-point types cannot be used in patterns
 --> src/main.rs:5:9
  |
5 |         5.0 => {}
  |         ^^^
  |
  = note: `#[warn(illegal_floating_point_literal_pattern)]` on by default
  = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
  = note: for more information, see issue #41620 <https://github.com/rust-lang/rust/issues/41620>

warning: floating-point types cannot be used in patterns
 --> src/main.rs:5:9
  |
5 |         5.0 => {}
  |         ^^^
  |
  = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
  = note: for more information, see issue #41620 <https://github.com/rust-lang/rust/issues/41620>

warning: 2 warnings emitted

Meta

1.55.0-nightly

(2021-06-23 5a7834050f3a0ebcd117)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.C-future-incompatibilityCategory: Future-incompatibility lints

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions