[all] Apply cargo fmt, and fix clippy warnings
This commit is contained in:
@@ -77,7 +77,7 @@ impl<'a, V: Unpack + Copy> NodeVisitor<u64> for BlockValueVisitor<'a, V> {
|
||||
for (i, b) in values.iter().enumerate() {
|
||||
// TODO: report indices of array entries based on the type size
|
||||
let mut array_errs = self.array_errs.lock().unwrap();
|
||||
array_errs.push(array::io_err(&path, *b).index_context(keys[i]));
|
||||
array_errs.push(array::io_err(path, *b).index_context(keys[i]));
|
||||
}
|
||||
}
|
||||
Ok(rblocks) => {
|
||||
@@ -85,7 +85,7 @@ impl<'a, V: Unpack + Copy> NodeVisitor<u64> for BlockValueVisitor<'a, V> {
|
||||
match rb {
|
||||
Err(_) => {
|
||||
let mut array_errs = self.array_errs.lock().unwrap();
|
||||
array_errs.push(array::io_err(&path, values[i]).index_context(keys[i]));
|
||||
array_errs.push(array::io_err(path, values[i]).index_context(keys[i]));
|
||||
}
|
||||
Ok(b) => {
|
||||
let mut path = path.to_vec();
|
||||
|
||||
@@ -561,7 +561,7 @@ pub fn unpack_node<V: Unpack>(
|
||||
if let Some(l) = last {
|
||||
if k <= l {
|
||||
return Err(node_err(
|
||||
&path,
|
||||
path,
|
||||
&format!("keys out of order: {} <= {}", k, l),
|
||||
));
|
||||
}
|
||||
@@ -582,7 +582,7 @@ pub fn unpack_node<V: Unpack>(
|
||||
values,
|
||||
})
|
||||
} else {
|
||||
let (_i, values) = convert_result(&path, count(le_u64, header.nr_entries as usize)(i))?;
|
||||
let (_i, values) = convert_result(path, count(le_u64, header.nr_entries as usize)(i))?;
|
||||
Ok(Node::Internal {
|
||||
header,
|
||||
keys,
|
||||
|
||||
@@ -132,10 +132,10 @@ impl<'a> LeafWalker<'a> {
|
||||
.keys_context(kr));
|
||||
}
|
||||
|
||||
let node = unpack_node::<V>(path, &b.get_data(), self.ignore_non_fatal, is_root)?;
|
||||
let node = unpack_node::<V>(path, b.get_data(), self.ignore_non_fatal, is_root)?;
|
||||
|
||||
if let Internal { keys, values, .. } = node {
|
||||
let krs = split_key_ranges(path, &kr, &keys)?;
|
||||
let krs = split_key_ranges(path, kr, &keys)?;
|
||||
if depth == 0 {
|
||||
// it is the lowest internal
|
||||
for i in 0..krs.len() {
|
||||
@@ -187,7 +187,7 @@ impl<'a> LeafWalker<'a> {
|
||||
));
|
||||
}
|
||||
|
||||
let node = unpack_node::<V>(path, &b.get_data(), self.ignore_non_fatal, is_root)?;
|
||||
let node = unpack_node::<V>(path, b.get_data(), self.ignore_non_fatal, is_root)?;
|
||||
|
||||
match node {
|
||||
Internal { values, .. } => {
|
||||
|
||||
@@ -195,11 +195,11 @@ impl BTreeWalker {
|
||||
.keys_context(kr));
|
||||
}
|
||||
|
||||
let node = unpack_node::<V>(path, &b.get_data(), self.ignore_non_fatal, is_root)?;
|
||||
let node = unpack_node::<V>(path, b.get_data(), self.ignore_non_fatal, is_root)?;
|
||||
|
||||
match node {
|
||||
Internal { keys, values, .. } => {
|
||||
let krs = split_key_ranges(path, &kr, &keys)?;
|
||||
let krs = split_key_ranges(path, kr, &keys)?;
|
||||
let errs = self.walk_nodes(path, visitor, &krs, &values);
|
||||
return self.build_aggregate(b.loc, errs);
|
||||
}
|
||||
@@ -208,7 +208,7 @@ impl BTreeWalker {
|
||||
keys,
|
||||
values,
|
||||
} => {
|
||||
if let Err(e) = visitor.visit(path, &kr, &header, &keys, &values) {
|
||||
if let Err(e) = visitor.visit(path, kr, &header, &keys, &values) {
|
||||
let e = BTreeError::Path(path.clone(), Box::new(e));
|
||||
self.set_fail(b.loc, e.clone());
|
||||
return Err(e);
|
||||
@@ -286,11 +286,11 @@ where
|
||||
.keys_context(kr));
|
||||
}
|
||||
|
||||
let node = unpack_node::<V>(path, &b.get_data(), w.ignore_non_fatal, is_root)?;
|
||||
let node = unpack_node::<V>(path, b.get_data(), w.ignore_non_fatal, is_root)?;
|
||||
|
||||
match node {
|
||||
Internal { keys, values, .. } => {
|
||||
let krs = split_key_ranges(path, &kr, &keys)?;
|
||||
let krs = split_key_ranges(path, kr, &keys)?;
|
||||
let errs = walk_nodes_threaded(w.clone(), path, pool, visitor, &krs, &values);
|
||||
return w.build_aggregate(b.loc, errs);
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ fn check_low_ref_counts(
|
||||
return Err(anyhow!("Unable to read bitmap block"));
|
||||
}
|
||||
Ok(b) => {
|
||||
if checksum::metadata_block_type(&b.get_data()) != checksum::BT::BITMAP {
|
||||
if checksum::metadata_block_type(b.get_data()) != checksum::BT::BITMAP {
|
||||
report.fatal(&format!(
|
||||
"Index entry points to block ({}) that isn't a bitmap",
|
||||
b.loc
|
||||
|
||||
Reference in New Issue
Block a user