1
0
Fork 0

Fix code according to clippy lints

This commit is contained in:
Ishan Jain 2022-07-30 21:50:02 +05:30
parent df44ded31a
commit 017f2c52bf
2 changed files with 2 additions and 4 deletions

View File

@ -140,7 +140,7 @@ fn parse_page<'a>(
BTreePage::InteriorTable => {
let rows = cell_pointers
.into_iter()
.map(move |cp| {
.filter_map(move |cp| {
let stream = &database[table_page_offset + cp as usize..];
let left_child_id =
u32::from_be_bytes([stream[0], stream[1], stream[2], stream[3]]);
@ -154,7 +154,6 @@ fn parse_page<'a>(
db_header.page_size as usize * (left_child_id as usize - 1),
)
})
.flatten()
.flatten();
if let Some(rp) = page_header.right_most_pointer {

View File

@ -30,8 +30,7 @@ fn usable_value(usable_size: u8, byte: u8) -> u8 {
fn read_usable_bytes(stream: &[u8]) -> Vec<u8> {
let mut usable_bytes = vec![];
for i in 0..8 {
let byte = stream[i];
for &byte in stream.iter().take(8) {
usable_bytes.push(byte);
if starts_with_zero(byte) {
break;