@@ -625,8 +625,7 @@ pub(crate) fn href_relative_parts<'fqp>(
625
625
let dissimilar_part_count = relative_to_fqp. len ( ) - i;
626
626
let fqp_module = & fqp[ i..fqp. len ( ) ] ;
627
627
return Box :: new (
628
- iter:: repeat ( sym:: dotdot)
629
- . take ( dissimilar_part_count)
628
+ std:: iter:: repeat_n ( sym:: dotdot, dissimilar_part_count)
630
629
. chain ( fqp_module. iter ( ) . copied ( ) ) ,
631
630
) ;
632
631
}
@@ -639,7 +638,7 @@ pub(crate) fn href_relative_parts<'fqp>(
639
638
Ordering :: Greater => {
640
639
// e.g. linking to std::sync from std::sync::atomic
641
640
let dissimilar_part_count = relative_to_fqp. len ( ) - fqp. len ( ) ;
642
- Box :: new ( iter:: repeat ( sym:: dotdot) . take ( dissimilar_part_count) )
641
+ Box :: new ( std :: iter:: repeat_n ( sym:: dotdot, dissimilar_part_count) )
643
642
}
644
643
Ordering :: Equal => {
645
644
// linking to the same module
@@ -770,10 +769,9 @@ fn primitive_link_fragment(
770
769
ExternalLocation :: Local => {
771
770
let cname_sym = ExternalCrate { crate_num : def_id. krate } . name ( cx. tcx ( ) ) ;
772
771
Some ( if cx. current . first ( ) == Some ( & cname_sym) {
773
- iter:: repeat ( sym:: dotdot) . take ( cx. current . len ( ) - 1 ) . collect ( )
772
+ std :: iter:: repeat_n ( sym:: dotdot, cx. current . len ( ) - 1 ) . collect ( )
774
773
} else {
775
- iter:: repeat ( sym:: dotdot)
776
- . take ( cx. current . len ( ) )
774
+ std:: iter:: repeat_n ( sym:: dotdot, cx. current . len ( ) )
777
775
. chain ( iter:: once ( cname_sym) )
778
776
. collect ( )
779
777
} )
0 commit comments