Implement clippy suggestions

This commit is contained in:
Henry Schimke
2023-01-04 14:48:16 -06:00
parent c65eadf102
commit 48287631dd
196 changed files with 2465 additions and 2574 deletions

View File

@@ -56,7 +56,7 @@ impl<T: Reader> MultipleBarcodeReader for GenericMultipleBarcodeReader<T> {
let mut results = Vec::new();
self.doDecodeMultiple(image, hints, &mut results, 0, 0, 0);
if results.is_empty() {
return Err(Exceptions::NotFoundException("".to_owned()));
return Err(Exceptions::NotFoundException(None));
}
Ok(results)
}

View File

@@ -52,8 +52,8 @@ impl<'a> MultiDetector<'_> {
let mut finder = MultiFinderPatternFinder::new(image, resultPointCallback);
let infos = finder.findMulti(hints)?;
if infos.len() == 0 {
return Err(Exceptions::NotFoundException("".to_owned()));
if infos.is_empty() {
return Err(Exceptions::NotFoundException(None));
}
let mut result = Vec::new();

View File

@@ -90,9 +90,9 @@ impl MultiFinderPatternFinder {
if size < 3 {
// Couldn't find enough finder patterns
return Err(Exceptions::NotFoundException(
return Err(Exceptions::NotFoundException(Some(
"Couldn't find enough finder patterns".to_owned(),
));
)));
}
/*
@@ -179,8 +179,8 @@ impl MultiFinderPatternFinder {
// Check the sizes
let estimatedModuleCount = (dA + dB) / (p1.getEstimatedModuleSize() * 2.0);
if estimatedModuleCount > MAX_MODULE_COUNT_PER_EDGE
|| estimatedModuleCount < MIN_MODULE_COUNT_PER_EDGE
if !(MIN_MODULE_COUNT_PER_EDGE..=MAX_MODULE_COUNT_PER_EDGE)
.contains(&estimatedModuleCount)
{
continue;
}
@@ -210,7 +210,7 @@ impl MultiFinderPatternFinder {
if !results.is_empty() {
Ok(results)
} else {
Err(Exceptions::NotFoundException("no result".to_owned()))
Err(Exceptions::NotFoundException(None))
}
}

View File

@@ -171,7 +171,7 @@ impl QRCodeMultiReader {
let mut newRXingResult =
RXingResult::new(&newText, newRawBytes, Vec::new(), BarcodeFormat::QR_CODE);
if newByteSegment.len() > 0 {
if !newByteSegment.is_empty() {
newRXingResult.putMetadata(
RXingResultMetadataType::BYTE_SEGMENTS,
RXingResultMetadataValue::ByteSegments(vec![newByteSegment]),