From 1fee60181fea56ebe6b5e4aeb11cf9df25a1d087 Mon Sep 17 00:00:00 2001 From: Matthew Hall Date: Wed, 1 Apr 2020 22:26:41 +0100 Subject: 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. --- crates/ra_syntax/src/ast/make.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'crates/ra_syntax/src') 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 { pub fn path_qualified(qual: ast::Path, segment: ast::PathSegment) -> ast::Path { path_from_text(&format!("{}::{}", qual, segment)) } -fn path_from_text(text: &str) -> ast::Path { + +pub fn path_from_text(text: &str) -> ast::Path { ast_from_text(text) } -- cgit v1.2.3