diff options
author | Matthew Hall <[email protected]> | 2020-04-01 22:26:41 +0100 |
---|---|---|
committer | Matthew Hall <[email protected]> | 2020-04-01 22:26:41 +0100 |
commit | 1fee60181fea56ebe6b5e4aeb11cf9df25a1d087 (patch) | |
tree | 0a157b2f478a2b4334167da483f401d0ba5e4938 /crates/ra_syntax/src/ast | |
parent | 1c2d4135db867efe335a0654d86429bea7bb9caf (diff) |
Add impl From for enum variant assist
Basically adds a From impl for tuple enum variants with one field. Added
to cover the fairly common case of implementing your own Error that can
be created from another one, although other use cases exist.
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 | ||