Skip to content

return statements are sometimes required, even when they shouldn't be #159

@ahicks92

Description

@ahicks92

My repro is unfortunately private code, so sorry...if it's not obvious what's going on I'll work up something else for you. But if you do something like this:

#[auto_enum(Iterator)]
fn foo() -> Impl Iterator<Item=whatever> {
    if a {
        return std::iter::empty();
    }
    // Some more of those

    // And then return without an explicit return statement...
    std::iter::from_fn(|| stuff)
}

Then it only picks up the variants that explicitly had a return statement, and ignores the final expression in the function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-auto_enumArea: #[auto_enum]C-bugCategory: related to a bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions