From 60706fca8e6187e0abf322c4c144ccb19fec1ae7 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 31 Aug 2020 15:43:37 +0200 Subject: Remove dead code --- crates/syntax/src/ast/make.rs | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'crates/syntax/src') diff --git a/crates/syntax/src/ast/make.rs b/crates/syntax/src/ast/make.rs index 7ba625990..a83f76857 100644 --- a/crates/syntax/src/ast/make.rs +++ b/crates/syntax/src/ast/make.rs @@ -144,10 +144,6 @@ fn expr_from_text(text: &str) -> ast::Expr { ast_from_text(&format!("const C: () = {};", text)) } -pub fn try_expr_from_text(text: &str) -> Option { - try_ast_from_text(&format!("const C: () = {};", text)) -} - pub fn condition(expr: ast::Expr, pattern: Option) -> ast::Condition { match pattern { None => ast_from_text(&format!("const _: () = while {} {{}};", expr)), @@ -332,16 +328,6 @@ fn ast_from_text(text: &str) -> N { node } -fn try_ast_from_text(text: &str) -> Option { - let parse = SourceFile::parse(text); - let node = parse.tree().syntax().descendants().find_map(N::cast)?; - let node = node.syntax().clone(); - let node = unroot(node); - let node = N::cast(node).unwrap(); - assert_eq!(node.syntax().text_range().start(), 0.into()); - Some(node) -} - fn unroot(n: SyntaxNode) -> SyntaxNode { SyntaxNode::new_root(n.green().clone()) } -- cgit v1.2.3 From b1f59ff6c1dcb88f75e999324d6bb95dfdb78da3 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 31 Aug 2020 15:47:42 +0200 Subject: Reduce path_from_text usage --- crates/syntax/src/ast/make.rs | 1 + 1 file changed, 1 insertion(+) (limited to 'crates/syntax/src') diff --git a/crates/syntax/src/ast/make.rs b/crates/syntax/src/ast/make.rs index a83f76857..c2c938ad1 100644 --- a/crates/syntax/src/ast/make.rs +++ b/crates/syntax/src/ast/make.rs @@ -33,6 +33,7 @@ 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)) } +// FIXME: make this private pub fn path_from_text(text: &str) -> ast::Path { ast_from_text(text) } -- cgit v1.2.3