mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 13:51:31 +00:00
fix 2190; add test for "replace if let with match"
This commit is contained in:
parent
7a5fd1f3f3
commit
bcb2ea912b
3 changed files with 58 additions and 5 deletions
|
@ -38,9 +38,6 @@ fn prev_tokens(token: SyntaxToken) -> impl Iterator<Item = SyntaxToken> {
|
|||
pub fn extract_trivial_expression(expr: &ast::BlockExpr) -> Option<ast::Expr> {
|
||||
let block = expr.block()?;
|
||||
let expr = block.expr()?;
|
||||
if expr.syntax().text().contains_char('\n') {
|
||||
return None;
|
||||
}
|
||||
let non_trivial_children = block.syntax().children().filter(|it| match it.kind() {
|
||||
WHITESPACE | T!['{'] | T!['}'] => false,
|
||||
_ => it != expr.syntax(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue