about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2025-05-23 11:55:47 +1000
committerNicholas Nethercote <n.nethercote@gmail.com>2025-05-26 15:09:38 +1000
commitb9b482e9d9ea18fa5dcb276c704fb9bec57b9e59 (patch)
tree4c62c417d46ffca366f6771d958a8099f53fd633
parentf19d40a3d6f3344db34020ade05fc232aeae370a (diff)
downloadrust-b9b482e9d9ea18fa5dcb276c704fb9bec57b9e59.tar.gz
rust-b9b482e9d9ea18fa5dcb276c704fb9bec57b9e59.zip
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.
-rw-r--r--src/librustdoc/html/format.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs
index e64d339fabc..1cb6e89218a 100644
--- a/src/librustdoc/html/format.rs
+++ b/src/librustdoc/html/format.rs
@@ -483,7 +483,7 @@ fn generate_item_def_id_path(
     let mut is_remote = false;
 
     let url_parts = url_parts(cx.cache(), def_id, module_fqp, &cx.current, &mut is_remote)?;
-    let (mut url_parts, shortty) = make_href(root_path, shortty, url_parts, &fqp, is_remote)?;
+    let mut url_parts = make_href(root_path, shortty, url_parts, &fqp, is_remote);
     if def_id != original_def_id {
         let kind = ItemType::from_def_kind(original_def_kind, Some(def_kind));
         url_parts = format!("{url_parts}#{kind}.{}", tcx.item_name(original_def_id))
@@ -521,7 +521,7 @@ fn make_href(
     mut url_parts: UrlPartsBuilder,
     fqp: &[Symbol],
     is_remote: bool,
-) -> Result<(String, ItemType), HrefError> {
+) -> String {
     if !is_remote && let Some(root_path) = root_path {
         let root = root_path.trim_end_matches('/');
         url_parts.push_front(root);
@@ -536,7 +536,7 @@ fn make_href(
             url_parts.push_fmt(format_args!("{shortty}.{last}.html"));
         }
     }
-    Ok((url_parts.finish(), shortty))
+    url_parts.finish()
 }
 
 pub(crate) fn href_with_root_path(
@@ -606,8 +606,8 @@ pub(crate) fn href_with_root_path(
             }
         }
     };
-    make_href(root_path, shortty, url_parts, fqp, is_remote)
-        .map(|(url_parts, short_ty)| (url_parts, short_ty, fqp.clone()))
+    let url_parts = make_href(root_path, shortty, url_parts, &fqp, is_remote);
+    Ok((url_parts, shortty, fqp.clone()))
 }
 
 pub(crate) fn href(