]>
Commit | Line | Data |
---|---|---|
f20569fa XL |
1 | // https://github.com/rust-lang/rustfmt/issues/3623 |
2 | ||
3 | fn foo(#[cfg(something)] x: i32, y: i32) -> i32 { | |
4 | x + y | |
5 | } | |
6 | ||
7 | fn foo_b(#[cfg(something)] x: i32, y: i32) -> i32 { | |
8 | x + y | |
9 | } | |
10 | ||
11 | fn add( | |
12 | #[cfg(something)] | |
13 | #[deny(C)] | |
14 | x: i32, | |
15 | y: i32, | |
16 | ) -> i32 { | |
17 | x + y | |
18 | } | |
19 | ||
20 | struct NamedSelfRefStruct {} | |
21 | impl NamedSelfRefStruct { | |
22 | fn foo(#[cfg(something)] self: &Self) {} | |
23 | } | |
24 | ||
25 | struct MutStruct {} | |
26 | impl MutStruct { | |
27 | fn foo(#[cfg(foo)] &mut self, #[deny(C)] b: i32) {} | |
28 | } | |
29 | ||
30 | fn main() { | |
31 | let c = |#[allow(C)] a: u32, | |
32 | #[cfg(something)] b: i32, | |
33 | #[cfg_attr(something, cfg(nothing))] | |
34 | #[deny(C)] | |
35 | c: i32| {}; | |
36 | let _ = c(1, 2); | |
37 | } | |
38 | ||
39 | pub fn bar( | |
40 | /// bar | |
41 | #[test] | |
42 | a: u32, | |
43 | /// Bar | |
44 | #[must_use] | |
45 | /// Baz | |
46 | #[no_mangle] | |
47 | b: i32, | |
48 | ) { | |
49 | } | |
50 | ||
51 | fn abc( | |
52 | #[foo] | |
53 | #[bar] | |
54 | param: u32, | |
55 | ) { | |
56 | // ... | |
57 | } | |
58 | ||
59 | fn really_really_really_loooooooooooooooooooong( | |
60 | #[cfg(some_even_longer_config_feature_that_keeps_going_and_going_and_going_forever_and_ever_and_ever_on_and_on)] | |
61 | b: i32, | |
62 | ) { | |
63 | // ... | |
64 | } |