]> git.proxmox.com Git - rustc.git/blame - src/tools/clippy/tests/ui/item_after_statement.rs
New upstream version 1.66.0+dfsg1
[rustc.git] / src / tools / clippy / tests / ui / item_after_statement.rs
CommitLineData
f20569fa 1#![warn(clippy::items_after_statements)]
2b03887a 2#![allow(clippy::uninlined_format_args)]
f20569fa
XL
3
4fn ok() {
5 fn foo() {
6 println!("foo");
7 }
8 foo();
9}
10
11fn last() {
12 foo();
13 fn foo() {
14 println!("foo");
15 }
16}
17
18fn main() {
19 foo();
20 fn foo() {
21 println!("foo");
22 }
23 foo();
24}
25
26fn 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
42fn 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}