]> git.lizzy.rs Git - rust.git/blobdiff - src/tools/clippy/clippy_lints/src/needless_continue.rs
:arrow_up: rust-analyzer
[rust.git] / src / tools / clippy / clippy_lints / src / needless_continue.rs
index 98a3bce1ff38a1e9d107b54d8f725af240156c9a..6f0e755466e5a4524099df8f37f6954fddbd8ab3 100644 (file)
@@ -309,7 +309,7 @@ fn emit_warning<'a>(cx: &EarlyContext<'_>, data: &'a LintData<'_>, header: &str,
         expr.span,
         message,
         None,
-        &format!("{}\n{}", header, snip),
+        &format!("{header}\n{snip}"),
     );
 }
 
@@ -322,10 +322,7 @@ fn suggestion_snippet_for_continue_inside_if<'a>(cx: &EarlyContext<'_>, data: &'
 
     let indent_if = indent_of(cx, data.if_expr.span).unwrap_or(0);
     format!(
-        "{indent}if {} {}\n{indent}{}",
-        cond_code,
-        continue_code,
-        else_code,
+        "{indent}if {cond_code} {continue_code}\n{indent}{else_code}",
         indent = " ".repeat(indent_if),
     )
 }
@@ -349,7 +346,7 @@ fn suggestion_snippet_for_continue_inside_else<'a>(cx: &EarlyContext<'_>, data:
             let span = cx.sess().source_map().stmt_span(stmt.span, data.loop_block.span);
             let snip = snippet_block(cx, span, "..", None).into_owned();
             snip.lines()
-                .map(|line| format!("{}{}", " ".repeat(indent), line))
+                .map(|line| format!("{}{line}", " ".repeat(indent)))
                 .collect::<Vec<_>>()
                 .join("\n")
         })
@@ -358,10 +355,7 @@ fn suggestion_snippet_for_continue_inside_else<'a>(cx: &EarlyContext<'_>, data:
 
     let indent_if = indent_of(cx, data.if_expr.span).unwrap_or(0);
     format!(
-        "{indent_if}if {} {}\n{indent}// merged code follows:\n{}\n{indent_if}}}",
-        cond_code,
-        block_code,
-        to_annex,
+        "{indent_if}if {cond_code} {block_code}\n{indent}// merged code follows:\n{to_annex}\n{indent_if}}}",
         indent = " ".repeat(indent),
         indent_if = " ".repeat(indent_if),
     )