]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/item_after_statement.rs
Rollup merge of #102110 - CleanCut:migrate_rustc_passes_diagnostics, r=davidtwco
[rust.git] / src / tools / clippy / tests / ui / item_after_statement.rs
1 #![warn(clippy::items_after_statements)]
2 #![allow(clippy::uninlined_format_args)]
3
4 fn ok() {
5     fn foo() {
6         println!("foo");
7     }
8     foo();
9 }
10
11 fn last() {
12     foo();
13     fn foo() {
14         println!("foo");
15     }
16 }
17
18 fn main() {
19     foo();
20     fn foo() {
21         println!("foo");
22     }
23     foo();
24 }
25
26 fn mac() {
27     let mut a = 5;
28     println!("{}", a);
29     // do not lint this, because it needs to be after `a`
30     macro_rules! b {
31         () => {{
32             a = 6;
33             fn say_something() {
34                 println!("something");
35             }
36         }};
37     }
38     b!();
39     println!("{}", a);
40 }
41
42 fn semicolon() {
43     struct S {
44         a: u32,
45     };
46     impl S {
47         fn new(a: u32) -> Self {
48             Self { a }
49         }
50     }
51
52     let _ = S::new(3);
53 }