rust-clippy
rust-clippy copied to clipboard
new lint: and_then_then_some
fixes #12978
changelog: [and_then_then_some]: added
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Centri3 (or someone else) some time within the next two weeks.
Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:
@rustbot author: the review is finished, PR author should check the comments and take action accordingly@rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue
unable to reproduce formatting errors locally, cargo dev fmt --check runs fine
ok apparently it just started working again, no idea why that happened.
Maybe this could be merge to the existing lint
clippy::manual_filter?
that lint isn't machine applicable. additionally, it's not a nursury lint.
@rustbot review
Maybe this could be merge to the existing lint
clippy::manual_filter?that lint isn't machine applicable. additionally, it's not a
nursurylint.
Two suggestions can have differing applicability. Also imo this shouldn't be nursery, it seems completely fine once the issue regarding FnDecl is resolved
ah just got back from work, looks like a lot discussion has happened so I'm gonna clear something really quick then throw myself out :D
that lint isn't machine applicable.
I think it is? The applicability was initialized as MachineApplicable in manual_utils.rs, later passed to manual_filter via SuggInfo. You may keep this lint as a separated one consider how complicated the other one looks, plus this one checks different thing anyway.
But just keep in mind about putting lints in 'nursery', they would receive less testing and not being as useful as the other lints.
I've ran lintcheck on top 200 popular crate with this lint, unfortunately I didn't see any thing related, putting it in 'nursery' is just further limiting it's useages, so agree with Centri3 that this shouldn't be a 'nursery' lint, at least for now
I've ran lintcheck on top 200 popular crate with this lint, unfortunately I didn't see any thing related, putting it in 'nursery' is just further limiting it's useages, so agree with Centri3 that this shouldn't be a 'nursery' lint, at least for now
the problem is false positives, since the pre and post transformation code actually has different signatures (goes from by value to by reference).
Hmm I see. we can fix that by adding a & to filter's signature if it's Copy, check clippy_utils::ty::is_copy. Otherwise it should be non-applicable if it's !Copy yet warn-by-default
Also, if the original type is a reference then it's Copy automatically so that's another case that's very nicely handled.
also, if the argument variable only appears in autoreferencing method calls (like in the current tests) it should be possible.
:umbrella: The latest upstream changes (presumably #12873) made this pull request unmergeable. Please resolve the merge conflicts.
Hmm I see. we can fix that by adding a
&tofilter's signature if it'sCopy, checkclippy_utils::ty::is_copy. Otherwise it should be non-applicable if it's!Copyyet warn-by-defaultAlso, if the original type is a reference then it's
Copyautomatically so that's another case that's very nicely handled.
I think this false positive I'm worried about might actually be mathematically impossible, since it requires a non-copy value to be moved in the predicate, then moved into the argument of then_some, which would fail borrow checking.
Hey, this is triage. It looks like @Centri3 is currently busy. Let's pick another reviewer:
r? clippy
Rerolling these, I'm currently focused on our project's goal, see https://github.com/rust-lang/rust-clippy/pull/13154
r? clippy
r? clippy
rerolling again, I'm wrapping up vacation and will be on airplanes for a while
:umbrella: The latest upstream changes (presumably #11476) made this pull request unmergeable. Please resolve the merge conflicts.
I'll get to review this, seems that it's been kinda forgotten by the team. We should have a review soon.
i've kinda abandoned it since it seems like there might already be a lint for this?
:umbrella: The latest upstream changes (possibly d28d2344d000aa96bef729cf408731f952f71fb0) made this pull request unmergeable. Please resolve the merge conflicts.
Ping @lolbinarycat from triage. I think this is waiting on a review, but do you plan to come back to working on this?