Skip to content

Commit 9a80bc8

Browse files
committed
Correctly output links for primitive types which enclose their contents
1 parent cd1b845 commit 9a80bc8

File tree

1 file changed

+22
-9
lines changed

1 file changed

+22
-9
lines changed

src/librustdoc/html/format.rs

+22-9
Original file line numberDiff line numberDiff line change
@@ -456,23 +456,36 @@ impl fmt::Display for clean::Type {
456456
decl.decl)
457457
}
458458
clean::Tuple(ref typs) => {
459-
primitive_link(f, clean::PrimitiveTuple,
460-
&*match &**typs {
461-
[ref one] => format!("({},)", one),
462-
many => format!("({})", CommaSep(&many)),
463-
})
459+
match &**typs {
460+
[] => primitive_link(f, clean::PrimitiveTuple, "()"),
461+
[ref one] => {
462+
try!(primitive_link(f, clean::PrimitiveTuple, "("));
463+
try!(write!(f, "{}", one));
464+
primitive_link(f, clean::PrimitiveTuple, ")")
465+
}
466+
many => {
467+
try!(primitive_link(f, clean::PrimitiveTuple, "("));
468+
try!(write!(f, "{}", CommaSep(&many)));
469+
primitive_link(f, clean::PrimitiveTuple, ")")
470+
}
471+
}
464472
}
465473
clean::Vector(ref t) => {
466-
primitive_link(f, clean::Slice, &format!("[{}]", **t))
474+
try!(primitive_link(f, clean::Slice, &format!("[")));
475+
try!(write!(f, "{}", t));
476+
primitive_link(f, clean::Slice, &format!("]"))
467477
}
468478
clean::FixedVector(ref t, ref s) => {
479+
try!(primitive_link(f, clean::PrimitiveType::Array, "["));
480+
try!(write!(f, "{}", t));
469481
primitive_link(f, clean::PrimitiveType::Array,
470-
&format!("[{}; {}]", **t, *s))
482+
&format!("; {}]", *s))
471483
}
472484
clean::Bottom => f.write_str("!"),
473485
clean::RawPointer(m, ref t) => {
474-
primitive_link(f, clean::PrimitiveType::PrimitiveRawPointer,
475-
&format!("*{}{}", RawMutableSpace(m), **t))
486+
try!(primitive_link(f, clean::PrimitiveType::PrimitiveRawPointer,
487+
&format!("*{}", RawMutableSpace(m))));
488+
write!(f, "{}", t)
476489
}
477490
clean::BorrowedRef{ lifetime: ref l, mutability, type_: ref ty} => {
478491
let lt = match *l {

0 commit comments

Comments
 (0)