Skip to content

Suggest replacing Option::and_then with a literal Some with Option::map  #1459

@shepmaster

Description

@shepmaster

In code like

fn main() {
    let a = Some(21);
    let b = a.and_then(|a| Some(a + 21));
    println!("{:?}", b);
}

It should suggest changing to

let b = a.map(|a| a + 21);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions