mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-25 20:43:21 +00:00
Remove dead code
This commit is contained in:
parent
ac4b134c6b
commit
60706fca8e
1 changed files with 0 additions and 14 deletions
|
@ -144,10 +144,6 @@ fn expr_from_text(text: &str) -> ast::Expr {
|
||||||
ast_from_text(&format!("const C: () = {};", text))
|
ast_from_text(&format!("const C: () = {};", text))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn try_expr_from_text(text: &str) -> Option<ast::Expr> {
|
|
||||||
try_ast_from_text(&format!("const C: () = {};", text))
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn condition(expr: ast::Expr, pattern: Option<ast::Pat>) -> ast::Condition {
|
pub fn condition(expr: ast::Expr, pattern: Option<ast::Pat>) -> ast::Condition {
|
||||||
match pattern {
|
match pattern {
|
||||||
None => ast_from_text(&format!("const _: () = while {} {{}};", expr)),
|
None => ast_from_text(&format!("const _: () = while {} {{}};", expr)),
|
||||||
|
@ -332,16 +328,6 @@ fn ast_from_text<N: AstNode>(text: &str) -> N {
|
||||||
node
|
node
|
||||||
}
|
}
|
||||||
|
|
||||||
fn try_ast_from_text<N: AstNode>(text: &str) -> Option<N> {
|
|
||||||
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 {
|
fn unroot(n: SyntaxNode) -> SyntaxNode {
|
||||||
SyntaxNode::new_root(n.green().clone())
|
SyntaxNode::new_root(n.green().clone())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue