Skip to content

Commit b9b482e

Browse files
committed
Simplify make_href.
It never fails, so it doesn't need to return `Result`. And the `ItemType` in the result is just a copy of the one passed in via the `shortty` arg, so it can also be removed.
1 parent f19d40a commit b9b482e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/librustdoc/html/format.rs

Lines changed: 5 additions & 5 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 (mut url_parts, shortty) = make_href(root_path, shortty, url_parts, &fqp, is_remote)?;
486+
let mut url_parts = make_href(root_path, shortty, url_parts, &fqp, is_remote);
487487
if def_id != original_def_id {
488488
let kind = ItemType::from_def_kind(original_def_kind, Some(def_kind));
489489
url_parts = format!("{url_parts}#{kind}.{}", tcx.item_name(original_def_id))
@@ -521,7 +521,7 @@ fn make_href(
521521
mut url_parts: UrlPartsBuilder,
522522
fqp: &[Symbol],
523523
is_remote: bool,
524-
) -> Result<(String, ItemType), HrefError> {
524+
) -> String {
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))
539+
url_parts.finish()
540540
}
541541

542542
pub(crate) fn href_with_root_path(
@@ -606,8 +606,8 @@ pub(crate) fn href_with_root_path(
606606
}
607607
}
608608
};
609-
make_href(root_path, shortty, url_parts, fqp, is_remote)
610-
.map(|(url_parts, short_ty)| (url_parts, short_ty, fqp.clone()))
609+
let url_parts = make_href(root_path, shortty, url_parts, &fqp, is_remote);
610+
Ok((url_parts, shortty, fqp.clone()))
611611
}
612612

613613
pub(crate) fn href(

0 commit comments

Comments
 (0)