| 1 |
fn is_zero(x: i32) -> bool { |
| 2 |
x == 0 |
| 3 |
} |
| 4 |
|
| 5 |
fn is_not_zero(x: i32) -> bool { |
| 6 |
x != 0 |
| 7 |
} |
| 8 |
|
| 9 |
fn is_positive(x: i32) -> bool { |
| 10 |
x > 0 |
| 11 |
} |
| 12 |
|
| 13 |
fn is_negative(x: i32) -> bool { |
| 14 |
x < 0 |
| 15 |
} |
| 16 |
|
| 17 |
fn is_positive_or_zero(x: i32) -> bool { |
| 18 |
x >= 0 |
| 19 |
} |
| 20 |
|
| 21 |
fn is_negative_or_zero(x: i32) -> bool { |
| 22 |
x <= 0 |
| 23 |
} |
| 24 |
|
| 25 |
fn main() { |
| 26 |
let a: bool = is_zero(1); |
| 27 |
let b: bool = is_not_zero(2); |
| 28 |
let c: bool = is_positive(3); |
| 29 |
let d: bool = is_negative(4); |
| 30 |
let e: bool = is_positive_or_zero(5); |
| 31 |
// { dg-warning "unused name" "" { target *-*-* } .-1 } |
| 32 |
let f: bool = is_negative_or_zero(6); |
| 33 |
// { dg-warning "unused name" "" { target *-*-* } .-1 } |
| 34 |
let g: bool = a || b; |
| 35 |
// { dg-warning "unused name" "" { target *-*-* } .-1 } |
| 36 |
let h: bool = c && d; |
| 37 |
// { dg-warning "unused name" "" { target *-*-* } .-1 } |
| 38 |
} |