From 844ffc3b81ad16743897c260f6b5e112e3cab566 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vuka=C5=A1in=20Stepanovi=C4=87?= Date: Thu, 16 Feb 2023 08:40:57 +0000 Subject: [PATCH] cargo fmt --- src/aztec/DetectorTest.rs | 7 +++-- src/aztec/detector.rs | 31 ++++++++----------- .../detector/white_rectangle_detector.rs | 16 ++-------- .../zxing_cpp_detector/bitmatrix_cursor.rs | 8 ++--- .../zxing_cpp_detector/cpp_new_detector.rs | 13 ++------ .../zxing_cpp_detector/dm_regression_line.rs | 3 +- .../zxing_cpp_detector/edge_tracer.rs | 25 ++++----------- .../detector/zxing_cpp_detector/quad.rs | 7 +---- .../zxing_cpp_detector/regression_line.rs | 10 +++--- src/multi/by_quadrant_reader.rs | 19 +++--------- src/multi/generic_multiple_barcode_reader.rs | 4 +-- .../detector/multi_finder_pattern_finder.rs | 3 +- src/oned/coda_bar_reader.rs | 2 +- src/oned/code_128_reader.rs | 2 +- src/oned/code_39_reader.rs | 2 +- src/oned/code_93_reader.rs | 2 +- src/oned/itf_reader.rs | 2 +- src/oned/one_d_reader.rs | 16 ++++------ src/oned/rss/rss_14_reader.rs | 4 +-- src/oned/upc_ean_extension_2_support.rs | 4 +-- src/oned/upc_ean_extension_5_support.rs | 4 +-- src/oned/upc_ean_reader.rs | 7 ++--- src/pdf417/decoder/bounding_box.rs | 3 +- src/pdf417/detector/pdf_417_detector.rs | 26 +++------------- .../detector/pdf_417_detector_result.rs | 6 +--- src/pdf417/pdf_417_reader.rs | 4 +-- src/qrcode/qr_code_reader.rs | 4 +-- src/rxing_result.rs | 2 +- 28 files changed, 80 insertions(+), 156 deletions(-) diff --git a/src/aztec/DetectorTest.rs b/src/aztec/DetectorTest.rs index d88f1e9..0c054d8 100644 --- a/src/aztec/DetectorTest.rs +++ b/src/aztec/DetectorTest.rs @@ -39,7 +39,7 @@ use rand::Rng; use crate::{aztec::decoder, common::BitMatrix, exceptions::Exceptions}; use super::{ - detector::{self, Detector, AztecPoint}, + detector::{self, AztecPoint, Detector}, encoder::{self, AztecCode}, }; @@ -271,7 +271,10 @@ fn get_orientation_points(code: &AztecCode) -> Vec { let mut ySign: i32 = -1; while ySign <= 1 { // for (int ySign = -1; ySign <= 1; ySign += 2) { - result.push(AztecPoint::new(center + xSign * offset, center + ySign * offset)); + result.push(AztecPoint::new( + center + xSign * offset, + center + ySign * offset, + )); result.push(AztecPoint::new( center + xSign * (offset - 1), center + ySign * offset, diff --git a/src/aztec/detector.rs b/src/aztec/detector.rs index 2ad79ef..bd508de 100644 --- a/src/aztec/detector.rs +++ b/src/aztec/detector.rs @@ -325,14 +325,10 @@ impl<'a> Detector<'_> { // Expand the square by .5 pixel in each direction so that we're on the border // between the white square and the black square - let pinax = - Point::new(pina.get_x() as f32 + 0.5f32, pina.get_y() as f32 - 0.5f32); - let pinbx = - Point::new(pinb.get_x() as f32 + 0.5f32, pinb.get_y() as f32 + 0.5f32); - let pincx = - Point::new(pinc.get_x() as f32 - 0.5f32, pinc.get_y() as f32 + 0.5f32); - let pindx = - Point::new(pind.get_x() as f32 - 0.5f32, pind.get_y() as f32 - 0.5f32); + let pinax = Point::new(pina.get_x() as f32 + 0.5f32, pina.get_y() as f32 - 0.5f32); + let pinbx = Point::new(pinb.get_x() as f32 + 0.5f32, pinb.get_y() as f32 + 0.5f32); + let pincx = Point::new(pinc.get_x() as f32 - 0.5f32, pinc.get_y() as f32 + 0.5f32); + let pindx = Point::new(pind.get_x() as f32 - 0.5f32, pind.get_y() as f32 - 0.5f32); // Expand the square so that its corners are the centers of the points // just outside the bull's eye. @@ -475,10 +471,7 @@ impl<'a> Detector<'_> { * @param bullsEyeCorners the array of bull's eye corners * @return the array of aztec code corners */ - fn get_matrix_corner_points( - &self, - bulls_eye_corners: &[Point], - ) -> [Point; 4] { + fn get_matrix_corner_points(&self, bulls_eye_corners: &[Point]) -> [Point; 4] { Self::expand_square( bulls_eye_corners, 2 * self.nb_center_layers, @@ -561,7 +554,13 @@ impl<'a> Detector<'_> { * @return true if the border of the rectangle passed in parameter is compound of white points only * or black points only */ - fn is_white_or_black_rectangle(&self, p1: &AztecPoint, p2: &AztecPoint, p3: &AztecPoint, p4: &AztecPoint) -> bool { + fn is_white_or_black_rectangle( + &self, + p1: &AztecPoint, + p2: &AztecPoint, + p3: &AztecPoint, + p4: &AztecPoint, + ) -> bool { let corr = 3; let p1 = AztecPoint::new( @@ -690,11 +689,7 @@ impl<'a> Detector<'_> { * @param newSide the new length of the size of the square in the target bit matrix * @return the corners of the expanded square */ - fn expand_square( - corner_points: &[Point], - old_side: u32, - new_side: u32, - ) -> [Point; 4] { + fn expand_square(corner_points: &[Point], old_side: u32, new_side: u32) -> [Point; 4] { let ratio = new_side as f32 / (2.0f32 * old_side as f32); let d = corner_points[0] - corner_points[2]; diff --git a/src/common/detector/white_rectangle_detector.rs b/src/common/detector/white_rectangle_detector.rs index 5033874..c85e9fa 100644 --- a/src/common/detector/white_rectangle_detector.rs +++ b/src/common/detector/white_rectangle_detector.rs @@ -289,13 +289,7 @@ impl<'a> WhiteRectangleDetector<'_> { } } - fn get_black_point_on_segment( - &self, - a_x: f32, - a_y: f32, - b_x: f32, - b_y: f32, - ) -> Option { + fn get_black_point_on_segment(&self, a_x: f32, a_y: f32, b_x: f32, b_y: f32) -> Option { let dist = MathUtils::round(MathUtils::distance(a_x, a_y, b_x, b_y)); let x_step: f32 = (b_x - a_x) / dist as f32; let y_step: f32 = (b_y - a_y) / dist as f32; @@ -323,13 +317,7 @@ impl<'a> WhiteRectangleDetector<'_> { * point and the last, the bottommost. The second point will be * leftmost and the third, the rightmost */ - fn center_edges( - &self, - y: Point, - z: Point, - x: Point, - t: Point, - ) -> [Point; 4] { + fn center_edges(&self, y: Point, z: Point, x: Point, t: Point) -> [Point; 4] { // // t t // z x diff --git a/src/datamatrix/detector/zxing_cpp_detector/bitmatrix_cursor.rs b/src/datamatrix/detector/zxing_cpp_detector/bitmatrix_cursor.rs index 4bd9505..420eb2f 100644 --- a/src/datamatrix/detector/zxing_cpp_detector/bitmatrix_cursor.rs +++ b/src/datamatrix/detector/zxing_cpp_detector/bitmatrix_cursor.rs @@ -17,9 +17,9 @@ pub trait BitMatrixCursor { // BitMatrixCursor(const BitMatrix& image, POINT p, POINT d) : img(&image), p(p) { setDirection(d); } fn testAt(&self, p: Point) -> Value; //const - // { - // return img->isIn(p) ? Value{img->get(p)} : Value{}; - // } + // { + // return img->isIn(p) ? Value{img->get(p)} : Value{}; + // } fn blackAt(&self, pos: Point) -> bool { self.testAt(pos).isBlack() @@ -69,7 +69,7 @@ pub trait BitMatrixCursor { } fn setDirection(&mut self, dir: Point); // { d = bresenhamDirection(dir); } - // fn setDirection(&self, dir: Point);// { d = dir; } + // fn setDirection(&self, dir: Point);// { d = dir; } fn step(&mut self, s: Option) -> bool; // DEF to 1 // { diff --git a/src/datamatrix/detector/zxing_cpp_detector/cpp_new_detector.rs b/src/datamatrix/detector/zxing_cpp_detector/cpp_new_detector.rs index 83d449b..5817b60 100644 --- a/src/datamatrix/detector/zxing_cpp_detector/cpp_new_detector.rs +++ b/src/datamatrix/detector/zxing_cpp_detector/cpp_new_detector.rs @@ -197,14 +197,8 @@ fn Scan( CHECK!((10..=144).contains(&dimT) && (8..=144).contains(&dimR)); - let movedTowardsBy = |a: Point, - b1: Point, - b2: Point, - d: f32| - -> Point { - a + d * Point::normalized( - Point::normalized(b1 - a) + Point::normalized(b2 - a), - ) + let movedTowardsBy = |a: Point, b1: Point, b2: Point, d: f32| -> Point { + a + d * Point::normalized(Point::normalized(b1 - a) + Point::normalized(b2 - a)) }; // shrink shape by half a pixel to go from center of white pixel outside of code to the edge between white and black @@ -302,8 +296,7 @@ pub fn detect( x: (image.getWidth() / 2) as f32, y: (image.getHeight() / 2) as f32, }; //PointF(image.width() / 2, image.height() / 2); - let startPos = - Point::centered(center - center * dir + MIN_SYMBOL_SIZE as i32 / 2 * dir); + let startPos = Point::centered(center - center * dir + MIN_SYMBOL_SIZE as i32 / 2 * dir); if let Some(history) = &mut history { history.borrow_mut().clear(0); diff --git a/src/datamatrix/detector/zxing_cpp_detector/dm_regression_line.rs b/src/datamatrix/detector/zxing_cpp_detector/dm_regression_line.rs index 0edf347..2af2996 100644 --- a/src/datamatrix/detector/zxing_cpp_detector/dm_regression_line.rs +++ b/src/datamatrix/detector/zxing_cpp_detector/dm_regression_line.rs @@ -37,8 +37,7 @@ impl RegressionLine for DMRegressionLine { fn length(&self) -> u32 { if self.points.len() >= 2 { - Point::distance(*self.points.first().unwrap(), *self.points.last().unwrap()) - as u32 + Point::distance(*self.points.first().unwrap(), *self.points.last().unwrap()) as u32 } else { 0 } diff --git a/src/datamatrix/detector/zxing_cpp_detector/edge_tracer.rs b/src/datamatrix/detector/zxing_cpp_detector/edge_tracer.rs index 1787985..aae5139 100644 --- a/src/datamatrix/detector/zxing_cpp_detector/edge_tracer.rs +++ b/src/datamatrix/detector/zxing_cpp_detector/edge_tracer.rs @@ -252,21 +252,14 @@ impl<'a> EdgeTracer<'_> { } // make sure d stays in the same quadrant to prevent an infinite loop if (self.d.x).abs() == (self.d.y).abs() { - self.d = Point::mainDirection(old_d) - + 0.99 * (self.d - Point::mainDirection(old_d)); - } else if Point::mainDirection(self.d) != Point::mainDirection(old_d) - { - self.d = Point::mainDirection(old_d) - + 0.99 * Point::mainDirection(self.d); + self.d = Point::mainDirection(old_d) + 0.99 * (self.d - Point::mainDirection(old_d)); + } else if Point::mainDirection(self.d) != Point::mainDirection(old_d) { + self.d = Point::mainDirection(old_d) + 0.99 * Point::mainDirection(self.d); } true } - pub fn traceLine( - &mut self, - dEdge: Point, - line: &mut T, - ) -> Result { + pub fn traceLine(&mut self, dEdge: Point, line: &mut T) -> Result { line.setDirectionInward(dEdge); loop { // log(self.p); @@ -341,9 +334,7 @@ impl<'a> EdgeTracer<'_> { // In case the 'go outward' step in traceStep lead us astray, we might end up with a line // that is almost perpendicular to d. Then the back-projection below can result in an // endless loop. Break if the angle between d and line is greater than 45 deg. - if (Point::dot(Point::normalized(self.d), line.normal())) - .abs() - > 0.7 + if (Point::dot(Point::normalized(self.d), line.normal())).abs() > 0.7 // thresh is approx. sin(45 deg) { return Ok(false); @@ -439,11 +430,7 @@ impl<'a> EdgeTracer<'_> { } //while (true); } - pub fn traceCorner( - &mut self, - dir: &mut Point, - corner: &mut Point, - ) -> Result { + pub fn traceCorner(&mut self, dir: &mut Point, corner: &mut Point) -> Result { self.step(None); // log(p); *corner = self.p; diff --git a/src/datamatrix/detector/zxing_cpp_detector/quad.rs b/src/datamatrix/detector/zxing_cpp_detector/quad.rs index 26f75f4..7e5578e 100644 --- a/src/datamatrix/detector/zxing_cpp_detector/quad.rs +++ b/src/datamatrix/detector/zxing_cpp_detector/quad.rs @@ -17,12 +17,7 @@ impl Quadrilateral { // Self([tl, tr,br, bl ]) // } - pub fn with_points( - tl: Point, - tr: Point, - br: Point, - bl: Point, - ) -> Self { + pub fn with_points(tl: Point, tr: Point, br: Point, bl: Point) -> Self { Self([tl, tr, br, bl]) } diff --git a/src/datamatrix/detector/zxing_cpp_detector/regression_line.rs b/src/datamatrix/detector/zxing_cpp_detector/regression_line.rs index a788d6d..be46cf1 100644 --- a/src/datamatrix/detector/zxing_cpp_detector/regression_line.rs +++ b/src/datamatrix/detector/zxing_cpp_detector/regression_line.rs @@ -78,11 +78,11 @@ pub trait RegressionLine { // } fn add(&mut self, p: Point) -> Result<()>; //{ - // assert(_directionInward != PointF()); - // _points.push_back(p); - // if (_points.size() == 1) - // c = dot(normal(), p); - // } + // assert(_directionInward != PointF()); + // _points.push_back(p); + // if (_points.size() == 1) + // c = dot(normal(), p); + // } fn pop_back(&mut self); // { _points.pop_back(); } diff --git a/src/multi/by_quadrant_reader.rs b/src/multi/by_quadrant_reader.rs index 4d199af..f43dc8e 100644 --- a/src/multi/by_quadrant_reader.rs +++ b/src/multi/by_quadrant_reader.rs @@ -17,7 +17,7 @@ use std::collections::HashMap; use crate::common::Result; -use crate::{Exceptions, RXingResult, Point, Reader, ResultPoint}; +use crate::{Exceptions, Point, RXingResult, Reader, ResultPoint}; /** * This class attempts to decode a barcode from an image, not by scanning the whole image, @@ -88,11 +88,8 @@ impl Reader for ByQuadrantReader { // This is a match because only NotFoundExceptions should be ignored match result { Ok(res) => { - let points = Self::makeAbsolute( - res.getPoints(), - halfWidth as f32, - halfHeight as f32, - ); + let points = + Self::makeAbsolute(res.getPoints(), halfWidth as f32, halfHeight as f32); return Ok(RXingResult::new_from_existing_result(res, points)); } Err(Exceptions::NotFoundException(_)) => {} @@ -122,11 +119,7 @@ impl ByQuadrantReader { Self(delegate) } - fn makeAbsolute( - points: &[Point], - leftOffset: f32, - topOffset: f32, - ) -> Vec { + fn makeAbsolute(points: &[Point], leftOffset: f32, topOffset: f32) -> Vec { // let mut result = Vec::new(); // if !points.is_empty() { @@ -140,9 +133,7 @@ impl ByQuadrantReader { // result points .iter() - .map(|relative| { - Point::new(relative.getX() + leftOffset, relative.getY() + topOffset) - }) + .map(|relative| Point::new(relative.getX() + leftOffset, relative.getY() + topOffset)) .collect() } } diff --git a/src/multi/generic_multiple_barcode_reader.rs b/src/multi/generic_multiple_barcode_reader.rs index acdbd89..26c3d59 100644 --- a/src/multi/generic_multiple_barcode_reader.rs +++ b/src/multi/generic_multiple_barcode_reader.rs @@ -17,8 +17,8 @@ use std::collections::HashMap; use crate::{ - common::Result, BinaryBitmap, DecodingHintDictionary, Exceptions, RXingResult, - Point, Reader, ResultPoint, + common::Result, BinaryBitmap, DecodingHintDictionary, Exceptions, Point, RXingResult, Reader, + ResultPoint, }; use super::MultipleBarcodeReader; diff --git a/src/multi/qrcode/detector/multi_finder_pattern_finder.rs b/src/multi/qrcode/detector/multi_finder_pattern_finder.rs index 5d83532..43f88f1 100644 --- a/src/multi/qrcode/detector/multi_finder_pattern_finder.rs +++ b/src/multi/qrcode/detector/multi_finder_pattern_finder.rs @@ -19,8 +19,7 @@ use std::cmp::Ordering; use crate::{ common::{BitMatrix, Result}, qrcode::detector::{FinderPattern, FinderPatternFinder, FinderPatternInfo}, - result_point_utils, DecodeHintType, DecodingHintDictionary, Exceptions, - PointCallback, + result_point_utils, DecodeHintType, DecodingHintDictionary, Exceptions, PointCallback, }; // max. legal count of modules per QR code edge (177) diff --git a/src/oned/coda_bar_reader.rs b/src/oned/coda_bar_reader.rs index 5a7ed0d..1acaf8f 100644 --- a/src/oned/coda_bar_reader.rs +++ b/src/oned/coda_bar_reader.rs @@ -17,10 +17,10 @@ use rxing_one_d_proc_derive::OneDReader; use crate::common::{BitArray, Result}; -use crate::{BarcodeFormat, Point}; use crate::DecodeHintValue; use crate::Exceptions; use crate::RXingResult; +use crate::{BarcodeFormat, Point}; use super::OneDReader; diff --git a/src/oned/code_128_reader.rs b/src/oned/code_128_reader.rs index f872399..a282de4 100644 --- a/src/oned/code_128_reader.rs +++ b/src/oned/code_128_reader.rs @@ -18,7 +18,7 @@ use rxing_one_d_proc_derive::OneDReader; use crate::{ common::{BitArray, Result}, - BarcodeFormat, Exceptions, RXingResult, Point, + BarcodeFormat, Exceptions, Point, RXingResult, }; use super::{one_d_reader, OneDReader}; diff --git a/src/oned/code_39_reader.rs b/src/oned/code_39_reader.rs index fa32fce..f5d5a73 100644 --- a/src/oned/code_39_reader.rs +++ b/src/oned/code_39_reader.rs @@ -17,7 +17,7 @@ use rxing_one_d_proc_derive::OneDReader; use crate::common::{BitArray, Result}; -use crate::{BarcodeFormat, Exceptions, RXingResult, Point}; +use crate::{BarcodeFormat, Exceptions, Point, RXingResult}; use super::{one_d_reader, OneDReader}; diff --git a/src/oned/code_93_reader.rs b/src/oned/code_93_reader.rs index fa22630..a0d9178 100644 --- a/src/oned/code_93_reader.rs +++ b/src/oned/code_93_reader.rs @@ -18,7 +18,7 @@ use rxing_one_d_proc_derive::OneDReader; use crate::{ common::{BitArray, Result}, - BarcodeFormat, Exceptions, RXingResult, Point, + BarcodeFormat, Exceptions, Point, RXingResult, }; use super::{one_d_reader, OneDReader}; diff --git a/src/oned/itf_reader.rs b/src/oned/itf_reader.rs index 8e616b2..491501c 100644 --- a/src/oned/itf_reader.rs +++ b/src/oned/itf_reader.rs @@ -18,7 +18,7 @@ use rxing_one_d_proc_derive::OneDReader; use crate::{ common::{BitArray, Result}, - BarcodeFormat, DecodeHintValue, Exceptions, RXingResult, Point, + BarcodeFormat, DecodeHintValue, Exceptions, Point, RXingResult, }; use super::{one_d_reader, OneDReader}; diff --git a/src/oned/one_d_reader.rs b/src/oned/one_d_reader.rs index 9dab307..641da7a 100644 --- a/src/oned/one_d_reader.rs +++ b/src/oned/one_d_reader.rs @@ -16,8 +16,8 @@ use crate::{ common::{BitArray, Result}, - BinaryBitmap, DecodeHintType, DecodeHintValue, DecodingHintDictionary, Exceptions, RXingResult, - RXingResultMetadataType, RXingResultMetadataValue, Point, Reader, ResultPoint, + BinaryBitmap, DecodeHintType, DecodeHintValue, DecodingHintDictionary, Exceptions, Point, + RXingResult, RXingResultMetadataType, RXingResultMetadataValue, Reader, ResultPoint, }; /** @@ -117,14 +117,10 @@ pub trait OneDReader: Reader { // And remember to flip the result points horizontally. let points = result.getPointsMut(); if !points.is_empty() && points.len() >= 2 { - points[0] = Point::new( - width as f32 - points[0].getX() - 1.0, - points[0].getY(), - ); - points[1] = Point::new( - width as f32 - points[1].getX() - 1.0, - points[1].getY(), - ); + points[0] = + Point::new(width as f32 - points[0].getX() - 1.0, points[0].getY()); + points[1] = + Point::new(width as f32 - points[1].getX() - 1.0, points[1].getY()); } } return Ok(result); diff --git a/src/oned/rss/rss_14_reader.rs b/src/oned/rss/rss_14_reader.rs index f5048ce..3e6fe5c 100644 --- a/src/oned/rss/rss_14_reader.rs +++ b/src/oned/rss/rss_14_reader.rs @@ -19,8 +19,8 @@ use std::collections::HashMap; use crate::{ common::{BitArray, Result}, oned::{one_d_reader, OneDReader}, - BarcodeFormat, DecodeHintType, DecodeHintValue, DecodingHintDictionary, Exceptions, - RXingResult, RXingResultMetadataType, RXingResultMetadataValue, Point, Reader, + BarcodeFormat, DecodeHintType, DecodeHintValue, DecodingHintDictionary, Exceptions, Point, + RXingResult, RXingResultMetadataType, RXingResultMetadataValue, Reader, }; use super::{ diff --git a/src/oned/upc_ean_extension_2_support.rs b/src/oned/upc_ean_extension_2_support.rs index f3ed755..604d4a6 100644 --- a/src/oned/upc_ean_extension_2_support.rs +++ b/src/oned/upc_ean_extension_2_support.rs @@ -18,8 +18,8 @@ use std::collections::HashMap; use crate::{ common::{BitArray, Result}, - BarcodeFormat, Exceptions, RXingResult, RXingResultMetadataType, RXingResultMetadataValue, - Point, + BarcodeFormat, Exceptions, Point, RXingResult, RXingResultMetadataType, + RXingResultMetadataValue, }; use super::{upc_ean_reader, UPCEANReader, STAND_IN}; diff --git a/src/oned/upc_ean_extension_5_support.rs b/src/oned/upc_ean_extension_5_support.rs index 16b732c..3e2bc4b 100644 --- a/src/oned/upc_ean_extension_5_support.rs +++ b/src/oned/upc_ean_extension_5_support.rs @@ -18,8 +18,8 @@ use std::collections::HashMap; use crate::{ common::{BitArray, Result}, - BarcodeFormat, Exceptions, RXingResult, RXingResultMetadataType, RXingResultMetadataValue, - Point, + BarcodeFormat, Exceptions, Point, RXingResult, RXingResultMetadataType, + RXingResultMetadataValue, }; use super::{upc_ean_reader, UPCEANReader, STAND_IN}; diff --git a/src/oned/upc_ean_reader.rs b/src/oned/upc_ean_reader.rs index 1a641b4..3c39bfe 100644 --- a/src/oned/upc_ean_reader.rs +++ b/src/oned/upc_ean_reader.rs @@ -16,8 +16,8 @@ use crate::{ common::{BitArray, Result}, - BarcodeFormat, DecodeHintType, DecodeHintValue, Exceptions, RXingResult, - RXingResultMetadataType, RXingResultMetadataValue, Point, Reader, + BarcodeFormat, DecodeHintType, DecodeHintValue, Exceptions, Point, RXingResult, + RXingResultMetadataType, RXingResultMetadataValue, Reader, }; use super::{one_d_reader, EANManufacturerOrgSupport, OneDReader, UPCEANExtensionSupport}; @@ -223,8 +223,7 @@ pub trait UPCEANReader: OneDReader { ), ); decodeRXingResult.putAllMetadata(extensionRXingResult.getRXingResultMetadata().clone()); - decodeRXingResult - .addPoints(&mut extensionRXingResult.getPoints().clone()); + decodeRXingResult.addPoints(&mut extensionRXingResult.getPoints().clone()); extensionLength = extensionRXingResult.getText().chars().count(); Ok(()) }; diff --git a/src/pdf417/decoder/bounding_box.rs b/src/pdf417/decoder/bounding_box.rs index 8eef760..f30e340 100644 --- a/src/pdf417/decoder/bounding_box.rs +++ b/src/pdf417/decoder/bounding_box.rs @@ -64,8 +64,7 @@ impl BoundingBox { newTopLeft = topLeft.ok_or(Exceptions::IllegalStateException(None))?; newBottomLeft = bottomLeft.ok_or(Exceptions::IllegalStateException(None))?; newTopRight = Point::new(image.getWidth() as f32 - 1.0, newTopLeft.getY()); - newBottomRight = - Point::new(image.getWidth() as f32 - 1.0, newBottomLeft.getY()); + newBottomRight = Point::new(image.getWidth() as f32 - 1.0, newBottomLeft.getY()); } else { newTopLeft = topLeft.ok_or(Exceptions::IllegalStateException(None))?; newTopRight = topRight.ok_or(Exceptions::IllegalStateException(None))?; diff --git a/src/pdf417/detector/pdf_417_detector.rs b/src/pdf417/detector/pdf_417_detector.rs index 501fc15..9a62ae0 100644 --- a/src/pdf417/detector/pdf_417_detector.rs +++ b/src/pdf417/detector/pdf_417_detector.rs @@ -179,11 +179,7 @@ pub fn detect(multiple: bool, bitMatrix: &BitMatrix) -> Option Option<[Option; 8]> { +fn findVertices(matrix: &BitMatrix, startRow: u32, startColumn: u32) -> Option<[Option; 8]> { let height = matrix.getHeight(); let width = matrix.getWidth(); let mut startRow = startRow; @@ -249,14 +245,8 @@ fn findRowsWithPattern( break; } } - result[0] = Some(Point::new( - loc_store.as_ref()?[0] as f32, - startRow as f32, - )); - result[1] = Some(Point::new( - loc_store.as_ref()?[1] as f32, - startRow as f32, - )); + result[0] = Some(Point::new(loc_store.as_ref()?[0] as f32, startRow as f32)); + result[1] = Some(Point::new(loc_store.as_ref()?[1] as f32, startRow as f32)); found = true; break; } @@ -304,14 +294,8 @@ fn findRowsWithPattern( stopRow += 1; } stopRow -= skippedRowCount + 1; - result[2] = Some(Point::new( - previousRowLoc[0] as f32, - stopRow as f32, - )); - result[3] = Some(Point::new( - previousRowLoc[1] as f32, - stopRow as f32, - )); + result[2] = Some(Point::new(previousRowLoc[0] as f32, stopRow as f32)); + result[3] = Some(Point::new(previousRowLoc[1] as f32, stopRow as f32)); } if stopRow - startRow < BARCODE_MIN_HEIGHT { result.fill(None); diff --git a/src/pdf417/detector/pdf_417_detector_result.rs b/src/pdf417/detector/pdf_417_detector_result.rs index 2d4ee2c..0c9aea1 100644 --- a/src/pdf417/detector/pdf_417_detector_result.rs +++ b/src/pdf417/detector/pdf_417_detector_result.rs @@ -26,11 +26,7 @@ pub struct PDF417DetectorRXingResult { } impl PDF417DetectorRXingResult { - pub fn with_rotation( - bits: BitMatrix, - points: Vec<[Option; 8]>, - rotation: u32, - ) -> Self { + pub fn with_rotation(bits: BitMatrix, points: Vec<[Option; 8]>, rotation: u32) -> Self { Self { bits, points, diff --git a/src/pdf417/pdf_417_reader.rs b/src/pdf417/pdf_417_reader.rs index 8ad3d91..9caa419 100644 --- a/src/pdf417/pdf_417_reader.rs +++ b/src/pdf417/pdf_417_reader.rs @@ -18,8 +18,8 @@ use std::collections::HashMap; use crate::{ common::Result, multi::MultipleBarcodeReader, BarcodeFormat, BinaryBitmap, - DecodingHintDictionary, Exceptions, RXingResult, RXingResultMetadataType, - RXingResultMetadataValue, Point, Reader, ResultPoint, + DecodingHintDictionary, Exceptions, Point, RXingResult, RXingResultMetadataType, + RXingResultMetadataValue, Reader, ResultPoint, }; use super::{ diff --git a/src/qrcode/qr_code_reader.rs b/src/qrcode/qr_code_reader.rs index f213d62..767fbdc 100644 --- a/src/qrcode/qr_code_reader.rs +++ b/src/qrcode/qr_code_reader.rs @@ -18,8 +18,8 @@ use std::collections::HashMap; use crate::{ common::{BitMatrix, DecoderRXingResult, DetectorRXingResult, Result}, - BarcodeFormat, DecodeHintType, DecodeHintValue, Exceptions, RXingResult, - RXingResultMetadataType, RXingResultMetadataValue, Point, Reader, + BarcodeFormat, DecodeHintType, DecodeHintValue, Exceptions, Point, RXingResult, + RXingResultMetadataType, RXingResultMetadataValue, Reader, }; use super::{ diff --git a/src/rxing_result.rs b/src/rxing_result.rs index e0c20a3..90c544d 100644 --- a/src/rxing_result.rs +++ b/src/rxing_result.rs @@ -16,7 +16,7 @@ use std::{collections::HashMap, fmt}; -use crate::{BarcodeFormat, RXingResultMetadataType, RXingResultMetadataValue, Point}; +use crate::{BarcodeFormat, Point, RXingResultMetadataType, RXingResultMetadataValue}; #[cfg(feature = "serde")] use serde::{Deserialize, Serialize};