• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // https://github.com/rust-lang/rustfmt/issues/3623
2 
foo(#[cfg(something)] x: i32, y: i32) -> i323 fn foo(#[cfg(something)] x: i32, y: i32) -> i32 {
4     x + y
5 }
6 
foo_b(#[cfg(something)] x: i32, y: i32) -> i327 fn foo_b(#[cfg(something)] x: i32, y: i32) -> i32 {
8     x + y
9 }
10 
add( #[cfg(something)] #[deny(C)] x: i32, y: i32, ) -> i3211 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 {
foo(#[cfg(something)] self: &Self)22     fn foo(#[cfg(something)] self: &Self) {}
23 }
24 
25 struct MutStruct {}
26 impl MutStruct {
foo(#[cfg(foo)] &mut self, #[deny(C)] b: i32)27     fn foo(#[cfg(foo)] &mut self, #[deny(C)] b: i32) {}
28 }
29 
main()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 
bar( #[test] a: u32, #[must_use] #[no_mangle] b: i32, )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 
abc( #[foo] #[bar] param: u32, )51 fn abc(
52     #[foo]
53     #[bar]
54     param: u32,
55 ) {
56     // ...
57 }
58 
really_really_really_loooooooooooooooooooong( #[cfg(some_even_longer_config_feature_that_keeps_going_and_going_and_going_forever_and_ever_and_ever_on_and_on)] b: i32, )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 }
65