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 #4415

Closed
wants to merge 2 commits into from
Closed

Add result_and_then_ok lint #4415

wants to merge 2 commits into from

Conversation

printfn
Copy link

@printfn printfn commented Aug 19, 2019

changelog: add result_and_then_ok lint to warn about result.and_then(|o| Ok(x)) and suggest replacing with result.map(|o| x).

clippy_lints/src/methods/mod.rs Outdated Show resolved Hide resolved
clippy_lints/src/methods/mod.rs Outdated Show resolved Hide resolved
tests/ui/option_and_then_some.rs Outdated Show resolved Hide resolved
@printfn
Copy link
Author

printfn commented Aug 19, 2019

Thanks for reviewing! I've now re-added the regression tests (with an allow attribute), renamed the variables and hopefully fixed the documentation code.

@flip1995
Copy link
Member

Thanks for implementing this lint so fast after the other was finished!

You should be able to share most of the Code of the option_and_then_some lint. Please deduplicate as much code as possible and implement the two lints in one function. (That's actually the tricky part of adding this lint 😉)

@phansch phansch added the S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status) label Aug 20, 2019
@bors
Copy link
Collaborator

bors commented Sep 4, 2019

☔ The latest upstream changes (presumably #4498) made this pull request unmergeable. Please resolve the merge conflicts.

@hellow554
Copy link
Contributor

@printfn please edit your first post and add one of the closing keywords github provides together with the issue number 4412, e.g.

closes #4412

@flip1995 flip1995 added the A-lint Area: New lints label Nov 25, 2019
@flip1995
Copy link
Member

implemented in #5529

@flip1995 flip1995 closed this May 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: New lints S-waiting-on-author Status: This is awaiting some action from the author. (Use `@rustbot ready` to update this status)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants