Suggest unwrap_or_else when a closure is given#102441
Merged
bors merged 1 commit intorust-lang:masterfrom Oct 4, 2022
Merged
Conversation
Member
Author
|
May need more work to expand to suggest |
chenyukang
commented
Sep 28, 2022
fcc5a23 to
5c3a8e2
Compare
compiler-errors
suggested changes
Sep 29, 2022
Collaborator
|
☔ The latest upstream changes (presumably #102545) made this pull request unmergeable. Please resolve the merge conflicts. |
5c3a8e2 to
aebc5e1
Compare
This comment has been minimized.
This comment has been minimized.
aebc5e1 to
5d69f3a
Compare
… to unwrap_or instead of suggesting calling it
5d69f3a to
f712c41
Compare
Contributor
There was a problem hiding this comment.
This doesn't need to be an argument. Can you inline the can_coerce call here by passing in expected: Ty<'tcx>?
Contributor
There was a problem hiding this comment.
I think there is an expr_ty_opt version of this that doesn't ICE if the node is missing a type If so, then please use that, just in case.
Contributor
There was a problem hiding this comment.
Suggested change
| fn_args.len() == args.len() +1 { | |
| fn_args.len() == args.len() + 1 { |
Comment on lines
2366
to
2367
Contributor
There was a problem hiding this comment.
Suggested change
| let fn_ty = self.tcx.type_of(pick.item.def_id) && | |
| let fn_sig = fn_ty.fn_sig(self.tcx) && | |
| let fn_sig = self.tcx.fn_sig(pick.item.def_id) && |
Contributor
|
Few more nits |
f712c41 to
0188273
Compare
Member
Author
Fixed, thanks! |
Contributor
|
Hm, this suggestion might have some false positives still, but this is probably ok... @bors r+ |
Collaborator
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Oct 4, 2022
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#102441 (Suggest unwrap_or_else when a closure is given) - rust-lang#102547 (Migrate CSS theme for search results) - rust-lang#102567 (Delay evaluating lint primary message until after it would be suppressed) - rust-lang#102624 (rustdoc: remove font family CSS on `.rustdoc-toggle summary::before`) - rust-lang#102628 (Change the parameter name of From::from to `value`) - rust-lang#102637 (Ignore fuchsia on two compiler tests) - rust-lang#102639 (Improve spans when splitting multi-char operator tokens for proc macros.) Failed merges: - rust-lang#102496 (Suggest `.into()` when all other coercion suggestions fail) r? `@ghost` `@rustbot` modify labels: rollup
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.
Fixes #102320
r? @compiler-errors