]> git.lizzy.rs Git - rust.git/blobdiff - src/tools/clippy/clippy_lints/src/redundant_slicing.rs
Rollup merge of #102846 - zertosh:update-syn, r=dtolnay
[rust.git] / src / tools / clippy / clippy_lints / src / redundant_slicing.rs
index 8693ca9af83003f2492158e481fae972649e5276..245a02ea26e61d35d2fa3842c436fc002556f2a7 100644 (file)
@@ -127,9 +127,9 @@ fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
 
                     let snip = snippet_with_context(cx, indexed.span, ctxt, "..", &mut app).0;
                     let sugg = if (deref_count != 0 || !reborrow_str.is_empty()) && needs_parens_for_prefix {
-                        format!("({}{}{})", reborrow_str, "*".repeat(deref_count), snip)
+                        format!("({reborrow_str}{}{snip})", "*".repeat(deref_count))
                     } else {
-                        format!("{}{}{}", reborrow_str, "*".repeat(deref_count), snip)
+                        format!("{reborrow_str}{}{snip}", "*".repeat(deref_count))
                     };
 
                     (lint, help_str, sugg)
@@ -141,9 +141,9 @@ fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
                         if deref_ty == expr_ty {
                             let snip = snippet_with_context(cx, indexed.span, ctxt, "..", &mut app).0;
                             let sugg = if needs_parens_for_prefix {
-                                format!("(&{}{}*{})", mutability.prefix_str(), "*".repeat(indexed_ref_count), snip)
+                                format!("(&{}{}*{snip})", mutability.prefix_str(), "*".repeat(indexed_ref_count))
                             } else {
-                                format!("&{}{}*{}", mutability.prefix_str(), "*".repeat(indexed_ref_count), snip)
+                                format!("&{}{}*{snip}", mutability.prefix_str(), "*".repeat(indexed_ref_count))
                             };
                             (DEREF_BY_SLICING_LINT, "dereference the original value instead", sugg)
                         } else {