]> git.lizzy.rs Git - rust.git/blob - tests/ui/panicking_macros.rs
Auto merge of #7007 - Y-Nak:result_unit_err, r=giraffate
[rust.git] / tests / ui / panicking_macros.rs
1 #![warn(clippy::unimplemented, clippy::unreachable, clippy::todo, clippy::panic)]
2 #![allow(clippy::assertions_on_constants)]
3
4 extern crate core;
5
6 fn panic() {
7     let a = 2;
8     panic!();
9     panic!("message");
10     panic!("{} {}", "panic with", "multiple arguments");
11     let b = a + 2;
12 }
13
14 fn todo() {
15     let a = 2;
16     todo!();
17     todo!("message");
18     todo!("{} {}", "panic with", "multiple arguments");
19     let b = a + 2;
20 }
21
22 fn unimplemented() {
23     let a = 2;
24     unimplemented!();
25     unimplemented!("message");
26     unimplemented!("{} {}", "panic with", "multiple arguments");
27     let b = a + 2;
28 }
29
30 fn unreachable() {
31     let a = 2;
32     unreachable!();
33     unreachable!("message");
34     unreachable!("{} {}", "panic with", "multiple arguments");
35     let b = a + 2;
36 }
37
38 fn core_versions() {
39     use core::{panic, todo, unimplemented, unreachable};
40     panic!();
41     todo!();
42     unimplemented!();
43     unreachable!();
44 }
45
46 fn main() {
47     panic();
48     todo();
49     unimplemented();
50     unreachable();
51     core_versions();
52 }