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