]> git.lizzy.rs Git - rust.git/blobdiff - src/tools/clippy/clippy_lints/src/unwrap.rs
Rollup merge of #102888 - GuillaumeGomez:improve-search-color-check, r=notriddle
[rust.git] / src / tools / clippy / clippy_lints / src / unwrap.rs
index 3ef2655807974fa794ed45e77b94a5c582b1aea7..ea878043c04e3b789e351f99796d55b590d242d3 100644 (file)
@@ -257,9 +257,8 @@ fn visit_expr(&mut self, expr: &'tcx Expr<'_>) {
                             expr.hir_id,
                             expr.span,
                             &format!(
-                                "called `{}` on `{}` after checking its variant with `{}`",
+                                "called `{}` on `{unwrappable_variable_name}` after checking its variant with `{}`",
                                 method_name.ident.name,
-                                unwrappable_variable_name,
                                 unwrappable.check_name.ident.as_str(),
                             ),
                             |diag| {
@@ -268,9 +267,7 @@ fn visit_expr(&mut self, expr: &'tcx Expr<'_>) {
                                         unwrappable.check.span.with_lo(unwrappable.if_expr.span.lo()),
                                         "try",
                                         format!(
-                                            "if let {} = {}",
-                                            suggested_pattern,
-                                            unwrappable_variable_name,
+                                            "if let {suggested_pattern} = {unwrappable_variable_name}",
                                         ),
                                         // We don't track how the unwrapped value is used inside the
                                         // block or suggest deleting the unwrap, so we can't offer a