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:
Aaron Hill 2020-12-07 18:10:48 -05:00
parent 158f8d034b
commit c857cbeb06
No known key found for this signature in database
GPG key ID: B4087E510E98B164
3 changed files with 25 additions and 23 deletions

View file

@ -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
}

View 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