Skip to content
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

Add result_and_then_ok lint #4412

Closed
flip1995 opened this issue Aug 19, 2019 · 3 comments
Closed

Add result_and_then_ok lint #4412

flip1995 opened this issue Aug 19, 2019 · 3 comments
Labels
A-lint Area: New lints good-first-issue These issues are a good way to get started with Clippy L-complexity Lint: Belongs in the complexity lint group L-suggestion Lint: Improving, adding or fixing lint suggestions

Comments

@flip1995
Copy link
Member

In #4386 the option_and_then_some lint was added. This can also be implemented for result_and_then_ok:

fn foo() -> Result<(), ()> {
    let x = Ok(10);
    x.and_then(Ok); // This is a noop -> `x`
    x.and_then(|x| Some(..)); // This should be a `map` -> `x.map(|x| ..)`
}

Originally posted by @flip1995 in #4386

@flip1995 flip1995 added L-complexity Lint: Belongs in the complexity lint group L-suggestion Lint: Improving, adding or fixing lint suggestions good-first-issue These issues are a good way to get started with Clippy A-lint Area: New lints labels Aug 19, 2019
@printfn
Copy link

printfn commented Aug 19, 2019

I'd like to try and implement this.

@printfn
Copy link

printfn commented Aug 19, 2019

I've created a pull request #4415.

@alex-700
Copy link
Contributor

fixed in #5529

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: New lints good-first-issue These issues are a good way to get started with Clippy L-complexity Lint: Belongs in the complexity lint group L-suggestion Lint: Improving, adding or fixing lint suggestions
Projects
None yet
Development

No branches or pull requests

3 participants