Skip to content

Error when if let arm doesn't return () could be more helpful #19991

@tomjakubowski

Description

@tomjakubowski

When compiling this:

fn main() { if let Some(x) = Some(5) { true } }
<anon>:2:5: 4:6 error: match arms have incompatible types: expected `bool`, found `()` (expected bool, found ()) <anon>:2 if let Some(x) = Some(5) { <anon>:3 true <anon>:4 } <anon>:2:5: 4:6 note: match arm with an incompatible type <anon>:2 if let Some(x) = Some(5) { <anon>:3 true <anon>:4 } 

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lints

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions