about summary refs log tree commit diff
path: root/src/librustc_error_codes/error_codes
diff options
context:
space:
mode:
authorSlanterns <slanterns.w@gmail.com>2020-08-08 20:26:56 +0800
committerGitHub <noreply@github.com>2020-08-08 20:26:56 +0800
commitd8cf9aa6931e33a3bdbe21c41e84a27a03406d1f (patch)
treea9a68c70a00bf267393d6234bb25ecad3aba2d4a /src/librustc_error_codes/error_codes
parentc92fc8db8b009b7661cff31fa59a7c0348653bd0 (diff)
downloadrust-d8cf9aa6931e33a3bdbe21c41e84a27a03406d1f.tar.gz
rust-d8cf9aa6931e33a3bdbe21c41e84a27a03406d1f.zip
Use `&` instead of `let ref` in E0502
`ref` on an entire `let` pattern is discouraged, take a reference with `&` instead.
Diffstat (limited to 'src/librustc_error_codes/error_codes')
-rw-r--r--src/librustc_error_codes/error_codes/E0502.md4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/librustc_error_codes/error_codes/E0502.md b/src/librustc_error_codes/error_codes/E0502.md
index b90c59f5807..dc3ffdfddd9 100644
--- a/src/librustc_error_codes/error_codes/E0502.md
+++ b/src/librustc_error_codes/error_codes/E0502.md
@@ -5,7 +5,7 @@ Erroneous code example:
 ```compile_fail,E0502
 fn bar(x: &mut i32) {}
 fn foo(a: &mut i32) {
-    let ref y = a; // a is borrowed as immutable.
+    let y = &a; // a is borrowed as immutable.
     bar(a); // error: cannot borrow `*a` as mutable because `a` is also borrowed
             //        as immutable
     println!("{}", y);
@@ -19,7 +19,7 @@ variable before trying to access it mutably:
 fn bar(x: &mut i32) {}
 fn foo(a: &mut i32) {
     bar(a);
-    let ref y = a; // ok!
+    let y = &a; // ok!
     println!("{}", y);
 }
 ```