Skip to content

Commit cdf9661

Browse files
committed
Re-use some existing util fns
1 parent c54a953 commit cdf9661

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/librustdoc/html/format.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -965,10 +965,7 @@ fn fmt_type(
965965
write!(f, "]")
966966
}
967967
clean::RawPointer(m, t) => {
968-
let m = match m {
969-
hir::Mutability::Mut => "mut",
970-
hir::Mutability::Not => "const",
971-
};
968+
let m = m.ptr_str();
972969

973970
if matches!(**t, clean::Generic(_)) || t.is_assoc_ty() {
974971
let ty = t.print(cx);
@@ -1406,12 +1403,13 @@ impl clean::FnDecl {
14061403
}
14071404

14081405
fn print_output(&self, cx: &Context<'_>) -> impl Display {
1409-
fmt::from_fn(move |f| match &self.output {
1410-
clean::Tuple(tys) if tys.is_empty() => Ok(()),
1411-
ty if f.alternate() => {
1412-
write!(f, " -> {:#}", ty.print(cx))
1406+
fmt::from_fn(move |f| {
1407+
if self.output.is_unit() {
1408+
return Ok(());
14131409
}
1414-
ty => write!(f, " -&gt; {}", ty.print(cx)),
1410+
1411+
f.write_str(if f.alternate() { " -> " } else { " -&gt; " })?;
1412+
self.output.print(cx).fmt(f)
14151413
})
14161414
}
14171415
}

0 commit comments

Comments
 (0)