]> git.proxmox.com Git - rustc.git/blame - src/tools/rustfmt/tests/target/fn-param-attributes.rs
New upstream version 1.52.1+dfsg1
[rustc.git] / src / tools / rustfmt / tests / target / fn-param-attributes.rs
CommitLineData
f20569fa
XL
1// https://github.com/rust-lang/rustfmt/issues/3623
2
3fn foo(#[cfg(something)] x: i32, y: i32) -> i32 {
4 x + y
5}
6
7fn foo_b(#[cfg(something)] x: i32, y: i32) -> i32 {
8 x + y
9}
10
11fn add(
12 #[cfg(something)]
13 #[deny(C)]
14 x: i32,
15 y: i32,
16) -> i32 {
17 x + y
18}
19
20struct NamedSelfRefStruct {}
21impl NamedSelfRefStruct {
22 fn foo(#[cfg(something)] self: &Self) {}
23}
24
25struct MutStruct {}
26impl MutStruct {
27 fn foo(#[cfg(foo)] &mut self, #[deny(C)] b: i32) {}
28}
29
30fn 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
39pub 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
51fn abc(
52 #[foo]
53 #[bar]
54 param: u32,
55) {
56 // ...
57}
58
59fn 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}