From d5c5b7cd12e6149eb3d9e269a6b7c77fb8d66eaa Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 2 Oct 2021 15:26:02 +0300 Subject: [PATCH] internal: remove deprecated method --- crates/ide_assists/src/handlers/replace_if_let_with_match.rs | 5 ++++- crates/syntax/src/ast/node_ext.rs | 3 --- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/ide_assists/src/handlers/replace_if_let_with_match.rs b/crates/ide_assists/src/handlers/replace_if_let_with_match.rs index 019e8b61607..22675fbee0f 100644 --- a/crates/ide_assists/src/handlers/replace_if_let_with_match.rs +++ b/crates/ide_assists/src/handlers/replace_if_let_with_match.rs @@ -253,7 +253,10 @@ fn pick_pattern_and_expr_order( fn is_empty_expr(expr: &ast::Expr) -> bool { match expr { - ast::Expr::BlockExpr(expr) => expr.is_empty(), + ast::Expr::BlockExpr(expr) => match expr.stmt_list() { + Some(it) => it.statements().next().is_none() && it.tail_expr().is_none(), + None => true, + }, ast::Expr::TupleExpr(expr) => expr.fields().next().is_none(), _ => false, } diff --git a/crates/syntax/src/ast/node_ext.rs b/crates/syntax/src/ast/node_ext.rs index a07f02e4451..c0352f9b134 100644 --- a/crates/syntax/src/ast/node_ext.rs +++ b/crates/syntax/src/ast/node_ext.rs @@ -58,9 +58,6 @@ pub fn items(&self) -> impl Iterator { self.stmt_list().into_iter().flat_map(|it| it.items()) } - pub fn is_empty(&self) -> bool { - self.statements().next().is_none() && self.tail_expr().is_none() - } pub fn statements(&self) -> impl Iterator { self.stmt_list().into_iter().flat_map(|it| it.statements()) }