cargo fmt

This commit is contained in:
Henry Schimke
2023-01-10 14:34:33 -06:00
parent 9f7a41f81c
commit 4f1bceee66
3 changed files with 8 additions and 8 deletions

View File

@@ -57,9 +57,9 @@ impl DataBlock {
// First count the total number of data blocks // First count the total number of data blocks
let ecBlockArray = ecBlocks.getECBlocks(); let ecBlockArray = ecBlocks.getECBlocks();
let totalBlocks = ecBlockArray.iter().fold(0, |acc, ecBlock| { let totalBlocks = ecBlockArray
acc + ecBlock.getCount() as usize .iter()
}); .fold(0, |acc, ecBlock| acc + ecBlock.getCount() as usize);
// Now establish DataBlocks of the appropriate size and number of data codewords // Now establish DataBlocks of the appropriate size and number of data codewords
let mut result = Vec::with_capacity(totalBlocks); let mut result = Vec::with_capacity(totalBlocks);

View File

@@ -158,7 +158,7 @@ fn decode_bitmatrix_parser_with_hints(
let dataBlocks = DataBlock::getDataBlocks(&codewords, version, ecLevel)?; let dataBlocks = DataBlock::getDataBlocks(&codewords, version, ecLevel)?;
// Count total number of data bytes // Count total number of data bytes
let totalBytes = dataBlocks.iter().fold(0, |acc,dataBlock| { let totalBytes = dataBlocks.iter().fold(0, |acc, dataBlock| {
acc + dataBlock.getNumDataCodewords() as usize acc + dataBlock.getNumDataCodewords() as usize
}); });

View File

@@ -686,8 +686,8 @@ impl FinderPatternFinder {
// vary too much. We arbitrarily say that when the total deviation from average exceeds // vary too much. We arbitrarily say that when the total deviation from average exceeds
// 5% of the total module size estimates, it's too much. // 5% of the total module size estimates, it's too much.
let average = totalModuleSize / max as f32; let average = totalModuleSize / max as f32;
let totalDeviation = self.possibleCenters.iter().fold(0.0, |acc, pattern| { let totalDeviation = self.possibleCenters.iter().fold(0.0, |acc, pattern| {
acc + (pattern.getEstimatedModuleSize() - average).abs() acc + (pattern.getEstimatedModuleSize() - average).abs()
}); });
totalDeviation <= 0.05 * totalModuleSize totalDeviation <= 0.05 * totalModuleSize