@@ -92,24 +92,23 @@ impl Container {
9292 r += !chunk & u64:: from ( ( chunk << 1 ) . count_ones ( ) ) ;
9393 r += !next_chunk & u64:: from ( ( chunk >> 63 ) . count_ones ( ) ) ;
9494 }
95- if ( 2 + 4 * r) < 8192 {
96- let bits = std:: mem:: replace ( bits, Box :: new ( [ 0 ; 1024 ] ) ) ;
97- * self = Container :: Run ( Vec :: new ( ) ) ;
98- for ( i, bits) in bits. iter ( ) . copied ( ) . enumerate ( ) {
99- if bits == 0 {
100- continue ;
101- }
102- for j in 0 ..64 {
103- let value = ( u16:: try_from ( i) . unwrap ( ) << 6 ) | j;
104- if bits & ( 1 << j) != 0 {
105- self . push ( value) ;
106- }
95+ if ( 2 + 4 * r) >= 8192 {
96+ return false ;
97+ }
98+ let bits = std:: mem:: replace ( bits, Box :: new ( [ 0 ; 1024 ] ) ) ;
99+ * self = Container :: Run ( Vec :: new ( ) ) ;
100+ for ( i, bits) in bits. iter ( ) . copied ( ) . enumerate ( ) {
101+ if bits == 0 {
102+ continue ;
103+ }
104+ for j in 0 ..64 {
105+ let value = ( u16:: try_from ( i) . unwrap ( ) << 6 ) | j;
106+ if bits & ( 1 << j) != 0 {
107+ self . push ( value) ;
107108 }
108109 }
109- true
110- } else {
111- false
112110 }
111+ true
113112 }
114113 Container :: Array ( array) if array. len ( ) <= 5 => false ,
115114 Container :: Array ( array) => {
@@ -121,16 +120,15 @@ impl Container {
121120 }
122121 prev = Some ( value) ;
123122 }
124- if 2 + 4 * r < 2 * array. len ( ) + 2 {
125- let array = std:: mem:: replace ( array, Vec :: new ( ) ) ;
126- * self = Container :: Run ( Vec :: new ( ) ) ;
127- for value in array {
128- self . push ( value) ;
129- }
130- true
131- } else {
132- false
123+ if 2 + 4 * r >= 2 * array. len ( ) + 2 {
124+ return false ;
125+ }
126+ let array = std:: mem:: replace ( array, Vec :: new ( ) ) ;
127+ * self = Container :: Run ( Vec :: new ( ) ) ;
128+ for value in array {
129+ self . push ( value) ;
133130 }
131+ true
134132 }
135133 Container :: Run ( _) => true ,
136134 }
0 commit comments