Clean up src/librustdoc/html/render/search_index/encode.rs
Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
This commit is contained in:
parent
c65f7d8ff1
commit
a272007a20
1 changed files with 22 additions and 24 deletions
|
@ -92,24 +92,23 @@ impl Container {
|
||||||
r += !chunk & u64::from((chunk << 1).count_ones());
|
r += !chunk & u64::from((chunk << 1).count_ones());
|
||||||
r += !next_chunk & u64::from((chunk >> 63).count_ones());
|
r += !next_chunk & u64::from((chunk >> 63).count_ones());
|
||||||
}
|
}
|
||||||
if (2 + 4 * r) < 8192 {
|
if (2 + 4 * r) >= 8192 {
|
||||||
let bits = std::mem::replace(bits, Box::new([0; 1024]));
|
return false;
|
||||||
*self = Container::Run(Vec::new());
|
}
|
||||||
for (i, bits) in bits.iter().copied().enumerate() {
|
let bits = std::mem::replace(bits, Box::new([0; 1024]));
|
||||||
if bits == 0 {
|
*self = Container::Run(Vec::new());
|
||||||
continue;
|
for (i, bits) in bits.iter().copied().enumerate() {
|
||||||
}
|
if bits == 0 {
|
||||||
for j in 0..64 {
|
continue;
|
||||||
let value = (u16::try_from(i).unwrap() << 6) | j;
|
}
|
||||||
if bits & (1 << j) != 0 {
|
for j in 0..64 {
|
||||||
self.push(value);
|
let value = (u16::try_from(i).unwrap() << 6) | j;
|
||||||
}
|
if bits & (1 << j) != 0 {
|
||||||
|
self.push(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
true
|
|
||||||
} else {
|
|
||||||
false
|
|
||||||
}
|
}
|
||||||
|
true
|
||||||
}
|
}
|
||||||
Container::Array(array) if array.len() <= 5 => false,
|
Container::Array(array) if array.len() <= 5 => false,
|
||||||
Container::Array(array) => {
|
Container::Array(array) => {
|
||||||
|
@ -121,16 +120,15 @@ impl Container {
|
||||||
}
|
}
|
||||||
prev = Some(value);
|
prev = Some(value);
|
||||||
}
|
}
|
||||||
if 2 + 4 * r < 2 * array.len() + 2 {
|
if 2 + 4 * r >= 2 * array.len() + 2 {
|
||||||
let array = std::mem::replace(array, Vec::new());
|
return false;
|
||||||
*self = Container::Run(Vec::new());
|
|
||||||
for value in array {
|
|
||||||
self.push(value);
|
|
||||||
}
|
|
||||||
true
|
|
||||||
} else {
|
|
||||||
false
|
|
||||||
}
|
}
|
||||||
|
let array = std::mem::replace(array, Vec::new());
|
||||||
|
*self = Container::Run(Vec::new());
|
||||||
|
for value in array {
|
||||||
|
self.push(value);
|
||||||
|
}
|
||||||
|
true
|
||||||
}
|
}
|
||||||
Container::Run(_) => true,
|
Container::Run(_) => true,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue