1 // rustfmt-normalize_comments: true
2 // rustfmt-wrap_comments: true
8 f : SomeType, // Comment beside a field
9 f: SomeType, // Comment beside a field
13 /// A doc comment on a field
15 pub i: TypeForPublicField
19 struct S<T: /* comment */> {
26 // This will NOT get deleted!
32 // `x` is an important number.
33 #[allow(unused)] // TODO: use
38 #[allow(missing_docs)]
39 pub struct Writebatch<K: Key> {
40 #[allow(dead_code)] //only used for holding the internal pointer
41 writebatch: RawWritebatch,
42 marker: PhantomData<K>,
47 struct NewType(Type, OtherType);
50 NewInt <T: Copy>(pub i32, SomeType /* inline comment */, T /* sup */
58 G: Labeller<'a, N, E> + GraphWalk<'a, N, E>,
61 AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA, // Comment
62 BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB,
70 struct Tuple(/*Comment 1*/ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,
71 /* Comment 2 */ BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB,);
73 // With a where clause and generics.
74 pub struct Foo<'a, Y: Baz>
77 f: SomeType, // Comment beside a field
123 // Will this be a one-liner?
129 pub struct State<F: FnMut() -> time::Timespec> { now: F }
131 pub struct State<F: FnMut() -> ()> { now: F }
133 pub struct State<F: FnMut()> { now: F }
135 struct Palette { /// A map of indices in the palette to a count of pixels in approximately that color
138 // Splitting a single line comment into a block previously had a misalignment
139 // when the field had attributes
140 struct FieldsWithAttributes {
142 #[rustfmt::skip] pub host:String, // Post comment BBBBBBBBBBBBBB BBBBBBBBBBBBBBBB BBBBBBBBBBBBBBBB BBBBBBBBBBBBBBBBB BBBBBBBBBBB
143 //Another pre comment
145 #[attr2] pub id: usize // CCCCCCCCCCCCCCCCCCC CCCCCCCCCCCCCCCCCCC CCCCCCCCCCCCCCCC CCCCCCCCCCCCCCCCCC CCCCCCCCCCCCCC CCCCCCCCCCCC
149 deeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeep: node::Handle<IdRef<'id, Node<K, V>>,
155 struct Foo<T>(T) where T: Copy, T: Eq;
156 struct Foo<T>(TTTTTTTTTTTTTTTTT, UUUUUUUUUUUUUUUUUUUUUUUU, TTTTTTTTTTTTTTTTTTT, UUUUUUUUUUUUUUUUUUU);
157 struct Foo<T>(TTTTTTTTTTTTTTTTTT, UUUUUUUUUUUUUUUUUUUUUUUU, TTTTTTTTTTTTTTTTTTT) where T: PartialEq;
158 struct Foo<T>(TTTTTTTTTTTTTTTTT, UUUUUUUUUUUUUUUUUUUUUUUU, TTTTTTTTTTTTTTTTTTTTT) where T: PartialEq;
159 struct Foo<T>(TTTTTTTTTTTTTTTTT, UUUUUUUUUUUUUUUUUUUUUUUU, TTTTTTTTTTTTTTTTTTT, UUUUUUUUUUUUUUUUUUU) where T: PartialEq;
160 struct Foo<T>(TTTTTTTTTTTTTTTTT, // Foo
161 UUUUUUUUUUUUUUUUUUUUUUUU /* Bar */,
164 // Qux (FIXME #572 - doc comment)
165 UUUUUUUUUUUUUUUUUUU);
168 struct X<T> where T: Sized {
173 struct Foo<T>(TTTTTTTTTTTTTTTTTTT,
175 UUUUUUUUUUUUUUUUUUU);
178 pub ptr: *const libc::c_void,
180 *const libc::c_void, tracer : *mut JSTracer ),
194 struct Foo { /* comment */ }
195 struct Foo( /* comment */ );
199 the_quick_brown_fox_jumps_over_the_lazy_dog:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA,
203 deeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeep: node::Handle<IdRef<'id, Node<Key, Value>>,
208 struct Foo<C=()>(String);
212 convex_shape.set_point(0, &Vector2f { x: 400.0, y: 100.0 });
213 convex_shape.set_point(1, &Vector2f { x: 500.0, y: 70.0 });
214 convex_shape.set_point(2, &Vector2f { x: 450.0, y: 100.0 });
215 convex_shape.set_point(3, &Vector2f { x: 580.0, y: 150.0 });
218 // Vertical alignment
225 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx: u32, // 1
227 zzz: u32, // comment3
229 aaaaaa: u32, // comment4
235 aaaaaaa: u32, /* multi
241 do_not_push_this_comment1: u32, // comment1
242 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx: u32, // 2
243 please_do_not_push_this_comment3: u32, // comment3
245 do_not_push_this_comment1: u32, // comment1
247 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx: u32, // 2
248 please_do_not_push_this_comment3: u32, // comment3
250 do_not_push_this_comment1: u32, // comment1
251 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx: u32, // 2
253 please_do_not_push_this_comment3: u32, // comment3
256 // structs with long identifier
257 struct Loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong {}
258 struct Looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong {}
259 struct Loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong {}
260 struct Loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong { x: i32 }
262 // structs with visibility, do not duplicate visibility (#2110).
263 pub(in self) struct Foo{}
264 pub(super) struct Foo{}
265 pub(crate) struct Foo{}
266 pub(in self) struct Foo();
267 pub(super) struct Foo();
268 pub(crate) struct Foo();
271 pub struct ReadinessCheckRegistry(Mutex<HashMap<Arc<String>, Box<Fn() -> ReadinessCheck + Sync + Send>>>);
273 // #2144 unit struct with generics
274 struct MyBox<T:?Sized>;
275 struct MyBoxx<T, S> where T: ?Sized, S: Clone;
281 pub join: Vec<String>,
282 #[serde(default)] pub tls: bool,
286 struct Paren((i32)) where i32: Trait;
287 struct Parens((i32, i32)) where i32: Trait;