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') 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