Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Lint redundant_semicolon was added to rustc
  • Loading branch information
flip1995 committed Aug 15, 2019
1 parent e1d573c commit 87fa2d9
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
1 change: 1 addition & 0 deletions tests/ui/author/blocks.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![feature(stmt_expr_attributes)]
#![allow(redundant_semicolon)]

#[rustfmt::skip]
fn main() {
Expand Down
14 changes: 10 additions & 4 deletions tests/ui/author/blocks.stderr
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
error: statement with no effect
--> $DIR/blocks.rs:14:5
--> $DIR/blocks.rs:8:9
|
LL | -x;
| ^^^
LL | ;;;;
| ^^^^
|
= note: `-D clippy::no-effect` implied by `-D warnings`

error: aborting due to previous error
error: statement with no effect
--> $DIR/blocks.rs:15:5
|
LL | -x;
| ^^^

error: aborting due to 2 previous errors

5 changes: 4 additions & 1 deletion tests/ui/author/blocks.stdout
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
if_chain! {
if let ExprKind::Block(ref block) = expr.node;
if let Some(trailing_expr) = &block.expr;
if block.stmts.len() == 0;
if block.stmts.len() == 1;
if let StmtKind::Semi(ref e, _) = block.stmts[0].node
if let ExprKind::Tup(ref elements) = e.node;
if elements.len() == 0;
then {
// report your lint here
}
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/swap.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![warn(clippy::all)]
#![allow(clippy::blacklisted_name, unused_assignments)]
#![allow(clippy::blacklisted_name, clippy::no_effect, redundant_semicolon, unused_assignments)]

struct Foo(u32);

Expand Down

0 comments on commit 87fa2d9

Please sign in to comment.