forked from rust-lang/rust
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#79812 - Aaron1011:lint-item-trailing-semi, …
…r=oli-obk Lint on redundant trailing semicolon after item We now lint on code like this: ```rust fn main() { fn foo() {}; struct Bar {}; } ``` Previously, this caused warnings in Cargo, so it was disabled.
- Loading branch information
Showing
8 changed files
with
32 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,6 @@ | ||
// check-pass | ||
// This test should stop compiling | ||
// we decide to enable this lint for item statements. | ||
|
||
#![deny(redundant_semicolons)] | ||
|
||
fn main() { | ||
fn inner() {}; | ||
struct Bar {}; | ||
fn inner() {}; //~ ERROR unnecessary | ||
struct Bar {}; //~ ERROR unnecessary | ||
} |
20 changes: 20 additions & 0 deletions
20
src/test/ui/lint/redundant-semicolon/item-stmt-semi.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
error: unnecessary trailing semicolon | ||
--> $DIR/item-stmt-semi.rs:4:18 | ||
| | ||
LL | fn inner() {}; | ||
| ^ help: remove this semicolon | ||
| | ||
note: the lint level is defined here | ||
--> $DIR/item-stmt-semi.rs:1:9 | ||
| | ||
LL | #![deny(redundant_semicolons)] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: unnecessary trailing semicolon | ||
--> $DIR/item-stmt-semi.rs:5:18 | ||
| | ||
LL | struct Bar {}; | ||
| ^ help: remove this semicolon | ||
|
||
error: aborting due to 2 previous errors | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,7 +39,7 @@ fn main() { | |
B(i32), | ||
C, | ||
D, | ||
}; | ||
} | ||
let x = E::A(2); | ||
{ | ||
// lint | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,7 +51,7 @@ fn main() { | |
B(i32), | ||
C, | ||
D, | ||
}; | ||
} | ||
let x = E::A(2); | ||
{ | ||
// lint | ||
|