mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-26 04:12:34 +00:00
Implement clippy suggestions
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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]),
|
||||
|
||||
Reference in New Issue
Block a user