提交 79ed898f 编写于 作者: K klutzy

rustdoc: Use new ||/proc syntax

上级 17af6f7d
......@@ -299,22 +299,20 @@ fn fmt(g: &clean::Type, f: &mut fmt::Formatter) {
f.buf.write(s.as_bytes());
}
clean::Closure(ref decl) => {
f.buf.write(match decl.sigil {
ast::BorrowedSigil => "&",
ast::ManagedSigil => "@",
ast::OwnedSigil => "~",
}.as_bytes());
match decl.region {
Some(ref region) => write!(f.buf, "{} ", *region),
None => {}
}
write!(f.buf, "{}{}fn{}",
let region = match decl.region {
Some(ref region) => format!("{} ", *region),
None => ~"",
};
write!(f.buf, "{}{}{arrow, select, yes{ -> {ret}} other{}}",
PuritySpace(decl.purity),
match decl.onceness {
ast::Once => "once ",
ast::Many => "",
match decl.sigil {
ast::OwnedSigil => format!("proc({})", decl.decl.inputs),
ast::BorrowedSigil => format!("{}|{}|", region, decl.decl.inputs),
ast::ManagedSigil => format!("@{}fn({})", region, decl.decl.inputs),
},
decl.decl);
arrow = match decl.decl.output { clean::Unit => "no", _ => "yes" },
ret = decl.decl.output);
// XXX: where are bounds and lifetimes printed?!
}
clean::BareFunction(ref decl) => {
......@@ -374,18 +372,24 @@ fn fmt(g: &clean::Type, f: &mut fmt::Formatter) {
impl fmt::Default for clean::FnDecl {
fn fmt(d: &clean::FnDecl, f: &mut fmt::Formatter) {
write!(f.buf, "({args}){arrow, select, yes{ -> {ret}} other{}}",
args = d.inputs,
arrow = match d.output { clean::Unit => "no", _ => "yes" },
ret = d.output);
}
}
impl fmt::Default for ~[clean::Argument] {
fn fmt(inputs: &~[clean::Argument], f: &mut fmt::Formatter) {
let mut args = ~"";
for (i, input) in d.inputs.iter().enumerate() {
for (i, input) in inputs.iter().enumerate() {
if i > 0 { args.push_str(", "); }
if input.name.len() > 0 {
args.push_str(format!("{}: ", input.name));
}
args.push_str(format!("{}", input.type_));
}
write!(f.buf, "({args}){arrow, select, yes{ -> {ret}} other{}}",
args = args,
arrow = match d.output { clean::Unit => "no", _ => "yes" },
ret = d.output);
f.buf.write(args.as_bytes());
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册