Files
rust/tests/ui/is_unit_expr.rs

46 lines
728 B
Rust
Raw Normal View History

2017-09-03 08:56:34 -07:00
#![feature(plugin)]
2017-09-03 10:39:28 -07:00
#![plugin(clippy)]
#![warn(unit_expr)]
2017-09-03 08:56:34 -07:00
#[allow(unused_variables)]
fn main() {
//lint should note removing the semicolon from "baz"
2017-09-03 08:56:34 -07:00
let x = {
"foo";
"baz";
};
//lint should ignore false positive.
let y = if true{
"foo"
} else{
return;
};
//lint should note removing semicolon from "bar"
let z = if true{
"foo";
} else{
"bar";
};
let a1 = Some(5);
//lint should ignore false positive
let a2 = match a1 {
Some(x) => x,
_ => {return;},
};
//lint should note removing the semicolon after `x;`
let a3 = match a1 {
Some(x) => {x;},
_ => {0;},
};
2017-09-03 08:56:34 -07:00
}