diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-02-27 14:29:10 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-02-27 14:29:10 +0000 |
commit | 4a24edd989720f1232d8f6a660d790ae77115964 (patch) | |
tree | 6efdc9d6ce4a1c9e8c886c1b3e70a17d6a19fe7b /crates/syntax/test_data/parser/fragments | |
parent | 2a4076c14d0e3f7ae03908c2b9cd1a52851d401c (diff) | |
parent | 558bcf4e0bf9d94ab51238e59f6fc5c170f38c3e (diff) |
Merge #7677
7677: More enum matching r=yoshuawuyts a=jDomantas
* Renamed existing `generate_enum_match_method` to `generate_enum_is_variant`
* Added two similar assists to generate `into_` and `as_` methods.
* Made all of them general enough to work on record and tuple variants too.
For `as_` method generation there's room to improve:
* Right now it always returns `Option<&Field>`, even though `Option<Field>` would be nicer when `Field: Copy`. I don't know how to check if the field type implements `Copy`. If given suggestions I could try to fix this in a follow-up pr.
* `&String` could be replaced with `&str`, `&Box<_>` with `&_`, and probably some more. I don't know what would be a good way to do that.
Closes #7604
Co-authored-by: Domantas Jadenkus <[email protected]>
Diffstat (limited to 'crates/syntax/test_data/parser/fragments')
0 files changed, 0 insertions, 0 deletions