2015-10-28 16:50:00 +00:00
|
|
|
#![feature(plugin)]
|
|
|
|
#![plugin(clippy)]
|
|
|
|
|
|
|
|
#![deny(no_effect)]
|
|
|
|
#![allow(dead_code)]
|
|
|
|
#![allow(path_statements)]
|
|
|
|
|
|
|
|
struct Unit;
|
|
|
|
struct Tuple(i32);
|
|
|
|
struct Struct {
|
|
|
|
field: i32
|
|
|
|
}
|
|
|
|
enum Enum {
|
2016-02-01 11:51:33 +00:00
|
|
|
Tuple(i32),
|
|
|
|
Struct { field: i32 },
|
2015-10-28 16:50:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn get_number() -> i32 { 0 }
|
|
|
|
fn get_struct() -> Struct { Struct { field: 0 } }
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let s = get_struct();
|
|
|
|
|
|
|
|
0; //~ERROR statement with no effect
|
|
|
|
Unit; //~ERROR statement with no effect
|
|
|
|
Tuple(0); //~ERROR statement with no effect
|
|
|
|
Struct { field: 0 }; //~ERROR statement with no effect
|
|
|
|
Struct { ..s }; //~ERROR statement with no effect
|
2016-02-01 11:51:33 +00:00
|
|
|
Enum::Tuple(0); //~ERROR statement with no effect
|
|
|
|
Enum::Struct { field: 0 }; //~ERROR statement with no effect
|
2015-10-28 16:50:00 +00:00
|
|
|
|
|
|
|
// Do not warn
|
|
|
|
get_number();
|
|
|
|
Tuple(get_number());
|
|
|
|
Struct { field: get_number() };
|
|
|
|
Struct { ..get_struct() };
|
2016-02-01 11:51:33 +00:00
|
|
|
Enum::Tuple(get_number());
|
|
|
|
Enum::Struct { field: get_number() };
|
2015-10-28 16:50:00 +00:00
|
|
|
}
|