mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-26 20:09:19 +00:00
dead code
This commit is contained in:
parent
bfc263f1f9
commit
660cf34d8c
8 changed files with 9 additions and 70 deletions
|
@ -5,6 +5,7 @@
|
|||
use crate::{ast, AstNode};
|
||||
|
||||
pub fn parse_expr_from_str(s: &str) -> Option<ast::Expr> {
|
||||
let s = s.trim();
|
||||
let file = ast::SourceFile::parse(&format!("const _: () = {};", s));
|
||||
let expr = file.syntax_node().descendants().find_map(ast::Expr::cast)?;
|
||||
if expr.syntax().text() != s {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue