fix no_effect lint

This commit is contained in:
Oliver Schneider 2016-05-25 18:51:35 +02:00
parent 77ed899941
commit bb69e60b30
No known key found for this signature in database
GPG key ID: 56D6EEA0FC67AC46
2 changed files with 11 additions and 5 deletions

View file

@ -18,6 +18,8 @@ enum Enum {
fn get_number() -> i32 { 0 }
fn get_struct() -> Struct { Struct { field: 0 } }
unsafe fn unsafe_fn() -> i32 { 0 }
fn main() {
let s = get_struct();
let s2 = get_struct();
@ -50,6 +52,7 @@ fn main() {
// Do not warn
get_number();
unsafe { unsafe_fn() };
Tuple(get_number()); //~ERROR statement can be reduced
//~^HELP replace it with
@ -105,4 +108,7 @@ fn main() {
[42; 55][get_number() as usize]; //~ERROR statement can be reduced
//~^HELP replace it with
//~|SUGGESTION [42; 55];get_number() as usize;
{get_number()}; //~ERROR statement can be reduced
//~^HELP replace it with
//~|SUGGESTION get_number();
}