rust/src/test/ui/lint/must-use-ops.rs
2018-12-25 21:08:33 -07:00

42 lines
570 B
Rust

// Issue #50124 - Test warning for unused operator expressions
// compile-pass
#![warn(unused_must_use)]
fn main() {
let val = 1;
let val_pointer = &val;
// Comparison Operators
val == 1;
val < 1;
val <= 1;
val != 1;
val >= 1;
val > 1;
// Arithmetic Operators
val + 2;
val - 2;
val / 2;
val * 2;
val % 2;
// Logical Operators
true && true;
false || true;
// Bitwise Operators
5 ^ val;
5 & val;
5 | val;
5 << val;
5 >> val;
// Unary Operators
!val;
-val;
*val_pointer;
}