]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_hir_typeck/src/pat.rs
Rollup merge of #105100 - jhpratt:fix-docs, r=JohnTitor
[rust.git] / compiler / rustc_hir_typeck / src / pat.rs
index 2fe1b1d8999bc6455e42bce4d988546e51a674f7..decd317d9fc9b1e3a8943e9419bd0dedbb66e5eb 100644 (file)
@@ -702,7 +702,7 @@ fn borrow_pat_suggestion(&self, err: &mut Diagnostic, pat: &Pat<'_>) {
             };
 
             let mut_var_suggestion = 'block: {
-                if !matches!(mutbl, ast::Mutability::Mut) {
+                if mutbl.is_not() {
                     break 'block None;
                 }
 
@@ -749,7 +749,7 @@ fn borrow_pat_suggestion(&self, err: &mut Diagnostic, pat: &Pat<'_>) {
                         format!("to take parameter `{binding}` by reference, move `&{mutability}` to the type"),
                         vec![
                             (pat.span.until(inner.span), "".to_owned()),
-                            (ty_span.shrink_to_lo(), format!("&{}", mutbl.prefix_str())),
+                            (ty_span.shrink_to_lo(), mutbl.ref_prefix_str().to_owned()),
                         ],
                         Applicability::MachineApplicable
                     );