Auto merge of #80503 - JohnTitor:rollup-b26vglu, r=JohnTitor
Rollup of 13 pull requests Successful merges: - #79812 (Lint on redundant trailing semicolon after item) - #80348 (remove redundant clones (clippy::redundant_clone)) - #80358 (Edit rustc_span documentation) - #80457 (Add missing commas to `rustc_ast_pretty::pp` docs) - #80461 (Add llvm-libunwind change to bootstrap CHANGELOG) - #80464 (Use Option::map_or instead of open coding it) - #80465 (Fix typo in ffi-pure.md) - #80467 (More uses of the matches! macro) - #80469 (Fix small typo in time comment) - #80472 (Use sans-serif font for the "all items" page links) - #80477 (Make forget intrinsic safe) - #80482 (don't clone copy types) - #80487 (don't redundantly repeat field names) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
d107a87d34
39 changed files with 164 additions and 142 deletions
|
@ -1092,15 +1092,9 @@ impl Expr {
|
|||
if let ExprKind::Block(ref block, _) = self.kind {
|
||||
match block.stmts.last().map(|last_stmt| &last_stmt.kind) {
|
||||
// Implicit return
|
||||
Some(&StmtKind::Expr(_)) => true,
|
||||
Some(&StmtKind::Semi(ref expr)) => {
|
||||
if let ExprKind::Ret(_) = expr.kind {
|
||||
// Last statement is explicit return.
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
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,
|
||||
}
|
||||
|
@ -1950,7 +1944,7 @@ impl TyKind {
|
|||
}
|
||||
|
||||
pub fn is_unit(&self) -> bool {
|
||||
if let TyKind::Tup(ref tys) = *self { tys.is_empty() } else { false }
|
||||
matches!(self, TyKind::Tup(tys) if tys.is_empty())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue