Skip to content

Commit cdfa297

Browse files
Rollup merge of #158591 - chenyukang:yukang-fix-158583-unused-parens-space, r=nnethercote
Fix spacing issue for unused parentheses lint There is a typo. Fixes #158583
2 parents dab9ecf + cd0a3c4 commit cdfa297

3 files changed

Lines changed: 25 additions & 1 deletion

File tree

compiler/rustc_lint/src/unused.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ trait UnusedDelimLint {
338338
&& !snip.starts_with(' ')
339339
{
340340
" "
341-
} else if let Ok(snip) = sm.span_to_prev_source(value_span)
341+
} else if let Ok(snip) = sm.span_to_next_source(value_span)
342342
&& snip.starts_with(|c: char| c.is_alphanumeric())
343343
{
344344
" "
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
fn main() {
2+
#[deny(unused_parens)]
3+
let _x = (3 + 6);
4+
//~^ ERROR unnecessary parentheses around assigned value
5+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
error: unnecessary parentheses around assigned value
2+
--> $DIR/unused-parens-trailing-space-issue-158583.rs:3:14
3+
|
4+
LL | let _x = (3 + 6);
5+
| ^ ^
6+
|
7+
note: the lint level is defined here
8+
--> $DIR/unused-parens-trailing-space-issue-158583.rs:2:12
9+
|
10+
LL | #[deny(unused_parens)]
11+
| ^^^^^^^^^^^^^
12+
help: remove these parentheses
13+
|
14+
LL - let _x = (3 + 6);
15+
LL + let _x = 3 + 6;
16+
|
17+
18+
error: aborting due to 1 previous error
19+

0 commit comments

Comments
 (0)