]> git.lizzy.rs Git - rust.git/blob - tests/ui/auxiliary/macro_rules.rs
Don't emit try_err lint in external macros
[rust.git] / tests / ui / auxiliary / macro_rules.rs
1 #![allow(dead_code)]
2
3 //! Used to test that certain lints don't trigger in imported external macros
4
5 #[macro_export]
6 macro_rules! foofoo {
7     () => {
8         loop {}
9     };
10 }
11
12 #[macro_export]
13 macro_rules! must_use_unit {
14     () => {
15         #[must_use]
16         fn foo() {}
17     };
18 }
19
20 #[macro_export]
21 macro_rules! try_err {
22     () => {
23         pub fn try_err_fn() -> Result<i32, i32> {
24             let err: i32 = 1;
25             // To avoid warnings during rustfix
26             if true {
27                 Err(err)?
28             } else {
29                 Ok(2)
30             }
31         }
32     };
33 }