Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-ssr/src/fragments.rs')
| -rw-r--r-- | crates/ide-ssr/src/fragments.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/crates/ide-ssr/src/fragments.rs b/crates/ide-ssr/src/fragments.rs index 503754afe7..4d6809efbe 100644 --- a/crates/ide-ssr/src/fragments.rs +++ b/crates/ide-ssr/src/fragments.rs @@ -35,7 +35,9 @@ pub(crate) fn stmt(s: &str) -> Result<SyntaxNode, ()> { parse.tree().syntax().descendants().skip(2).find_map(ast::Stmt::cast).ok_or(())?; if !s.ends_with(';') && node.to_string().ends_with(';') { node = node.clone_for_update(); - node.syntax().last_token().map(|it| it.detach()); + if let Some(it) = node.syntax().last_token() { + it.detach() + } } if node.to_string() != s { return Err(()); |