rustdoc: Print return value descriptions on same line as type

This commit is contained in:
Brian Anderson 2012-01-23 16:17:46 -08:00
parent fa3368bc71
commit f4c31bda62

View File

@ -226,14 +226,16 @@ fn write_return(
) {
alt doc.ty {
some(ty) {
ctxt.w.write_line(#fmt("Returns `%s`", ty));
ctxt.w.write_line("");
ctxt.w.write_str(#fmt("Returns `%s`", ty));
alt doc.desc {
some(d) {
ctxt.w.write_line(d);
ctxt.w.write_line(#fmt(" - %s", d));
ctxt.w.write_line("");
}
none {
ctxt.w.write_line("");
ctxt.w.write_line("");
}
none { }
}
}
none { }
@ -269,6 +271,14 @@ fn should_write_blank_line_after_return_description() {
assert str::contains(markdown, "blorp\n\n");
}
#[test]
fn should_write_return_description_on_same_line_as_type() {
let markdown = test::render(
"#[doc(return = \"blorp\")] fn a() -> int { }"
);
assert str::contains(markdown, "Returns `int` - blorp");
}
#[cfg(test)]
mod test {
fn render(source: str) -> str {