]> git.proxmox.com Git - rustc.git/blame - src/tools/clippy/tests/ui/assertions_on_constants.rs
Update upstream source from tag 'upstream/1.52.1+dfsg1'
[rustc.git] / src / tools / clippy / tests / ui / assertions_on_constants.rs
CommitLineData
f20569fa
XL
1#![allow(non_fmt_panic)]
2
3macro_rules! assert_const {
4 ($len:expr) => {
5 assert!($len > 0);
6 debug_assert!($len < 0);
7 };
8}
9
10fn main() {
11 assert!(true);
12 assert!(false);
13 assert!(true, "true message");
14 assert!(false, "false message");
15
16 let msg = "panic message";
17 assert!(false, msg.to_uppercase());
18
19 const B: bool = true;
20 assert!(B);
21
22 const C: bool = false;
23 assert!(C);
24 assert!(C, "C message");
25
26 debug_assert!(true);
27 // Don't lint this, since there is no better way for expressing "Only panic in debug mode".
28 debug_assert!(false); // #3948
29 assert_const!(3);
30 assert_const!(-1);
31}