diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-03-20 08:26:15 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-03-20 08:26:15 +0000 |
commit | 467a040509cd6732de48907e025f83b57b5701b9 (patch) | |
tree | 217fec908db7dbcd39e5b452d43257a9f2977c53 /crates/ra_ide/src/completion/complete_keyword.rs | |
parent | e0952899aee50b813379ca8e6dcab49a895ff0a0 (diff) | |
parent | b5ba9c3e3ae25b6add36c670de75967a7b38bb53 (diff) |
Merge #3623
3623: 'Fill match arms' should work with existing match arms r=matklad a=slyngbaek
Addresses #3039
This essentially adds missing match arms. The algorithm for this
can get complicated rather quickly so bail in certain conditions
and rely on a PlaceholderPat.
The algorighm works as such:
- Iterate through the Enum Def Variants
- Attempt to see if the variant already exists as a match arm
- If yes, skip the enum variant. If no, include it.
- If it becomes complicated, rather than exhaustively deal with every
branch, mark it as a "partial match" and simply include the
placeholder.
Conditions for "complication":
- The match arm contains a match guard
- Any kind of nested destrucuring
Order the resulting merged match branches as such:
1. Provided match arms
2. Missing enum variant branch arms
3. End with Placeholder if required
- Add extra tests
Co-authored-by: Steffen Lyngbaek <[email protected]>
Diffstat (limited to 'crates/ra_ide/src/completion/complete_keyword.rs')
0 files changed, 0 insertions, 0 deletions