Skip to content

Commit ffaee75

Browse files
Update src/librustdoc/html/render/search_index/encode.rs
Co-authored-by: Guillaume Gomez <[email protected]>
1 parent c65f7d8 commit ffaee75

File tree

1 file changed

+14
-15
lines changed
  • src/librustdoc/html/render/search_index

1 file changed

+14
-15
lines changed

src/librustdoc/html/render/search_index/encode.rs

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -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) => {

0 commit comments

Comments
 (0)