Skip to content

Commit

Permalink
remove unused parser fn
Browse files Browse the repository at this point in the history
  • Loading branch information
compiler-errors committed Oct 26, 2022
1 parent 43dd3d5 commit d380d03
Showing 1 changed file with 0 additions and 18 deletions.
18 changes: 0 additions & 18 deletions compiler/rustc_ast/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1112,24 +1112,6 @@ pub struct Expr {
}

impl Expr {
/// Returns `true` if this expression would be valid somewhere that expects a value;
/// for example, an `if` condition.
pub fn returns(&self) -> bool {
if let ExprKind::Block(ref block, _) = self.kind {
match block.stmts.last().map(|last_stmt| &last_stmt.kind) {
// Implicit return
Some(StmtKind::Expr(_)) => true,
// Last statement is an explicit return?
Some(StmtKind::Semi(expr)) => matches!(expr.kind, ExprKind::Ret(_)),
// This is a block that doesn't end in either an implicit or explicit return.
_ => false,
}
} else {
// This is not a block, it is a value.
true
}
}

/// Is this expr either `N`, or `{ N }`.
///
/// If this is not the case, name resolution does not resolve `N` when using
Expand Down

0 comments on commit d380d03

Please sign in to comment.