Skip to content

Commit 9a62adf

Browse files
committed
---
yaml --- r: 7647 b: refs/heads/master c: fa3368b h: refs/heads/master i: 7645: f781971 7643: cc689d2 7639: 1582742 7631: 1f233ac 7615: 468636b v: v3
1 parent c1abaf8 commit 9a62adf

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: a7d3544d10e1fd44fd3e3d300e7c56917ed4a305
2+
refs/heads/master: fa3368bc71611f071489a3a5183bd572bc6f4022

trunk/src/rustdoc/prune_undoc_pass.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,14 @@ fn fold_fn(
5353
} else {
5454
none
5555
}
56+
},
57+
return: {
58+
ty: if option::is_some(doc.return.desc) {
59+
doc.return.ty
60+
} else {
61+
none
62+
}
63+
with doc.return
5664
}
5765
with *doc
5866
};
@@ -85,6 +93,17 @@ fn should_not_elide_fns_with_documented_arguments() {
8593
assert vec::is_not_empty(*doc.topmod.fns);
8694
}
8795

96+
#[test]
97+
fn should_elide_undocumented_return_values() {
98+
let source = "#[doc = \"fonz\"] fn a() -> int { }";
99+
let srv = astsrv::mk_srv_from_str(source);
100+
let doc = extract::from_srv(srv, "");
101+
let doc = tystr_pass::mk_pass()(srv, doc);
102+
let doc = attr_pass::mk_pass()(srv, doc);
103+
let doc = run(srv, doc);
104+
assert doc.topmod.fns[0].return.ty == none;
105+
}
106+
88107
fn fold_modlist(
89108
fold: fold::fold<ctxt>,
90109
list: doc::modlist

0 commit comments

Comments
 (0)