diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-02-13 15:56:17 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-02-13 15:56:17 +0000 |
commit | 2967e783ac53e89f06a8f8bd1afc12433311fded (patch) | |
tree | d46451d2029fe7842a654feec4c1bbf8246d1829 /crates/assists/src/tests | |
parent | 11ebbac3a4a962701639bb14a4a5a7309399d7e8 (diff) | |
parent | b07f530e3ae025c57b2b64e8ebb2852e60bced7b (diff) |
Merge #7659
7659: Improve "Generate From impl" r=Veykril a=jDomantas
* Allows any field type. Previously it was restricted to path types, but I don't see why it couldn't apply to all other types too. (the main reason for is PR is that I'm too lazy to write out `From<&'static str>` by hand 😄)
* More correct handling for generic enums - previously it wouldn't emit generic params on the impl.
* Also accepts variants with named field.
The impl generation code got mostly copy-pasted from generate_impl assist - please tell if there's an easy way to avoid this duplication.
Co-authored-by: Domantas Jadenkus <[email protected]>
Diffstat (limited to 'crates/assists/src/tests')
-rw-r--r-- | crates/assists/src/tests/generated.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/crates/assists/src/tests/generated.rs b/crates/assists/src/tests/generated.rs index 6f2b22bc2..0516deaff 100644 --- a/crates/assists/src/tests/generated.rs +++ b/crates/assists/src/tests/generated.rs | |||
@@ -499,7 +499,7 @@ enum A { One(u32) } | |||
499 | 499 | ||
500 | impl From<u32> for A { | 500 | impl From<u32> for A { |
501 | fn from(v: u32) -> Self { | 501 | fn from(v: u32) -> Self { |
502 | A::One(v) | 502 | Self::One(v) |
503 | } | 503 | } |
504 | } | 504 | } |
505 | "#####, | 505 | "#####, |