Skip to content

Unused loop (break) name gives no compiler warning #50751

Closed
@BartMassey

Description

@BartMassey

Currently, code like this

'unused_name: for i in 0..2 {
    println!("{}", i);
}

is silently accepted. As with unused function parameters or variable declarations, this is usually indicative of a mistake. A warning should be issued unless the break name begins with _.

Do I need to treat this as a feature request and file an RFC? Please say "no" — the RFC process is heavyweight as hell. I think it's just a bug report 😄.

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.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions