Skip to content

Manual map 2021 false negative #7876

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ghost opened this issue Oct 25, 2021 · 0 comments
Open

Manual map 2021 false negative #7876

ghost opened this issue Oct 25, 2021 · 0 comments
Labels
C-bug Category: Clippy is not doing the correct thing I-false-negative Issue: The lint should have been triggered on code, but wasn't

Comments

@ghost
Copy link

ghost commented Oct 25, 2021

Lint name: manual_map

The 2021 edition made closure capturing smarter. We can now make some suggestions that previously wouldn't compile.
Edition Docs

I tried this code:

This is the test case for issue #6797

    let x1 = (Some(String::new()), 0);
    let x2 = x1.0;

    match x2 {
        Some(x) => Some((x, x1.1)),
        None => None,
    };

I expected to see this happen:
This recommendation if I'm using 2021.

    x2.map(|x| Some((x, x1.1)));

Instead, this happened:
No, warning. It's a false negative.


playground

@ghost ghost added C-bug Category: Clippy is not doing the correct thing I-false-negative Issue: The lint should have been triggered on code, but wasn't labels Oct 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing I-false-negative Issue: The lint should have been triggered on code, but wasn't
Projects
None yet
Development

No branches or pull requests

0 participants