mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-26 04:12:34 +00:00
cargo fmt
This commit is contained in:
@@ -57,9 +57,9 @@ impl DataBlock {
|
||||
|
||||
// First count the total number of data blocks
|
||||
let ecBlockArray = ecBlocks.getECBlocks();
|
||||
let totalBlocks = ecBlockArray.iter().fold(0, |acc, ecBlock| {
|
||||
acc + ecBlock.getCount() as usize
|
||||
});
|
||||
let totalBlocks = ecBlockArray
|
||||
.iter()
|
||||
.fold(0, |acc, ecBlock| acc + ecBlock.getCount() as usize);
|
||||
|
||||
// Now establish DataBlocks of the appropriate size and number of data codewords
|
||||
let mut result = Vec::with_capacity(totalBlocks);
|
||||
|
||||
@@ -158,10 +158,10 @@ fn decode_bitmatrix_parser_with_hints(
|
||||
let dataBlocks = DataBlock::getDataBlocks(&codewords, version, ecLevel)?;
|
||||
|
||||
// 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
|
||||
});
|
||||
|
||||
|
||||
let mut resultBytes = vec![0u8; totalBytes];
|
||||
let mut resultOffset = 0;
|
||||
|
||||
|
||||
@@ -686,10 +686,10 @@ impl FinderPatternFinder {
|
||||
// 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.
|
||||
let average = totalModuleSize / max as f32;
|
||||
let totalDeviation = self.possibleCenters.iter().fold(0.0, |acc, pattern| {
|
||||
acc + (pattern.getEstimatedModuleSize() - average).abs()
|
||||
let totalDeviation = self.possibleCenters.iter().fold(0.0, |acc, pattern| {
|
||||
acc + (pattern.getEstimatedModuleSize() - average).abs()
|
||||
});
|
||||
|
||||
|
||||
totalDeviation <= 0.05 * totalModuleSize
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user