Skip to content

Commit af82c3d

Browse files
committed
tiny clean-up
1 parent 472768a commit af82c3d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

clippy_lints/src/returns.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,9 @@ impl RetReplacement<'_> {
162162
impl Display for RetReplacement<'_> {
163163
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
164164
match self {
165-
Self::Empty => write!(f, ""),
166-
Self::Block => write!(f, "{{}}"),
167-
Self::Unit => write!(f, "()"),
165+
Self::Empty => f.write_str(""),
166+
Self::Block => f.write_str("{}"),
167+
Self::Unit => f.write_str("()"),
168168
Self::NeedsPar(inner, _) => write!(f, "({inner})"),
169169
Self::Expr(inner, _) => write!(f, "{inner}"),
170170
}
@@ -228,7 +228,7 @@ impl<'tcx> LateLintPass<'tcx> for Return {
228228
fn check_block(&mut self, cx: &LateContext<'tcx>, block: &'tcx Block<'_>) {
229229
// we need both a let-binding stmt and an expr
230230
if let Some(retexpr) = block.expr
231-
&& let Some(stmt) = block.stmts.iter().last()
231+
&& let Some(stmt) = block.stmts.last()
232232
&& let StmtKind::Let(local) = &stmt.kind
233233
&& local.ty.is_none()
234234
&& cx.tcx.hir_attrs(local.hir_id).is_empty()
@@ -315,7 +315,7 @@ fn check_block_return<'tcx>(cx: &LateContext<'tcx>, expr_kind: &ExprKind<'tcx>,
315315
if let ExprKind::Block(block, _) = expr_kind {
316316
if let Some(block_expr) = block.expr {
317317
check_final_expr(cx, block_expr, semi_spans, RetReplacement::Empty, None);
318-
} else if let Some(stmt) = block.stmts.iter().last() {
318+
} else if let Some(stmt) = block.stmts.last() {
319319
match stmt.kind {
320320
StmtKind::Expr(expr) => {
321321
check_final_expr(cx, expr, semi_spans, RetReplacement::Empty, None);

0 commit comments

Comments
 (0)