Auto merge of #99066 - est31:remove_box_librustdoc, r=jsha
Remove most box syntax from librustdoc This is the second attempt after the librustdoc specific changes have been reverted from #87781 in #89134, due to a minor, but exant regression caused by the changes. ~~There have been some changes to librustdoc in the past and maybe thanks to them there is no regression any more. If there is still a regression, one can investigate further and maybe find ways to fix the regressions. Thus, i request a perf run.~~ Edit: turns out there is still a regression, but it's caused only by a subset of the changes. So I've changed this PR to only contains the changes that don't cause any performance regressions, keeping the regression causing changes for a later PR.
This commit is contained in:
commit
a639f89d04
8 changed files with 47 additions and 39 deletions
|
@ -743,21 +743,23 @@ pub(crate) fn href_relative_parts<'fqp>(
|
|||
if f != r {
|
||||
let dissimilar_part_count = relative_to_fqp.len() - i;
|
||||
let fqp_module = &fqp[i..fqp.len()];
|
||||
return box iter::repeat(sym::dotdot)
|
||||
.take(dissimilar_part_count)
|
||||
.chain(fqp_module.iter().copied());
|
||||
return Box::new(
|
||||
iter::repeat(sym::dotdot)
|
||||
.take(dissimilar_part_count)
|
||||
.chain(fqp_module.iter().copied()),
|
||||
);
|
||||
}
|
||||
}
|
||||
// e.g. linking to std::sync::atomic from std::sync
|
||||
if relative_to_fqp.len() < fqp.len() {
|
||||
box fqp[relative_to_fqp.len()..fqp.len()].iter().copied()
|
||||
Box::new(fqp[relative_to_fqp.len()..fqp.len()].iter().copied())
|
||||
// e.g. linking to std::sync from std::sync::atomic
|
||||
} else if fqp.len() < relative_to_fqp.len() {
|
||||
let dissimilar_part_count = relative_to_fqp.len() - fqp.len();
|
||||
box iter::repeat(sym::dotdot).take(dissimilar_part_count)
|
||||
Box::new(iter::repeat(sym::dotdot).take(dissimilar_part_count))
|
||||
// linking to the same module
|
||||
} else {
|
||||
box iter::empty()
|
||||
Box::new(iter::empty())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue