aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-08-31 14:43:37 +0100
committerAleksey Kladov <[email protected]>2020-08-31 14:46:57 +0100
commit60706fca8e6187e0abf322c4c144ccb19fec1ae7 (patch)
tree1a2bb26a7f4035b75a17d1eec2316e7d0f3e84a3
parentac4b134c6be27642dbe915f32a41f9a21bd0c1c9 (diff)
Remove dead code
-rw-r--r--crates/syntax/src/ast/make.rs14
1 files changed, 0 insertions, 14 deletions
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 {
144 ast_from_text(&format!("const C: () = {};", text)) 144 ast_from_text(&format!("const C: () = {};", text))
145} 145}
146 146
147pub fn try_expr_from_text(text: &str) -> Option<ast::Expr> {
148 try_ast_from_text(&format!("const C: () = {};", text))
149}
150
151pub fn condition(expr: ast::Expr, pattern: Option<ast::Pat>) -> ast::Condition { 147pub fn condition(expr: ast::Expr, pattern: Option<ast::Pat>) -> ast::Condition {
152 match pattern { 148 match pattern {
153 None => ast_from_text(&format!("const _: () = while {} {{}};", expr)), 149 None => ast_from_text(&format!("const _: () = while {} {{}};", expr)),
@@ -332,16 +328,6 @@ fn ast_from_text<N: AstNode>(text: &str) -> N {
332 node 328 node
333} 329}
334 330
335fn try_ast_from_text<N: AstNode>(text: &str) -> Option<N> {
336 let parse = SourceFile::parse(text);
337 let node = parse.tree().syntax().descendants().find_map(N::cast)?;
338 let node = node.syntax().clone();
339 let node = unroot(node);
340 let node = N::cast(node).unwrap();
341 assert_eq!(node.syntax().text_range().start(), 0.into());
342 Some(node)
343}
344
345fn unroot(n: SyntaxNode) -> SyntaxNode { 331fn unroot(n: SyntaxNode) -> SyntaxNode {
346 SyntaxNode::new_root(n.green().clone()) 332 SyntaxNode::new_root(n.green().clone())
347} 333}