Skip to content

Commit 994fc83

Browse files
committed
---
yaml --- r: 11714 b: refs/heads/master c: ac8b2c8 h: refs/heads/master v: v3
1 parent 67a81e1 commit 994fc83

File tree

6 files changed

+20
-241
lines changed

6 files changed

+20
-241
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 5c28b2c1d111c285148f977a0f39c35cac264db5
2+
refs/heads/master: ac8b2c83542fdd470c775e0a9e99cd2a26afbf36
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
55
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf

trunk/src/rustdoc/doc.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,7 @@ type argdoc = {
7070
};
7171

7272
type retdoc = {
73-
desc: option<str>,
74-
ty: option<str>
73+
desc: option<str>
7574
};
7675

7776
type enumdoc = {

trunk/src/rustdoc/extract.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,7 @@ fn fndoc_from_fn(
136136
item: itemdoc,
137137
args: argdocs_from_args(decl.inputs),
138138
return: {
139-
desc: none,
140-
ty: none
139+
desc: none
141140
},
142141
failure: none,
143142
sig: none
@@ -253,8 +252,7 @@ fn ifacedoc_from_iface(
253252
desc: none,
254253
args: argdocs_from_args(method.decl.inputs),
255254
return: {
256-
desc: none,
257-
ty: none
255+
desc: none
258256
},
259257
failure: none,
260258
sig: none
@@ -296,8 +294,7 @@ fn impldoc_from_impl(
296294
desc: none,
297295
args: argdocs_from_args(method.decl.inputs),
298296
return: {
299-
desc: none,
300-
ty: none
297+
desc: none
301298
},
302299
failure: none,
303300
sig: none

trunk/src/rustdoc/markdown_pass.rs

Lines changed: 13 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -531,37 +531,29 @@ fn write_return(
531531
ctxt: ctxt,
532532
doc: doc::retdoc
533533
) {
534-
alt doc.ty {
535-
some(ty) {
536-
ctxt.w.write_str(#fmt("Returns `%s`", ty));
537-
alt doc.desc {
538-
some(d) {
539-
ctxt.w.write_line(#fmt(" - %s", d));
540-
ctxt.w.write_line("");
541-
}
542-
none {
543-
ctxt.w.write_line("");
544-
ctxt.w.write_line("");
545-
}
546-
}
534+
alt doc.desc {
535+
some(d) {
536+
ctxt.w.write_line(#fmt("Returns - %s", d));
537+
ctxt.w.write_line("");
547538
}
548539
none { }
549540
}
550541
}
551542

552543
#[test]
553544
fn should_write_return_type_on_new_line() {
554-
let markdown = test::render("fn a() -> int { }");
555-
assert str::contains(markdown, "\nReturns `int`");
545+
let markdown = test::render(
546+
"#[doc(return = \"test\")] fn a() -> int { }");
547+
assert str::contains(markdown, "\nReturns - test");
556548
}
557549

558550
#[test]
559551
fn should_write_blank_line_between_return_type_and_next_header() {
560552
let markdown = test::render(
561-
"fn a() -> int { } \
553+
"#[doc(return = \"test\")] fn a() -> int { } \
562554
fn b() -> int { }"
563555
);
564-
assert str::contains(markdown, "Returns `int`\n\n##");
556+
assert str::contains(markdown, "Returns - test\n\n##");
565557
}
566558

567559
#[test]
@@ -578,14 +570,6 @@ fn should_write_blank_line_after_return_description() {
578570
assert str::contains(markdown, "blorp\n\n");
579571
}
580572

581-
#[test]
582-
fn should_write_return_description_on_same_line_as_type() {
583-
let markdown = test::render(
584-
"#[doc(return = \"blorp\")] fn a() -> int { }"
585-
);
586-
assert str::contains(markdown, "Returns `int` - blorp");
587-
}
588-
589573
fn write_failure(ctxt: ctxt, str: option<str>) {
590574
alt str {
591575
some(str) {
@@ -823,8 +807,8 @@ fn should_not_write_iface_method_arguments_if_none() {
823807
#[test]
824808
fn should_write_iface_method_return_info() {
825809
let markdown = test::render(
826-
"iface a { fn a() -> int; }");
827-
assert str::contains(markdown, "Returns `int`");
810+
"iface a { #[doc(return = \"test\")] fn a() -> int; }");
811+
assert str::contains(markdown, "Returns - test");
828812
}
829813

830814
#[test]
@@ -905,8 +889,8 @@ fn should_not_write_impl_method_arguments_if_none() {
905889
#[test]
906890
fn should_write_impl_method_return_info() {
907891
let markdown = test::render(
908-
"impl a for int { fn a() -> int { } }");
909-
assert str::contains(markdown, "Returns `int`");
892+
"impl a for int { #[doc(return = \"test\")] fn a() -> int { } }");
893+
assert str::contains(markdown, "Returns - test");
910894
}
911895

912896
#[test]

trunk/src/rustdoc/prune_undoc_details_pass.rs

Lines changed: 2 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ fn fold_fn(
3131
let doc = fold::default_seq_fold_fn(fold, doc);
3232

3333
{
34-
args: prune_args(doc.args),
35-
return: prune_return(doc.return)
34+
args: prune_args(doc.args)
3635
with doc
3736
}
3837
}
@@ -47,35 +46,12 @@ fn prune_args(docs: [doc::argdoc]) -> [doc::argdoc] {
4746
}
4847
}
4948

50-
fn prune_return(doc: doc::retdoc) -> doc::retdoc {
51-
{
52-
ty: if option::is_some(doc.desc) {
53-
doc.ty
54-
} else {
55-
none
56-
}
57-
with doc
58-
}
59-
}
60-
6149
#[test]
6250
fn should_elide_undocumented_arguments() {
6351
let doc = test::mk_doc("#[doc = \"hey\"] fn a(b: int) { }");
6452
assert vec::is_empty(doc.cratemod().fns()[0].args);
6553
}
6654

67-
#[test]
68-
fn should_elide_undocumented_return_values() {
69-
let source = "#[doc = \"fonz\"] fn a() -> int { }";
70-
astsrv::from_str(source) {|srv|
71-
let doc = extract::from_srv(srv, "");
72-
let doc = tystr_pass::mk_pass().f(srv, doc);
73-
let doc = attr_pass::mk_pass().f(srv, doc);
74-
let doc = run(srv, doc);
75-
assert doc.cratemod().fns()[0].return.ty == none;
76-
}
77-
}
78-
7955
fn fold_res(
8056
fold: fold::fold<()>,
8157
doc: doc::resdoc
@@ -110,8 +86,7 @@ fn fold_iface(
11086
fn prune_methods(docs: [doc::methoddoc]) -> [doc::methoddoc] {
11187
par::anymap(docs) {|doc|
11288
{
113-
args: prune_args(doc.args),
114-
return: prune_return(doc.return)
89+
args: prune_args(doc.args)
11590
with doc
11691
}
11792
}
@@ -123,12 +98,6 @@ fn should_elide_undocumented_iface_method_args() {
12398
assert vec::is_empty(doc.cratemod().ifaces()[0].methods[0].args);
12499
}
125100

126-
#[test]
127-
fn should_elide_undocumented_iface_method_return_values() {
128-
let doc = test::mk_doc("#[doc = \"hey\"] iface i { fn a() -> int; }");
129-
assert doc.cratemod().ifaces()[0].methods[0].return.ty == none;
130-
}
131-
132101
fn fold_impl(
133102
fold: fold::fold<()>,
134103
doc: doc::impldoc
@@ -148,13 +117,6 @@ fn should_elide_undocumented_impl_method_args() {
148117
assert vec::is_empty(doc.cratemod().impls()[0].methods[0].args);
149118
}
150119

151-
#[test]
152-
fn should_elide_undocumented_impl_method_return_values() {
153-
let doc = test::mk_doc(
154-
"#[doc = \"hey\"] impl i for int { fn a() -> int { } }");
155-
assert doc.cratemod().impls()[0].methods[0].return.ty == none;
156-
}
157-
158120
#[cfg(test)]
159121
mod test {
160122
fn mk_doc(source: str) -> doc::doc {

0 commit comments

Comments
 (0)