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.
This commit is contained in:
parent
158f8d034b
commit
c857cbeb06
3 changed files with 25 additions and 23 deletions
|
|
@ -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
src/test/ui/lint/redundant-semicolon/item-stmt-semi.stderr
Normal file
20
src/test/ui/lint/redundant-semicolon/item-stmt-semi.stderr
Normal file
|
|
@ -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
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue