diff --git a/crates/syntax/src/ast/make.rs b/crates/syntax/src/ast/make.rs index 7ba6259900..a83f768578 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()) }