diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-04-03 08:46:46 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-04-03 08:46:46 +0100 |
commit | 2cee8531c5236ae7d66717bea604f1224c23ea56 (patch) | |
tree | b2e2de013f8c028b5cd70ac421c8e8f7d4c6bfb5 /crates/ra_syntax/src/ast | |
parent | 642f3f4bd62019d8c0fdd6304ff07d87a5aca627 (diff) | |
parent | 6a2127be28a837215801f4ac3cd7d46ef7c4485b (diff) |
Merge #3814
3814: Add impl From for enum variant assist r=flodiebold a=mattyhall
Basically adds a From impl for tuple enum variants with one field. It was recommended to me on the zulip to maybe try using the trait solver, but I had trouble with that as, although it could resolve the trait impl, it couldn't resolve the variable unambiguously in real use. I'm also unsure of how it would work if there were already multiple From impls to resolve - I can't see a way we could get more than one solution to my query.
Fixes #3766
Co-authored-by: Matthew Hall <[email protected]>
Diffstat (limited to 'crates/ra_syntax/src/ast')
-rw-r--r-- | crates/ra_syntax/src/ast/make.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/crates/ra_syntax/src/ast/make.rs b/crates/ra_syntax/src/ast/make.rs index 0c908573d..c49cf9a3b 100644 --- a/crates/ra_syntax/src/ast/make.rs +++ b/crates/ra_syntax/src/ast/make.rs | |||
@@ -22,7 +22,8 @@ pub fn path_unqualified(segment: ast::PathSegment) -> ast::Path { | |||
22 | pub fn path_qualified(qual: ast::Path, segment: ast::PathSegment) -> ast::Path { | 22 | pub fn path_qualified(qual: ast::Path, segment: ast::PathSegment) -> ast::Path { |
23 | path_from_text(&format!("{}::{}", qual, segment)) | 23 | path_from_text(&format!("{}::{}", qual, segment)) |
24 | } | 24 | } |
25 | fn path_from_text(text: &str) -> ast::Path { | 25 | |
26 | pub fn path_from_text(text: &str) -> ast::Path { | ||
26 | ast_from_text(text) | 27 | ast_from_text(text) |
27 | } | 28 | } |
28 | 29 | ||