File tree Expand file tree Collapse file tree 6 files changed +31
-48
lines changed Expand file tree Collapse file tree 6 files changed +31
-48
lines changed Original file line number Diff line number Diff line change @@ -158,20 +158,12 @@ fn fold_fn(
158
158
}
159
159
160
160
fn merge_ret_attrs (
161
- doc : option < doc:: retdoc > ,
161
+ doc : doc:: retdoc ,
162
162
attrs : option < str >
163
- ) -> option < doc:: retdoc > {
164
- alt doc {
165
- some( doc) {
166
- some ( {
167
- desc: attrs
168
- with doc
169
- } )
170
- }
171
- none {
172
- // FIXME: Warning about documenting nil?
173
- none
174
- }
163
+ ) -> doc:: retdoc {
164
+ {
165
+ desc: attrs
166
+ with doc
175
167
}
176
168
}
177
169
}
@@ -204,7 +196,7 @@ fn fold_fn_should_extract_return_attributes() {
204
196
let doc = tystr_pass:: mk_pass ( ) ( srv, doc) ;
205
197
let fold = fold:: default_seq_fold ( srv) ;
206
198
let doc = fold_fn ( fold, doc. topmod . fns [ 0 ] ) ;
207
- assert option :: get ( doc. return ) . desc == some ( "what" ) ;
199
+ assert doc. return . desc == some ( "what" ) ;
208
200
}
209
201
210
202
#[ test]
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ type fndoc = ~{
22
22
brief : option < str > ,
23
23
desc : option < str > ,
24
24
args : [ argdoc ] ,
25
- return : option < retdoc > ,
25
+ return : retdoc ,
26
26
sig : option < str >
27
27
} ;
28
28
Original file line number Diff line number Diff line change @@ -80,7 +80,10 @@ fn fndoc_from_fn(
80
80
brief: none,
81
81
desc: none,
82
82
args: argdocs_from_args ( decl. inputs ) ,
83
- return : none,
83
+ return : {
84
+ desc: none,
85
+ ty: none
86
+ } ,
84
87
sig: none
85
88
}
86
89
}
Original file line number Diff line number Diff line change @@ -222,23 +222,18 @@ fn should_write_argument_description() {
222
222
223
223
fn write_return (
224
224
ctxt : ctxt ,
225
- return : option < doc:: retdoc >
225
+ doc : doc:: retdoc
226
226
) {
227
- alt return {
228
- some ( doc) {
229
- alt doc. ty {
230
- some ( ty) {
231
- ctxt. w . write_line ( #fmt ( "Returns `%s`" , ty) ) ;
227
+ alt doc. ty {
228
+ some ( ty) {
229
+ ctxt. w . write_line ( #fmt ( "Returns `%s`" , ty) ) ;
230
+ ctxt. w . write_line ( "" ) ;
231
+ alt doc. desc {
232
+ some ( d) {
233
+ ctxt. w . write_line ( d) ;
232
234
ctxt. w . write_line ( "" ) ;
233
- alt doc. desc {
234
- some ( d) {
235
- ctxt. w . write_line ( d) ;
236
- ctxt. w . write_line ( "" ) ;
237
- }
238
- none { }
239
- }
240
235
}
241
- none { fail "unimplemented" ; }
236
+ none { }
242
237
}
243
238
}
244
239
none { }
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ fn fold_fn(
32
32
fold. ctxt . have_docs =
33
33
doc. brief != none
34
34
|| doc. desc != none
35
- || doc. return != none;
35
+ || doc. return . desc != none;
36
36
ret doc;
37
37
}
38
38
Original file line number Diff line number Diff line change @@ -62,23 +62,16 @@ fn should_add_fn_sig() {
62
62
fn merge_ret_ty (
63
63
srv : astsrv:: srv ,
64
64
fn_id : doc:: ast_id ,
65
- doc : option < doc:: retdoc >
66
- ) -> option < doc:: retdoc > {
67
- alt doc {
68
- some( doc) {
69
- fail "unimplemented" ;
70
- }
71
- none {
72
- alt get_ret_ty( srv, fn_id) {
73
- some ( ty) {
74
- some ( {
75
- desc: none,
76
- ty: some ( ty)
77
- } )
78
- }
79
- none { none }
65
+ doc : doc:: retdoc
66
+ ) -> doc:: retdoc {
67
+ alt get_ret_ty ( srv, fn_id) {
68
+ some ( ty) {
69
+ {
70
+ ty: some ( ty)
71
+ with doc
80
72
}
81
73
}
74
+ none { doc }
82
75
}
83
76
}
84
77
@@ -105,7 +98,7 @@ fn should_add_fn_ret_types() {
105
98
let srv = astsrv:: mk_srv_from_str ( source) ;
106
99
let doc = extract:: from_srv ( srv, "" ) ;
107
100
let doc = run ( srv, doc) ;
108
- assert option :: get ( doc. topmod . fns [ 0 ] . return ) . ty == some ( "int" ) ;
101
+ assert doc. topmod . fns [ 0 ] . return . ty == some ( "int" ) ;
109
102
}
110
103
111
104
#[ test]
@@ -114,7 +107,7 @@ fn should_not_add_nil_ret_type() {
114
107
let srv = astsrv:: mk_srv_from_str ( source) ;
115
108
let doc = extract:: from_srv ( srv, "" ) ;
116
109
let doc = run ( srv, doc) ;
117
- assert doc. topmod . fns [ 0 ] . return == none;
110
+ assert doc. topmod . fns [ 0 ] . return . ty == none;
118
111
}
119
112
120
113
fn merge_arg_tys (
You can’t perform that action at this time.
0 commit comments