clippy --fix

This commit is contained in:
Henry Schimke
2023-01-05 11:32:10 -06:00
parent b375e04160
commit b69f23711c
15 changed files with 21 additions and 24 deletions

View File

@@ -16,7 +16,7 @@
//package com.google.zxing; //package com.google.zxing;
use std::{cell::RefCell, rc::Rc, borrow::Cow}; use std::{rc::Rc, borrow::Cow};
use crate::{ use crate::{
common::{BitArray, BitMatrix}, common::{BitArray, BitMatrix},

View File

@@ -16,7 +16,7 @@
//package com.google.zxing; //package com.google.zxing;
use std::{cell::RefCell, fmt, rc::Rc, borrow::Cow}; use std::{fmt, rc::Rc, borrow::Cow};
use crate::{ use crate::{
common::{BitArray, BitMatrix}, common::{BitArray, BitMatrix},
@@ -47,14 +47,14 @@ impl BinaryBitmap {
* @return The width of the bitmap. * @return The width of the bitmap.
*/ */
pub fn getWidth(&self) -> usize { pub fn getWidth(&self) -> usize {
return self.binarizer.getWidth(); self.binarizer.getWidth()
} }
/** /**
* @return The height of the bitmap. * @return The height of the bitmap.
*/ */
pub fn getHeight(&self) -> usize { pub fn getHeight(&self) -> usize {
return self.binarizer.getHeight(); self.binarizer.getHeight()
} }
/** /**

View File

@@ -20,7 +20,7 @@
// import com.google.zxing.LuminanceSource; // import com.google.zxing.LuminanceSource;
// import com.google.zxing.NotFoundException; // import com.google.zxing.NotFoundException;
use std::{cell::RefCell, rc::Rc, borrow::Cow}; use std::{rc::Rc, borrow::Cow};
use once_cell::unsync::OnceCell; use once_cell::unsync::OnceCell;

View File

@@ -20,7 +20,7 @@
// import com.google.zxing.LuminanceSource; // import com.google.zxing.LuminanceSource;
// import com.google.zxing.NotFoundException; // import com.google.zxing.NotFoundException;
use std::{cell::RefCell, rc::Rc, borrow::Cow}; use std::{rc::Rc, borrow::Cow};
use once_cell::unsync::OnceCell; use once_cell::unsync::OnceCell;

View File

@@ -1,5 +1,4 @@
use std::{ use std::{
cell::RefCell,
collections::{HashMap, HashSet}, collections::{HashMap, HashSet},
rc::Rc, rc::Rc,
}; };

View File

@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
use std::{cell::RefCell, collections::HashSet, path::PathBuf, rc::Rc}; use std::{collections::HashSet, path::PathBuf, rc::Rc};
use crate::{ use crate::{
common::HybridBinarizer, BarcodeFormat, BinaryBitmap, BufferedImageLuminanceSource, common::HybridBinarizer, BarcodeFormat, BinaryBitmap, BufferedImageLuminanceSource,

View File

@@ -222,7 +222,7 @@ mod multi_qr_code_test_case {
* limitations under the License. * limitations under the License.
*/ */
use std::{cell::RefCell, collections::HashSet, path::PathBuf, rc::Rc}; use std::{collections::HashSet, path::PathBuf, rc::Rc};
use image; use image;

View File

@@ -24,7 +24,7 @@
* http://www.piramidepse.com/ * http://www.piramidepse.com/
*/ */
use std::{cell::RefCell, rc::Rc}; use std::{rc::Rc};
/** /**
* @author Pablo Orduña, University of Deusto (pablo.orduna@deusto.es) * @author Pablo Orduña, University of Deusto (pablo.orduna@deusto.es)
@@ -174,7 +174,7 @@ fn assertCorrectImage2binary(fileName: &str, expected: &str) {
let path = format!("test_resources/blackbox/rssexpanded-1/{}", fileName); let path = format!("test_resources/blackbox/rssexpanded-1/{}", fileName);
let image = image::open(path).expect("file exists"); let image = image::open(path).expect("file exists");
let mut binaryMap = BinaryBitmap::new(Rc::new(GlobalHistogramBinarizer::new( let binaryMap = BinaryBitmap::new(Rc::new(GlobalHistogramBinarizer::new(
Box::new(BufferedImageLuminanceSource::new(image)), Box::new(BufferedImageLuminanceSource::new(image)),
))); )));
let rowNumber = binaryMap.getHeight() / 2; let rowNumber = binaryMap.getHeight() / 2;

View File

@@ -29,7 +29,7 @@
* *
*/ */
use std::{cell::RefCell, collections::HashMap, rc::Rc}; use std::{collections::HashMap, rc::Rc};
use crate::{ use crate::{
client::result::{ExpandedProductParsedRXingResult, ParsedClientResult}, client::result::{ExpandedProductParsedRXingResult, ParsedClientResult},
@@ -71,7 +71,7 @@ fn assertCorrectImage2result(fileName: &str, expected: ExpandedProductParsedRXin
let path = format!("test_resources/blackbox/rssexpanded-1/{}", fileName); let path = format!("test_resources/blackbox/rssexpanded-1/{}", fileName);
let image = image::open(path).expect("image must exist"); let image = image::open(path).expect("image must exist");
let mut binaryMap = BinaryBitmap::new(Rc::new(GlobalHistogramBinarizer::new( let binaryMap = BinaryBitmap::new(Rc::new(GlobalHistogramBinarizer::new(
Box::new(BufferedImageLuminanceSource::new(image)), Box::new(BufferedImageLuminanceSource::new(image)),
))); )));
let rowNumber = binaryMap.getHeight() / 2; let rowNumber = binaryMap.getHeight() / 2;

View File

@@ -24,7 +24,7 @@
* http://www.piramidepse.com/ * http://www.piramidepse.com/
*/ */
use std::{cell::RefCell, collections::HashMap, rc::Rc}; use std::{collections::HashMap, rc::Rc};
use crate::{ use crate::{
common::GlobalHistogramBinarizer, common::GlobalHistogramBinarizer,
@@ -184,7 +184,7 @@ fn assertCorrectImage2string(fileName: &str, expected: &str) {
let path = format!("test_resources/blackbox/rssexpanded-1/{}", fileName); let path = format!("test_resources/blackbox/rssexpanded-1/{}", fileName);
let image = image::open(path).expect("load image"); let image = image::open(path).expect("load image");
let mut binaryMap = BinaryBitmap::new(Rc::new(GlobalHistogramBinarizer::new( let binaryMap = BinaryBitmap::new(Rc::new(GlobalHistogramBinarizer::new(
Box::new(BufferedImageLuminanceSource::new(image)), Box::new(BufferedImageLuminanceSource::new(image)),
))); )));
let rowNumber = binaryMap.getHeight() / 2; let rowNumber = binaryMap.getHeight() / 2;

View File

@@ -24,7 +24,7 @@
* http://www.piramidepse.com/ * http://www.piramidepse.com/
*/ */
use std::{cell::RefCell, rc::Rc}; use std::{rc::Rc};
use crate::{ use crate::{
common::GlobalHistogramBinarizer, common::GlobalHistogramBinarizer,
@@ -42,7 +42,7 @@ use super::RSSExpandedReader;
#[test] #[test]
fn testFindFinderPatterns() { fn testFindFinderPatterns() {
let image = readImage("2.png"); let image = readImage("2.png");
let mut binaryMap = BinaryBitmap::new(Rc::new(GlobalHistogramBinarizer::new( let binaryMap = BinaryBitmap::new(Rc::new(GlobalHistogramBinarizer::new(
Box::new(BufferedImageLuminanceSource::new(image)), Box::new(BufferedImageLuminanceSource::new(image)),
))); )));
let rowNumber = binaryMap.getHeight() as u32 / 2; let rowNumber = binaryMap.getHeight() as u32 / 2;
@@ -88,7 +88,7 @@ fn testFindFinderPatterns() {
#[test] #[test]
fn testRetrieveNextPairPatterns() { fn testRetrieveNextPairPatterns() {
let image = readImage("3.png"); let image = readImage("3.png");
let mut binaryMap = BinaryBitmap::new(Rc::new(GlobalHistogramBinarizer::new( let binaryMap = BinaryBitmap::new(Rc::new(GlobalHistogramBinarizer::new(
Box::new(BufferedImageLuminanceSource::new(image)), Box::new(BufferedImageLuminanceSource::new(image)),
))); )));
let rowNumber = binaryMap.getHeight() as u32 / 2; let rowNumber = binaryMap.getHeight() as u32 / 2;
@@ -116,7 +116,7 @@ fn testRetrieveNextPairPatterns() {
#[test] #[test]
fn testDecodeCheckCharacter() { fn testDecodeCheckCharacter() {
let image = readImage("3.png"); let image = readImage("3.png");
let mut binaryMap = BinaryBitmap::new(Rc::new(GlobalHistogramBinarizer::new( let binaryMap = BinaryBitmap::new(Rc::new(GlobalHistogramBinarizer::new(
Box::new(BufferedImageLuminanceSource::new(image.clone())), Box::new(BufferedImageLuminanceSource::new(image.clone())),
))); )));
let row = binaryMap let row = binaryMap
@@ -144,7 +144,7 @@ fn testDecodeCheckCharacter() {
#[test] #[test]
fn testDecodeDataCharacter() { fn testDecodeDataCharacter() {
let image = readImage("3.png"); let image = readImage("3.png");
let mut binaryMap = BinaryBitmap::new(Rc::new(GlobalHistogramBinarizer::new( let binaryMap = BinaryBitmap::new(Rc::new(GlobalHistogramBinarizer::new(
Box::new(BufferedImageLuminanceSource::new(image.clone())), Box::new(BufferedImageLuminanceSource::new(image.clone())),
))); )));
let row = binaryMap let row = binaryMap

View File

@@ -36,7 +36,7 @@ use super::{test_case_util, RSSExpandedReader};
fn testDecodingRowByRow() { fn testDecodingRowByRow() {
let mut rssExpandedReader = RSSExpandedReader::new(); let mut rssExpandedReader = RSSExpandedReader::new();
let mut binaryMap = test_case_util::getBinaryBitmap("1000.png"); let binaryMap = test_case_util::getBinaryBitmap("1000.png");
let firstRowNumber = binaryMap.getHeight() / 3; let firstRowNumber = binaryMap.getHeight() / 3;
let firstRow = binaryMap.getBlackRow(firstRowNumber).expect("get row"); let firstRow = binaryMap.getBlackRow(firstRowNumber).expect("get row");

View File

@@ -24,7 +24,7 @@
* http://www.piramidepse.com/ * http://www.piramidepse.com/
*/ */
use std::{cell::RefCell, rc::Rc}; use std::{rc::Rc};
use image::DynamicImage; use image::DynamicImage;

View File

@@ -16,7 +16,6 @@
*/ */
use std::{ use std::{
cell::RefCell,
collections::HashMap, collections::HashMap,
fs::{read_dir, read_to_string, File}, fs::{read_dir, read_to_string, File},
io::Read, io::Read,

View File

@@ -16,7 +16,6 @@
*/ */
use std::{ use std::{
cell::RefCell,
collections::HashMap, collections::HashMap,
fs::{read_dir, read_to_string, File}, fs::{read_dir, read_to_string, File},
io::Read, io::Read,