1
Fork 0

Rollup merge of #84466 - jyn514:prim-str, r=GuillaumeGomez

rustdoc: Remove `PrimitiveType::{to_url_str, as_str}`

These can easily be rewritten in terms of `as_sym`, and this avoids bugs where the two get out of sync.

I don't expect this to have a perf impact, but I'll start a perf run just in case.
This commit is contained in:
Yuki Okushi 2021-06-05 06:13:30 +09:00 committed by GitHub
commit 74c744e54a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 45 deletions

View file

@ -574,7 +574,7 @@ fn primitive_link(
f,
"<a class=\"primitive\" href=\"{}primitive.{}.html\">",
"../".repeat(len),
prim.to_url_str()
prim.as_sym()
)?;
needs_termination = true;
}
@ -603,7 +603,7 @@ fn primitive_link(
f,
"<a class=\"primitive\" href=\"{}/primitive.{}.html\">",
loc.join("/"),
prim.to_url_str()
prim.as_sym()
)?;
needs_termination = true;
}
@ -677,7 +677,7 @@ fn fmt_type<'cx>(
fmt::Display::fmt(&tybounds(param_names, cx), f)
}
clean::Infer => write!(f, "_"),
clean::Primitive(prim) => primitive_link(f, prim, prim.as_str(), cx),
clean::Primitive(prim) => primitive_link(f, prim, &*prim.as_sym().as_str(), cx),
clean::BareFunction(ref decl) => {
if f.alternate() {
write!(