diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs
index 08499cef33e..fe33018df28 100644
--- a/src/librustdoc/html/format.rs
+++ b/src/librustdoc/html/format.rs
@@ -488,7 +488,7 @@ crate fn href(did: DefId, cx: &Context<'_>) -> Result<(String, ItemType, Vec &[String] {
- if shortty == ItemType::Module { &fqp[..] } else { &fqp[..fqp.len() - 1] }
+ if shortty == ItemType::Module { fqp } else { &fqp[..fqp.len() - 1] }
}
if !did.is_local() && !cache.access_levels.is_public(did) && !cache.document_private {
@@ -509,7 +509,7 @@ crate fn href(did: DefId, cx: &Context<'_>) -> Result<(String, ItemType, Vec {
let s = s.trim_end_matches('/');
- let mut s = vec![&s[..]];
+ let mut s = vec![s];
s.extend(module_fqp[..].iter().map(String::as_str));
s
}