Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/syntax/src/ast/node_ext.rs')
-rw-r--r--crates/syntax/src/ast/node_ext.rs36
1 files changed, 0 insertions, 36 deletions
diff --git a/crates/syntax/src/ast/node_ext.rs b/crates/syntax/src/ast/node_ext.rs
index 2915e7aab1..5ff6519c9c 100644
--- a/crates/syntax/src/ast/node_ext.rs
+++ b/crates/syntax/src/ast/node_ext.rs
@@ -528,42 +528,6 @@ impl ast::Item {
}
}
-impl ast::Expr {
- /// Returns the `let` only if there is exactly one (that is, `let pat = expr`
- /// or `((let pat = expr))`, but not `let pat = expr && expr` or `non_let_expr`).
- pub fn single_let(&self) -> Option<ast::LetExpr> {
- return get_pat(self.clone());
-
- fn get_pat(expr: ast::Expr) -> Option<ast::LetExpr> {
- match expr {
- ast::Expr::ParenExpr(expr) => expr.expr().and_then(get_pat),
- ast::Expr::LetExpr(expr) => Some(expr),
- _ => None,
- }
- }
- }
-
- pub fn is_pattern_cond(&self) -> bool {
- return contains_let(self.clone());
-
- fn contains_let(expr: ast::Expr) -> bool {
- match expr {
- ast::Expr::BinExpr(expr)
- if expr.op_kind() == Some(ast::BinaryOp::LogicOp(ast::LogicOp::And)) =>
- {
- expr.lhs()
- .map(contains_let)
- .or_else(|| expr.rhs().map(contains_let))
- .unwrap_or(false)
- }
- ast::Expr::ParenExpr(expr) => expr.expr().map_or(false, contains_let),
- ast::Expr::LetExpr(_) => true,
- _ => false,
- }
- }
- }
-}
-
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum FieldKind {
Name(ast::NameRef),