about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorGurinder Singh <frederick.the.fool@gmail.com>2023-10-30 19:04:55 +0530
committerGurinder Singh <frederick.the.fool@gmail.com>2023-10-30 19:04:55 +0530
commita2486dba3b6cd64b082273a3e24a3e8b6b65dc1b (patch)
tree4cbc673a1c6b7f49d1b9b3a74ecb261604846f8b /compiler
parent91bbdd927a5e53a2fe126304fe8adbedf339616c (diff)
downloadrust-a2486dba3b6cd64b082273a3e24a3e8b6b65dc1b.tar.gz
rust-a2486dba3b6cd64b082273a3e24a3e8b6b65dc1b.zip
Fix missing leading space in suggestion
For a local pattern with no space between `let` and `(` e.g.:

  let(_a) = 3;

we were previously suggesting this illegal code:

  let_a =3;

After this change the suggestion will instead be:

  let _a =3;

(Note the space after `let`)
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_lint/src/unused.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_lint/src/unused.rs b/compiler/rustc_lint/src/unused.rs
index 6b31fb079e0..355855b8e2b 100644
--- a/compiler/rustc_lint/src/unused.rs
+++ b/compiler/rustc_lint/src/unused.rs
@@ -1154,7 +1154,7 @@ impl EarlyLintPass for UnusedParens {
 
     fn check_stmt(&mut self, cx: &EarlyContext<'_>, s: &ast::Stmt) {
         if let StmtKind::Local(ref local) = s.kind {
-            self.check_unused_parens_pat(cx, &local.pat, true, false, (false, false));
+            self.check_unused_parens_pat(cx, &local.pat, true, false, (true, false));
         }
 
         <Self as UnusedDelimLint>::check_stmt(self, cx, s)