Skip to content

Unused variable result without variable result (for loop) #30371

Closed
@tbu-

Description

@tbu-

Code:

fn main() {
    for _ in match return () {
        () => Some(0),
    } {}
}

Warning:

$ rustc a.rs
a.rs:2:5: 4:9 warning: unused variable: `result`, #[warn(unused_variables)] on by default
a.rs:2     for _ in match return () {
a.rs:3         () => Some(0),
a.rs:4     } {}

Playpen

It probably has something to do with for loop desugaring.

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions