Remove box syntax from Box<dyn Iterator> construction
The iterators created should be pretty light weight.
This commit is contained in:
parent
cb5e94bb62
commit
1ac17fcddb
1 changed files with 8 additions and 6 deletions
|
@ -737,21 +737,23 @@ pub(crate) fn href_relative_parts<'fqp>(
|
||||||
if f != r {
|
if f != r {
|
||||||
let dissimilar_part_count = relative_to_fqp.len() - i;
|
let dissimilar_part_count = relative_to_fqp.len() - i;
|
||||||
let fqp_module = &fqp[i..fqp.len()];
|
let fqp_module = &fqp[i..fqp.len()];
|
||||||
return box iter::repeat(sym::dotdot)
|
return Box::new(
|
||||||
.take(dissimilar_part_count)
|
iter::repeat(sym::dotdot)
|
||||||
.chain(fqp_module.iter().copied());
|
.take(dissimilar_part_count)
|
||||||
|
.chain(fqp_module.iter().copied()),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// e.g. linking to std::sync::atomic from std::sync
|
// e.g. linking to std::sync::atomic from std::sync
|
||||||
if relative_to_fqp.len() < fqp.len() {
|
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
|
// e.g. linking to std::sync from std::sync::atomic
|
||||||
} else if fqp.len() < relative_to_fqp.len() {
|
} else if fqp.len() < relative_to_fqp.len() {
|
||||||
let dissimilar_part_count = relative_to_fqp.len() - 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
|
// linking to the same module
|
||||||
} else {
|
} else {
|
||||||
box iter::empty()
|
Box::new(iter::empty())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue