Skip to content

Commit 1ac17fc

Browse files
committed
Remove box syntax from Box<dyn Iterator> construction
The iterators created should be pretty light weight.
1 parent cb5e94b commit 1ac17fc

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/librustdoc/html/format.rs

+8-6
Original file line numberDiff line numberDiff line change
@@ -737,21 +737,23 @@ pub(crate) fn href_relative_parts<'fqp>(
737737
if f != r {
738738
let dissimilar_part_count = relative_to_fqp.len() - i;
739739
let fqp_module = &fqp[i..fqp.len()];
740-
return box iter::repeat(sym::dotdot)
741-
.take(dissimilar_part_count)
742-
.chain(fqp_module.iter().copied());
740+
return Box::new(
741+
iter::repeat(sym::dotdot)
742+
.take(dissimilar_part_count)
743+
.chain(fqp_module.iter().copied()),
744+
);
743745
}
744746
}
745747
// e.g. linking to std::sync::atomic from std::sync
746748
if relative_to_fqp.len() < fqp.len() {
747-
box fqp[relative_to_fqp.len()..fqp.len()].iter().copied()
749+
Box::new(fqp[relative_to_fqp.len()..fqp.len()].iter().copied())
748750
// e.g. linking to std::sync from std::sync::atomic
749751
} else if fqp.len() < relative_to_fqp.len() {
750752
let dissimilar_part_count = relative_to_fqp.len() - fqp.len();
751-
box iter::repeat(sym::dotdot).take(dissimilar_part_count)
753+
Box::new(iter::repeat(sym::dotdot).take(dissimilar_part_count))
752754
// linking to the same module
753755
} else {
754-
box iter::empty()
756+
Box::new(iter::empty())
755757
}
756758
}
757759

0 commit comments

Comments
 (0)