Skip to content

Commit 4a02ae9

Browse files
committed
cargo dev fmt
1 parent 040d45e commit 4a02ae9

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

clippy_lints/src/copies.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -195,10 +195,7 @@ fn lint_if_same_then_else(cx: &LateContext<'_>, conds: &[&Expr<'_>], blocks: &[&
195195
.array_windows::<2>()
196196
.enumerate()
197197
.fold(true, |all_eq, (i, &[lhs, rhs])| {
198-
if eq.eq_block(lhs, rhs)
199-
&& !contains_let(conds[i])
200-
&& conds.get(i + 1).map_or(true, |e| !contains_let(e))
201-
{
198+
if eq.eq_block(lhs, rhs) && !contains_let(conds[i]) && conds.get(i + 1).map_or(true, |e| !contains_let(e)) {
202199
span_lint_and_note(
203200
cx,
204201
IF_SAME_THEN_ELSE,
@@ -368,10 +365,6 @@ fn eq_stmts(
368365
.all(|b| get_stmt(b).map_or(false, |s| eq.eq_stmt(s, stmt)))
369366
}
370367

371-
372-
373-
374-
375368
fn scan_block_for_eq(cx: &LateContext<'_>, _conds: &[&Expr<'_>], block: &Block<'_>, blocks: &[&Block<'_>]) -> BlockEq {
376369
let mut eq = SpanlessEq::new(cx);
377370
let mut eq = eq.inter_expr();

clippy_utils/src/hir_utils.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::consts::constant_simple;
2-
use crate::source::snippet_opt;
32
use crate::macros::macro_backtrace;
3+
use crate::source::snippet_opt;
44
use rustc_ast::ast::InlineAsmTemplatePiece;
55
use rustc_data_structures::fx::FxHasher;
66
use rustc_hir::def::Res;
@@ -88,12 +88,12 @@ impl<'a, 'tcx> SpanlessEq<'a, 'tcx> {
8888
}
8989

9090
fn cannot_be_compared_block(&mut self, block: &Block<'_>) -> bool {
91-
if block.stmts.first().map_or(false, |stmt|
91+
if block.stmts.first().map_or(false, |stmt| {
9292
matches!(
9393
stmt.kind,
9494
StmtKind::Semi(semi_expr) if self.should_ignore(semi_expr)
9595
)
96-
) {
96+
}) {
9797
return true;
9898
}
9999

@@ -107,12 +107,12 @@ impl<'a, 'tcx> SpanlessEq<'a, 'tcx> {
107107
}
108108

109109
fn should_ignore(&mut self, expr: &Expr<'_>) -> bool {
110-
if macro_backtrace(expr.span).last().map_or(false, |macro_call|
110+
if macro_backtrace(expr.span).last().map_or(false, |macro_call| {
111111
matches!(
112112
&self.cx.tcx.get_diagnostic_name(macro_call.def_id),
113113
Some(sym::todo_macro | sym::unimplemented_macro)
114114
)
115-
) {
115+
}) {
116116
return true;
117117
}
118118

0 commit comments

Comments
 (0)