new lint: explicit_into_iter_fn_arg#10814
Merged
Merged
Conversation
Collaborator
|
r? @llogiq (rustbot has picked a reviewer for you, use r? to override) |
llogiq
reviewed
May 23, 2023
llogiq
left a comment
Contributor
There was a problem hiding this comment.
This looks good in general, I only have a scant few suggestions.
Contributor
|
☔ The latest upstream changes (presumably #10810) made this pull request unmergeable. Please resolve the merge conflicts. |
Contributor
|
One small idea for improvement: If there are multiple @bors r+ |
Contributor
Contributor
Contributor
|
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
bors
added a commit
that referenced
this pull request
Jun 3, 2023
[`useless_conversion`]: pluralize if there are multiple `.into_iter()` calls context: #10814 (comment) changelog: [`useless_conversion`]: pluralize if there are multiple `.into_iter()` calls in the chain r? `@llogiq`
bors
added a commit
that referenced
this pull request
Aug 17, 2023
[`useless_conversion`]: only lint on paths to fn items and fix FP in macro Fixes #11065 (which is actually two issues: an ICE and a false positive) It now makes sure that the function call path points to a function-like item (and not e.g. a `const` like in the linked issue), so that calling `TyCtxt::fn_sig` later in the lint does not ICE (fixes #11065 (comment)). It *also* makes sure that the expression is not part of a macro call (fixes #11065 (comment)). ~~I'm not sure if there's a better way to check this other than to walk the parent expr chain and see if any of them are expansions.~~ (edit: it doesn't do this anymore) changelog: [`useless_conversion`]: fix ICE when call receiver is a non-fn item changelog: [`useless_conversion`]: don't lint if argument is a macro argument (fixes a FP) r? `@llogiq` (reviewed #10814, which introduced these issues)
flip1995
pushed a commit
to flip1995/rust-clippy
that referenced
this pull request
Aug 24, 2023
[`useless_conversion`]: only lint on paths to fn items and fix FP in macro Fixes rust-lang#11065 (which is actually two issues: an ICE and a false positive) It now makes sure that the function call path points to a function-like item (and not e.g. a `const` like in the linked issue), so that calling `TyCtxt::fn_sig` later in the lint does not ICE (fixes rust-lang#11065 (comment)). It *also* makes sure that the expression is not part of a macro call (fixes rust-lang#11065 (comment)). ~~I'm not sure if there's a better way to check this other than to walk the parent expr chain and see if any of them are expansions.~~ (edit: it doesn't do this anymore) changelog: [`useless_conversion`]: fix ICE when call receiver is a non-fn item changelog: [`useless_conversion`]: don't lint if argument is a macro argument (fixes a FP) r? `@llogiq` (reviewed rust-lang#10814, which introduced these issues)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #10743.
This adds a lint that looks for
.into_iter()calls in a call expression to a function that already expects anIntoIterator. In those cases, explicitly calling.into_iter()is unnecessary.There were a few instances of this in clippy itself so I fixed those as well in this PR.
changelog: new lint [
explicit_into_iter_fn_arg]