Skip to content

Wrap return type in... Quick Fix should not wrap types that are already wrapped #20045

@sbdchd

Description

@sbdchd

Running Wrap return type in... Option:

fn foo(x: i64) -> i64 {
    if x > 10 {
        Some(1)
    } else {
        None
    }
}

Gives:

fn foo(x: i64) -> Option<i64> {
    if x > 10 {
        Some(Some(1))
    } else {
        Some(None)
    }
}

But it would be better if it recognized the return values are already Option so they don't need to be wrapped again:

fn foo(x: i64) -> Option<i64> {
    if x > 10 {
        Some(1)
    } else {
        None
    }
}

Metadata

Metadata

Labels

C-featureCategory: feature request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions