rust/tests/compile-fail/copies.rs

32 lines
652 B
Rust
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#![feature(plugin)]
#![plugin(clippy)]
#![deny(clippy)]
fn foo() -> bool { unimplemented!() }
fn main() {
let a = 0;
if a == 1 {
}
else if a == 1 { //~ERROR this if as the same condition as a previous if
}
if 2*a == 1 {
}
else if 2*a == 2 {
}
else if 2*a == 1 { //~ERROR this if as the same condition as a previous if
}
else if a == 1 {
}
// Ok, maybe `foo` isnt pure and this actually makes sense. But you should probably refactor
// this to make the intention clearer anyway.
if foo() {
}
else if foo() { //~ERROR this if as the same condition as a previous if
}
}