Skip to content

dead_code lint false positive #45614

Closed
Closed
@leonardo-m

Description

@leonardo-m
fn main() {
    struct Foo<T> { x: T }
    type Bar = Foo<u32>;
    let spam = |Bar { x }| x != 0;
    println!("{}", spam(Foo { x: 10 }));
}

Gives:

warning: type alias is never used: `Bar`
 --> ...\test.rs:3:5
  |
3 |     type Bar = Foo<u32>;
  |     ^^^^^^^^^^^^^^^^^^^^
  |
  = note: #[warn(dead_code)] on by default

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.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions