Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/syntax/src/hacks.rs')
-rw-r--r--crates/syntax/src/hacks.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/crates/syntax/src/hacks.rs b/crates/syntax/src/hacks.rs
index 112b912ade..a047f61fa0 100644
--- a/crates/syntax/src/hacks.rs
+++ b/crates/syntax/src/hacks.rs
@@ -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 {