]>
Commit | Line | Data |
---|---|---|
f20569fa XL |
1 | // rustfmt-wrap_comments: true |
2 | // rustfmt-normalize_doc_attributes: true | |
3 | ||
4 | // Only doc = "" attributes should be normalized | |
5 | //! Example doc attribute comment | |
6 | //! Example doc attribute comment with 10 leading spaces | |
7 | #![doc( | |
8 | html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", | |
9 | html_favicon_url = "https://doc.rust-lang.org/favicon.ico", | |
10 | html_root_url = "https://doc.rust-lang.org/nightly/", | |
11 | html_playground_url = "https://play.rust-lang.org/", | |
12 | test(attr(deny(warnings))) | |
13 | )] | |
14 | ||
15 | // Long `#[doc = "..."]` | |
16 | struct A { | |
17 | /// xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | |
18 | b: i32, | |
19 | } | |
20 | ||
21 | /// The `nodes` and `edges` method each return instantiations of `Cow<[T]>` to | |
22 | /// leave implementers the freedom to create entirely new vectors or to pass | |
23 | /// back slices into internally owned vectors. | |
24 | struct B { | |
25 | b: i32, | |
26 | } | |
27 | ||
28 | /// Level 1 comment | |
29 | mod tests { | |
30 | /// Level 2 comment | |
31 | impl A { | |
32 | /// Level 3 comment | |
33 | fn f() { | |
34 | /// Level 4 comment | |
35 | fn g() {} | |
36 | } | |
37 | } | |
38 | } | |
39 | ||
40 | struct C { | |
41 | /// item doc attrib comment | |
42 | // regular item comment | |
43 | b: i32, | |
44 | ||
45 | // regular item comment | |
46 | /// item doc attrib comment | |
47 | c: i32, | |
48 | } | |
49 | ||
50 | // non-regression test for regular attributes, from #2647 | |
51 | #[cfg( | |
52 | feature = "this_line_is_101_characters_long_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" | |
53 | )] | |
54 | pub fn foo() {} | |
55 | ||
56 | // path attrs | |
57 | #[clippy::bar] | |
58 | #[clippy::bar(a, b, c)] | |
59 | pub fn foo() {} | |
60 | ||
61 | mod issue_2620 { | |
62 | #[derive(Debug, StructOpt)] | |
63 | #[structopt(about = "Display information about the character on FF Logs")] | |
64 | pub struct Params { | |
65 | #[structopt(help = "The server the character is on")] | |
66 | server: String, | |
67 | #[structopt(help = "The character's first name")] | |
68 | first_name: String, | |
69 | #[structopt(help = "The character's last name")] | |
70 | last_name: String, | |
71 | #[structopt( | |
72 | short = "j", | |
73 | long = "job", | |
74 | help = "The job to look at", | |
75 | parse(try_from_str) | |
76 | )] | |
77 | job: Option<Job>, | |
78 | } | |
79 | } | |
80 | ||
81 | // non-regression test for regular attributes, from #2969 | |
82 | #[cfg(not(all( | |
83 | feature = "std", | |
84 | any( | |
85 | target_os = "linux", | |
86 | target_os = "android", | |
87 | target_os = "netbsd", | |
88 | target_os = "dragonfly", | |
89 | target_os = "haiku", | |
90 | target_os = "emscripten", | |
91 | target_os = "solaris", | |
92 | target_os = "cloudabi", | |
93 | target_os = "macos", | |
94 | target_os = "ios", | |
95 | target_os = "freebsd", | |
96 | target_os = "openbsd", | |
97 | target_os = "redox", | |
98 | target_os = "fuchsia", | |
99 | windows, | |
100 | all(target_arch = "wasm32", feature = "stdweb"), | |
101 | all(target_arch = "wasm32", feature = "wasm-bindgen"), | |
102 | ) | |
103 | )))] | |
104 | type Os = NoSource; | |
105 | ||
106 | // use cases from bindgen needing precise control over leading spaces | |
107 | /// <div rustbindgen accessor></div> | |
108 | #[repr(C)] | |
109 | #[derive(Debug, Default, Copy, Clone)] | |
110 | pub struct ContradictAccessors { | |
111 | ///<foo>no leading spaces here</foo> | |
112 | pub mBothAccessors: ::std::os::raw::c_int, | |
113 | /// <div rustbindgen accessor="false"></div> | |
114 | pub mNoAccessors: ::std::os::raw::c_int, | |
115 | /// <div rustbindgen accessor="unsafe"></div> | |
116 | pub mUnsafeAccessors: ::std::os::raw::c_int, | |
117 | /// <div rustbindgen accessor="immutable"></div> | |
118 | pub mImmutableAccessor: ::std::os::raw::c_int, | |
119 | } | |
120 | ||
121 | /// \brief MPI structure | |
122 | #[repr(C)] | |
123 | #[derive(Debug, Copy, Clone)] | |
124 | pub struct mbedtls_mpi { | |
125 | ///< integer sign | |
126 | pub s: ::std::os::raw::c_int, | |
127 | ///< total # of limbs | |
128 | pub n: ::std::os::raw::c_ulong, | |
129 | ///< pointer to limbs | |
130 | pub p: *mut mbedtls_mpi_uint, | |
131 | } |