]> git.lizzy.rs Git - rust.git/commitdiff
cargo dev fmt
authorkyoto7250 <50972773+kyoto7250@users.noreply.github.com>
Sat, 18 Jun 2022 09:29:39 +0000 (18:29 +0900)
committerkyoto7250 <50972773+kyoto7250@users.noreply.github.com>
Sat, 18 Jun 2022 09:29:39 +0000 (18:29 +0900)
clippy_lints/src/copies.rs
clippy_utils/src/hir_utils.rs

index f6e4d9a4f5cf8655fa821223ef8d658d4ab6f9db..1deff9684a140abedbe5d1da5facb0f7bba1486f 100644 (file)
@@ -195,10 +195,7 @@ fn lint_if_same_then_else(cx: &LateContext<'_>, conds: &[&Expr<'_>], blocks: &[&
         .array_windows::<2>()
         .enumerate()
         .fold(true, |all_eq, (i, &[lhs, rhs])| {
-            if eq.eq_block(lhs, rhs)
-                && !contains_let(conds[i])
-                && conds.get(i + 1).map_or(true, |e| !contains_let(e))
-            {
+            if eq.eq_block(lhs, rhs) && !contains_let(conds[i]) && conds.get(i + 1).map_or(true, |e| !contains_let(e)) {
                 span_lint_and_note(
                     cx,
                     IF_SAME_THEN_ELSE,
@@ -368,10 +365,6 @@ fn eq_stmts(
         .all(|b| get_stmt(b).map_or(false, |s| eq.eq_stmt(s, stmt)))
 }
 
-
-
-
-
 fn scan_block_for_eq(cx: &LateContext<'_>, _conds: &[&Expr<'_>], block: &Block<'_>, blocks: &[&Block<'_>]) -> BlockEq {
     let mut eq = SpanlessEq::new(cx);
     let mut eq = eq.inter_expr();
index f21098f95f7a006ad90cd0eed3a705e553700158..97a15108d0c367c093e797425797549ca1992316 100644 (file)
@@ -1,6 +1,6 @@
 use crate::consts::constant_simple;
-use crate::source::snippet_opt;
 use crate::macros::macro_backtrace;
+use crate::source::snippet_opt;
 use rustc_ast::ast::InlineAsmTemplatePiece;
 use rustc_data_structures::fx::FxHasher;
 use rustc_hir::def::Res;
@@ -88,12 +88,12 @@ pub fn eq_path_segments(&mut self, left: &[PathSegment<'_>], right: &[PathSegmen
     }
 
     fn cannot_be_compared_block(&mut self, block: &Block<'_>) -> bool {
-        if block.stmts.first().map_or(false, |stmt|
+        if block.stmts.first().map_or(false, |stmt| {
             matches!(
                 stmt.kind,
                 StmtKind::Semi(semi_expr) if self.should_ignore(semi_expr)
             )
-        ) {
+        }) {
             return true;
         }
 
@@ -107,12 +107,12 @@ fn cannot_be_compared_block(&mut self, block: &Block<'_>) -> bool {
     }
 
     fn should_ignore(&mut self, expr: &Expr<'_>) -> bool {
-        if macro_backtrace(expr.span).last().map_or(false, |macro_call|
+        if macro_backtrace(expr.span).last().map_or(false, |macro_call| {
             matches!(
                 &self.cx.tcx.get_diagnostic_name(macro_call.def_id),
                 Some(sym::todo_macro | sym::unimplemented_macro)
             )
-        ) {
+        }) {
             return true;
         }