mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-26 04:12:34 +00:00
updated cargo fmt
This commit is contained in:
@@ -29,7 +29,7 @@ impl BitMatrix {
|
||||
}
|
||||
|
||||
pub fn getTopLeftOnBitWithPosition(&self, left: &mut u32, top: &mut u32) -> bool {
|
||||
let Some(Point{x,y}) = self.getTopLeftOnBit() else {
|
||||
let Some(Point { x, y }) = self.getTopLeftOnBit() else {
|
||||
return false;
|
||||
};
|
||||
*left = x as u32;
|
||||
@@ -39,7 +39,7 @@ impl BitMatrix {
|
||||
}
|
||||
|
||||
pub fn getBottomRightOnBitWithPosition(&self, right: &mut u32, bottom: &mut u32) -> bool {
|
||||
let Some(Point{x,y}) = self.getBottomRightOnBit() else {
|
||||
let Some(Point { x, y }) = self.getBottomRightOnBit() else {
|
||||
return false;
|
||||
};
|
||||
*right = x as u32;
|
||||
|
||||
@@ -130,8 +130,12 @@ impl RegressionLineTrait for DMRegressionLine {
|
||||
}
|
||||
|
||||
fn isHighRes(&self) -> bool {
|
||||
let Some(mut min) = self.points.first().copied() else { return false };
|
||||
let Some(mut max) = self.points.first().copied() else { return false };
|
||||
let Some(mut min) = self.points.first().copied() else {
|
||||
return false;
|
||||
};
|
||||
let Some(mut max) = self.points.first().copied() else {
|
||||
return false;
|
||||
};
|
||||
for p in &self.points {
|
||||
min.x = f32::min(min.x, p.x);
|
||||
min.y = f32::min(min.y, p.y);
|
||||
|
||||
@@ -130,8 +130,12 @@ impl RegressionLineTrait for RegressionLine {
|
||||
}
|
||||
|
||||
fn isHighRes(&self) -> bool {
|
||||
let Some(mut min) = self.points.first().copied() else { return false };
|
||||
let Some(mut max) = self.points.first().copied() else { return false };
|
||||
let Some(mut min) = self.points.first().copied() else {
|
||||
return false;
|
||||
};
|
||||
let Some(mut max) = self.points.first().copied() else {
|
||||
return false;
|
||||
};
|
||||
for p in &self.points {
|
||||
min.x = f32::min(min.x, p.x);
|
||||
min.y = f32::min(min.y, p.y);
|
||||
|
||||
@@ -19,8 +19,12 @@ pub struct OtsuLevelBinarizer<LS: LuminanceSource> {
|
||||
impl<LS: LuminanceSource> OtsuLevelBinarizer<LS> {
|
||||
fn generate_threshold_matrix<LS2: LuminanceSource>(source: &LS2) -> Result<BitMatrix> {
|
||||
let image_buffer = {
|
||||
let Some(buff) : Option<ImageBuffer<Luma<u8>,Vec<u8>>> = ImageBuffer::from_vec(source.get_width() as u32, source.get_height() as u32, source.get_matrix()) else {
|
||||
return Err(Exceptions::ILLEGAL_ARGUMENT)
|
||||
let Some(buff): Option<ImageBuffer<Luma<u8>, Vec<u8>>> = ImageBuffer::from_vec(
|
||||
source.get_width() as u32,
|
||||
source.get_height() as u32,
|
||||
source.get_matrix(),
|
||||
) else {
|
||||
return Err(Exceptions::ILLEGAL_ARGUMENT);
|
||||
};
|
||||
buff
|
||||
};
|
||||
|
||||
@@ -78,7 +78,7 @@ impl ReedSolomonDecoder {
|
||||
return Ok(0);
|
||||
}
|
||||
let Ok(syndrome) = GenericGFPoly::new(self.field, &syndromeCoefficients) else {
|
||||
return Err(Exceptions::REED_SOLOMON);
|
||||
return Err(Exceptions::REED_SOLOMON);
|
||||
};
|
||||
let sigmaOmega = self.runEuclideanAlgorithm(
|
||||
&GenericGF::buildMonomial(self.field, twoS as usize, 1),
|
||||
|
||||
Reference in New Issue
Block a user