]> git.lizzy.rs Git - rust.git/blob - tests/source/attrib.rs
Merge pull request #1634 from topecongiro/impl-rewrite-attribute
[rust.git] / tests / source / attrib.rs
1 // rustfmt-wrap_comments: true
2 // Test attributes and doc comments are preserved.
3
4 /// Blah blah blah.
5 /// Blah blah blah.
6 /// Blah blah blah.
7 /// Blah blah blah.
8
9 /// Blah blah blah.
10 impl Bar {
11     /// Blah blah blooo.
12     /// Blah blah blooo.
13     /// Blah blah blooo.
14     /// Blah blah blooo.
15     #[an_attribute]
16     fn foo(&mut self) -> isize {
17     }
18
19     /// Blah blah bing.
20     /// Blah blah bing.
21     /// Blah blah bing.
22
23
24     /// Blah blah bing.
25     /// Blah blah bing.
26     /// Blah blah bing.
27     pub fn f2(self) {
28         (foo, bar)
29     }
30
31     #[another_attribute]
32     fn f3(self) -> Dog {
33     }
34
35     /// Blah blah bing.
36
37     #[attrib1]
38     /// Blah blah bing.
39     #[attrib2]
40     // Another comment that needs rewrite because it's tooooooooooooooooooooooooooooooo loooooooooooong.
41     /// Blah blah bing.
42     fn f4(self) -> Cat {
43     }
44
45     // We want spaces around `=`
46     #[cfg(feature="nightly")]
47     fn f5(self) -> Monkey {}
48 }
49
50 // #984
51 struct Foo {
52     # [ derive ( Clone , PartialEq , Debug , Deserialize , Serialize ) ]
53     foo: usize,
54 }