diff options
| author | Mu001999 <mu001999@outlook.com> | 2025-03-09 18:25:57 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-16 11:31:59 +0000 |
| commit | 9991ec282f3ff08c895e4a5262259139fe689953 (patch) | |
| tree | 82f34430285d7a4052e4f516a3b28170576cc393 /compiler/rustc_lint/src/unused.rs | |
| parent | 3c91be712d3d84f6345cd22eae34c47b3a22a3d3 (diff) | |
| download | rust-9991ec282f3ff08c895e4a5262259139fe689953.tar.gz rust-9991ec282f3ff08c895e4a5262259139fe689953.zip | |
Keep space if expr follows identifier when lint unused parens
Diffstat (limited to 'compiler/rustc_lint/src/unused.rs')
| -rw-r--r-- | compiler/rustc_lint/src/unused.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/rustc_lint/src/unused.rs b/compiler/rustc_lint/src/unused.rs index 22d89d24612..edbbfba4f34 100644 --- a/compiler/rustc_lint/src/unused.rs +++ b/compiler/rustc_lint/src/unused.rs @@ -843,6 +843,10 @@ trait UnusedDelimLint { && !snip.ends_with(' ') { " " + } else if let Ok(snip) = sm.span_to_prev_source(value_span) + && snip.ends_with(|c: char| c.is_alphanumeric()) + { + " " } else { "" }; @@ -852,6 +856,10 @@ trait UnusedDelimLint { && !snip.starts_with(' ') { " " + } else if let Ok(snip) = sm.span_to_prev_source(value_span) + && snip.starts_with(|c: char| c.is_alphanumeric()) + { + " " } else { "" }; |
