Skip to content

Commit 0f0c044

Browse files
authored
Rollup merge of rust-lang#103593 - compiler-errors:nit-remove-returns, r=fee1-dead
Remove an unused parser function (`Expr::returns`) I removed the only usage in rust-lang#97474
2 parents 29698dc + d380d03 commit 0f0c044

File tree

1 file changed

+0
-18
lines changed

1 file changed

+0
-18
lines changed

compiler/rustc_ast/src/ast.rs

-18
Original file line numberDiff line numberDiff line change
@@ -1112,24 +1112,6 @@ pub struct Expr {
11121112
}
11131113

11141114
impl Expr {
1115-
/// Returns `true` if this expression would be valid somewhere that expects a value;
1116-
/// for example, an `if` condition.
1117-
pub fn returns(&self) -> bool {
1118-
if let ExprKind::Block(ref block, _) = self.kind {
1119-
match block.stmts.last().map(|last_stmt| &last_stmt.kind) {
1120-
// Implicit return
1121-
Some(StmtKind::Expr(_)) => true,
1122-
// Last statement is an explicit return?
1123-
Some(StmtKind::Semi(expr)) => matches!(expr.kind, ExprKind::Ret(_)),
1124-
// This is a block that doesn't end in either an implicit or explicit return.
1125-
_ => false,
1126-
}
1127-
} else {
1128-
// This is not a block, it is a value.
1129-
true
1130-
}
1131-
}
1132-
11331115
/// Is this expr either `N`, or `{ N }`.
11341116
///
11351117
/// If this is not the case, name resolution does not resolve `N` when using

0 commit comments

Comments
 (0)