Skip to content

Commit fa8e910

Browse files
committed
Simplify make_href.
Currently it is passed an `fqp` slice which it calls `to_vec` on and returns. This is a bit odd. It's better to let the call site clone if necessary. (One call site does, one does not).
1 parent 581fd27 commit fa8e910

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/librustdoc/html/format.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ fn generate_item_def_id_path(
483483
let mut is_remote = false;
484484

485485
let url_parts = url_parts(cx.cache(), def_id, module_fqp, &cx.current, &mut is_remote)?;
486-
let (url_parts, shortty, fqp) = make_href(root_path, shortty, url_parts, &fqp, is_remote)?;
486+
let (url_parts, shortty) = make_href(root_path, shortty, url_parts, &fqp, is_remote)?;
487487
if def_id == original_def_id {
488488
return Ok((url_parts, shortty, fqp));
489489
}
@@ -521,7 +521,7 @@ fn make_href(
521521
mut url_parts: UrlPartsBuilder,
522522
fqp: &[Symbol],
523523
is_remote: bool,
524-
) -> Result<(String, ItemType, Vec<Symbol>), HrefError> {
524+
) -> Result<(String, ItemType), HrefError> {
525525
if !is_remote && let Some(root_path) = root_path {
526526
let root = root_path.trim_end_matches('/');
527527
url_parts.push_front(root);
@@ -536,7 +536,7 @@ fn make_href(
536536
url_parts.push_fmt(format_args!("{shortty}.{last}.html"));
537537
}
538538
}
539-
Ok((url_parts.finish(), shortty, fqp.to_vec()))
539+
Ok((url_parts.finish(), shortty))
540540
}
541541

542542
pub(crate) fn href_with_root_path(
@@ -607,6 +607,7 @@ pub(crate) fn href_with_root_path(
607607
}
608608
};
609609
make_href(root_path, shortty, url_parts, fqp, is_remote)
610+
.map(|(url_parts, short_ty)| (url_parts, short_ty, fqp.clone()))
610611
}
611612

612613
pub(crate) fn href(

0 commit comments

Comments
 (0)