Skip to content

Commit b8ce853

Browse files
committed
Refactor the end of generate_item_def_id_path.
To avoids the early return and duplication of `Ok((url_parts, shortty, fqp))`.
1 parent fa8e910 commit b8ce853

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/librustdoc/html/format.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -483,12 +483,12 @@ 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) = make_href(root_path, shortty, url_parts, &fqp, is_remote)?;
487-
if def_id == original_def_id {
488-
return Ok((url_parts, shortty, fqp));
489-
}
490-
let kind = ItemType::from_def_kind(original_def_kind, Some(def_kind));
491-
Ok((format!("{url_parts}#{kind}.{}", tcx.item_name(original_def_id)), shortty, fqp))
486+
let (mut url_parts, shortty) = make_href(root_path, shortty, url_parts, &fqp, is_remote)?;
487+
if def_id != original_def_id {
488+
let kind = ItemType::from_def_kind(original_def_kind, Some(def_kind));
489+
url_parts = format!("{url_parts}#{kind}.{}", tcx.item_name(original_def_id))
490+
};
491+
Ok((url_parts, shortty, fqp))
492492
}
493493

494494
fn to_module_fqp(shortty: ItemType, fqp: &[Symbol]) -> &[Symbol] {

0 commit comments

Comments
 (0)