]> git.lizzy.rs Git - rust.git/blob - src/test/ui/consts/const-int-sign-rpass.rs
Do not suggest `let_else` if no bindings would be introduced
[rust.git] / src / test / ui / consts / const-int-sign-rpass.rs
1 // run-pass
2
3 const NEGATIVE_A: bool = (-10i32).is_negative();
4 const NEGATIVE_B: bool = 10i32.is_negative();
5 const POSITIVE_A: bool = (-10i32).is_positive();
6 const POSITIVE_B: bool = 10i32.is_positive();
7
8 const SIGNUM_POS: i32 = 10i32.signum();
9 const SIGNUM_NIL: i32 = 0i32.signum();
10 const SIGNUM_NEG: i32 = (-42i32).signum();
11
12 const ABS_A: i32 = 10i32.abs();
13 const ABS_B: i32 = (-10i32).abs();
14
15 fn main() {
16     assert!(NEGATIVE_A);
17     assert!(!NEGATIVE_B);
18     assert!(!POSITIVE_A);
19     assert!(POSITIVE_B);
20
21     assert_eq!(SIGNUM_POS, 1);
22     assert_eq!(SIGNUM_NIL, 0);
23     assert_eq!(SIGNUM_NEG, -1);
24
25     assert_eq!(ABS_A, 10);
26     assert_eq!(ABS_B, 10);
27 }