Lint redundant_semicolon was added to rustc
This commit is contained in:
flip1995 2019-08-15 10:13:52 +02:00
parent e1d573c242
commit 87fa2d90f5
No known key found for this signature in database
GPG key ID: 693086869D506637
4 changed files with 16 additions and 6 deletions

View file

@ -1,4 +1,5 @@
#![feature(stmt_expr_attributes)]
#![allow(redundant_semicolon)]
#[rustfmt::skip]
fn main() {

View file

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

View file

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

View file

@ -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);