@@ -32,19 +32,23 @@ fn top_moddoc_from_crate(
32
32
moddoc_from_mod ( crate . node. module , default_name, ast:: crate_node_id)
33
33
}
34
34
35
+ fn mk_itemdoc ( id : ast:: node_id , name : ast:: ident ) -> doc:: itemdoc {
36
+ {
37
+ id: id,
38
+ name: name,
39
+ path: [ ] ,
40
+ brief: none,
41
+ desc: none,
42
+ }
43
+ }
44
+
35
45
fn moddoc_from_mod (
36
46
module : ast:: _mod ,
37
47
name : ast:: ident ,
38
48
id : ast:: node_id
39
49
) -> doc:: moddoc {
40
50
{
41
- item : {
42
- id : id,
43
- name : name,
44
- path : [ ] ,
45
- brief : none,
46
- desc : none,
47
- } ,
51
+ item: mk_itemdoc ( id, name) ,
48
52
items: ~vec:: filter_map ( module. items ) { |item|
49
53
alt item. node {
50
54
ast:: item_mod ( m) {
@@ -101,13 +105,7 @@ fn fndoc_from_fn(
101
105
id : ast:: node_id
102
106
) -> doc:: fndoc {
103
107
{
104
- item : {
105
- id : id,
106
- name : name,
107
- path : [ ] ,
108
- brief : none,
109
- desc : none,
110
- } ,
108
+ item: mk_itemdoc ( id, name) ,
111
109
args: argdocs_from_args ( decl. inputs ) ,
112
110
return : {
113
111
desc: none,
@@ -145,13 +143,7 @@ fn constdoc_from_const(
145
143
id : ast:: node_id
146
144
) -> doc:: constdoc {
147
145
{
148
- item : {
149
- id : id,
150
- name : name,
151
- path : [ ] ,
152
- brief : none,
153
- desc : none,
154
- } ,
146
+ item: mk_itemdoc ( id, name) ,
155
147
ty: none
156
148
}
157
149
}
@@ -169,13 +161,7 @@ fn enumdoc_from_enum(
169
161
variants : [ ast:: variant ]
170
162
) -> doc:: enumdoc {
171
163
{
172
- item : {
173
- id : id,
174
- name : name,
175
- path : [ ] ,
176
- brief : none,
177
- desc : none,
178
- } ,
164
+ item: mk_itemdoc ( id, name) ,
179
165
variants: variantdocs_from_variants ( variants)
180
166
}
181
167
}
@@ -213,13 +199,7 @@ fn resdoc_from_resource(
213
199
id : ast:: node_id
214
200
) -> doc:: resdoc {
215
201
{
216
- item : {
217
- id : id,
218
- name : name,
219
- path : [ ] ,
220
- brief : none,
221
- desc : none,
222
- } ,
202
+ item: mk_itemdoc ( id, name) ,
223
203
args: argdocs_from_args ( decl. inputs ) ,
224
204
sig: none
225
205
}
@@ -244,13 +224,7 @@ fn ifacedoc_from_iface(
244
224
id : ast:: node_id
245
225
) -> doc:: ifacedoc {
246
226
{
247
- item : {
248
- id : id,
249
- name : name,
250
- path : [ ] ,
251
- brief : none,
252
- desc : none,
253
- } ,
227
+ item: mk_itemdoc ( id, name) ,
254
228
methods: vec:: map ( methods) { |method|
255
229
{
256
230
name: method. ident ,
@@ -292,13 +266,7 @@ fn impldoc_from_impl(
292
266
id : ast:: node_id
293
267
) -> doc:: impldoc {
294
268
{
295
- item : {
296
- id : id,
297
- name : name,
298
- path : [ ] ,
299
- brief : none,
300
- desc : none,
301
- } ,
269
+ item: mk_itemdoc ( id, name) ,
302
270
iface_ty: none,
303
271
self_ty: none,
304
272
methods: vec:: map ( methods) { |method|
@@ -347,13 +315,7 @@ fn tydoc_from_ty(
347
315
id : ast:: node_id
348
316
) -> doc:: tydoc {
349
317
{
350
- item : {
351
- id : id,
352
- name : name,
353
- path : [ ] ,
354
- brief : none,
355
- desc : none,
356
- } ,
318
+ item: mk_itemdoc ( id, name) ,
357
319
sig: none
358
320
}
359
321
}
0 commit comments