Skip to content

Commit 87fa2d9

Browse files
committed
Lint redundant_semicolon was added to rustc
1 parent e1d573c commit 87fa2d9

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

tests/ui/author/blocks.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![feature(stmt_expr_attributes)]
2+
#![allow(redundant_semicolon)]
23

34
#[rustfmt::skip]
45
fn main() {

tests/ui/author/blocks.stderr

+10-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
error: statement with no effect
2-
--> $DIR/blocks.rs:14:5
2+
--> $DIR/blocks.rs:8:9
33
|
4-
LL | -x;
5-
| ^^^
4+
LL | ;;;;
5+
| ^^^^
66
|
77
= note: `-D clippy::no-effect` implied by `-D warnings`
88

9-
error: aborting due to previous error
9+
error: statement with no effect
10+
--> $DIR/blocks.rs:15:5
11+
|
12+
LL | -x;
13+
| ^^^
14+
15+
error: aborting due to 2 previous errors
1016

tests/ui/author/blocks.stdout

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
if_chain! {
22
if let ExprKind::Block(ref block) = expr.node;
33
if let Some(trailing_expr) = &block.expr;
4-
if block.stmts.len() == 0;
4+
if block.stmts.len() == 1;
5+
if let StmtKind::Semi(ref e, _) = block.stmts[0].node
6+
if let ExprKind::Tup(ref elements) = e.node;
7+
if elements.len() == 0;
58
then {
69
// report your lint here
710
}

tests/ui/swap.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#![warn(clippy::all)]
2-
#![allow(clippy::blacklisted_name, unused_assignments)]
2+
#![allow(clippy::blacklisted_name, clippy::no_effect, redundant_semicolon, unused_assignments)]
33

44
struct Foo(u32);
55

0 commit comments

Comments
 (0)