cargo clippy --fix

This commit is contained in:
Henry Schimke
2023-01-10 14:36:11 -06:00
parent 4f1bceee66
commit 59183a5383
5 changed files with 12 additions and 12 deletions

View File

@@ -113,7 +113,7 @@ X X X X X X X X X X X X X X
" ", " ",
) )
.expect("Bitmatrix should init"); .expect("Bitmatrix should init");
let r = AztecDetectorRXingResult::new(matrix, NO_POINTS.clone(), false, 30, 2); let r = AztecDetectorRXingResult::new(matrix, NO_POINTS, false, 30, 2);
let result = decoder::decode(&r).expect("decoder should init"); let result = decoder::decode(&r).expect("decoder should init");
assert_eq!("88888TTTTTTTTTTTTTTTTTTTTTTTTTTTTTT", result.getText()); assert_eq!("88888TTTTTTTTTTTTTTTTTTTTTTTTTTTTTT", result.getText());
assert_eq!( assert_eq!(
@@ -173,7 +173,7 @@ X X X X X X X X ",
" ", " ",
) )
.expect("string parse success"); .expect("string parse success");
let r = AztecDetectorRXingResult::new(matrix, NO_POINTS.clone(), false, 15, 1); let r = AztecDetectorRXingResult::new(matrix, NO_POINTS, false, 15, 1);
let result = decoder::decode(&r).expect("decode success"); let result = decoder::decode(&r).expect("decode success");
assert_eq!("Français", result.getText()); assert_eq!("Français", result.getText());
} }
@@ -214,7 +214,7 @@ X X . X . X . . . X . X . . . . X X . X . . X X . . . ",
". ", ". ",
) )
.expect("parse string failed"); .expect("parse string failed");
let r = AztecDetectorRXingResult::new(matrix, NO_POINTS.clone(), true, 16, 4); let r = AztecDetectorRXingResult::new(matrix, NO_POINTS, true, 16, 4);
assert!(decoder::decode(&r).is_ok()); assert!(decoder::decode(&r).is_ok());
} }
@@ -254,7 +254,7 @@ X X . . . X X . . X . X . . . . X X . X . . X . X . X ",
". ", ". ",
) )
.expect("String Parse failed"); .expect("String Parse failed");
let r = AztecDetectorRXingResult::new(matrix, NO_POINTS.clone(), true, 16, 4); let r = AztecDetectorRXingResult::new(matrix, NO_POINTS, true, 16, 4);
assert!(decoder::decode(&r).is_ok()); assert!(decoder::decode(&r).is_ok());
} }

View File

@@ -671,7 +671,7 @@ fn testEncodeDecode(data: &str, compact: bool, layers: u32) {
let mut matrix = aztec.getMatrix().clone(); let mut matrix = aztec.getMatrix().clone();
let mut r = AztecDetectorRXingResult::new( let mut r = AztecDetectorRXingResult::new(
matrix.clone(), matrix.clone(),
NO_POINTS.clone(), NO_POINTS,
aztec.isCompact(), aztec.isCompact(),
aztec.getCodeWords(), aztec.getCodeWords(),
aztec.getLayers(), aztec.getLayers(),
@@ -698,7 +698,7 @@ fn testEncodeDecode(data: &str, compact: bool, layers: u32) {
); );
r = AztecDetectorRXingResult::new( r = AztecDetectorRXingResult::new(
matrix, matrix,
NO_POINTS.clone(), NO_POINTS,
aztec.isCompact(), aztec.isCompact(),
aztec.getCodeWords(), aztec.getCodeWords(),
aztec.getLayers(), aztec.getLayers(),
@@ -751,7 +751,7 @@ fn testWriter(
let mut r = AztecDetectorRXingResult::new( let mut r = AztecDetectorRXingResult::new(
matrix.clone(), matrix.clone(),
NO_POINTS.clone(), NO_POINTS,
aztec.isCompact(), aztec.isCompact(),
aztec.getCodeWords(), aztec.getCodeWords(),
aztec.getLayers(), aztec.getLayers(),
@@ -780,7 +780,7 @@ fn testWriter(
} }
r = AztecDetectorRXingResult::new( r = AztecDetectorRXingResult::new(
matrix, matrix,
NO_POINTS.clone(), NO_POINTS,
aztec.isCompact(), aztec.isCompact(),
aztec.getCodeWords(), aztec.getCodeWords(),
aztec.getLayers(), aztec.getLayers(),

View File

@@ -209,8 +209,8 @@ impl BitMatrix {
#[inline(always)] #[inline(always)]
fn get_offset(&self, y: u32, x: u32) -> usize { fn get_offset(&self, y: u32, x: u32) -> usize {
let offset = y as usize * self.row_size + (x as usize / 32);
offset y as usize * self.row_size + (x as usize / 32)
} }
pub fn try_get(&self, x: u32, y: u32) -> Result<bool, Exceptions> { pub fn try_get(&self, x: u32, y: u32) -> Result<bool, Exceptions> {

View File

@@ -35,7 +35,7 @@ pub struct MonochromeRectangleDetector<'a> {
impl<'a> MonochromeRectangleDetector<'_> { impl<'a> MonochromeRectangleDetector<'_> {
pub fn new(image: &'a BitMatrix) -> MonochromeRectangleDetector<'a> { pub fn new(image: &'a BitMatrix) -> MonochromeRectangleDetector<'a> {
MonochromeRectangleDetector { image: image } MonochromeRectangleDetector { image }
} }
/** /**

View File

@@ -81,7 +81,7 @@ impl<'a> WhiteRectangleDetector<'_> {
} }
Ok(WhiteRectangleDetector { Ok(WhiteRectangleDetector {
image: image, image,
height: image.getHeight() as i32, height: image.getHeight() as i32,
width: image.getWidth() as i32, width: image.getWidth() as i32,
leftInit, leftInit,