mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-27 04:42:35 +00:00
Update macro and cargo fmt
This commit is contained in:
@@ -113,7 +113,8 @@ impl OneDReader for CodaBarReader {
|
||||
.decodeRowRXingResult
|
||||
.chars()
|
||||
.nth(i)
|
||||
.ok_or(Exceptions::INDEX_OUT_OF_BOUNDS)? as usize]
|
||||
.ok_or(Exceptions::INDEX_OUT_OF_BOUNDS)?
|
||||
as usize]
|
||||
.to_string(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -590,7 +590,8 @@ stuvwxyz{|}~\u{007F}\u{00FF}";
|
||||
contents
|
||||
.chars()
|
||||
.nth(i)
|
||||
.ok_or(Exceptions::INDEX_OUT_OF_BOUNDS)? as isize
|
||||
.ok_or(Exceptions::INDEX_OUT_OF_BOUNDS)?
|
||||
as isize
|
||||
- ' ' as isize
|
||||
}
|
||||
};
|
||||
|
||||
@@ -322,7 +322,10 @@ impl Code39Reader {
|
||||
while i < length {
|
||||
// for i in 0..length {
|
||||
// for (int i = 0; i < length; i++) {
|
||||
let c = encoded.chars().nth(i).ok_or(Exceptions::INDEX_OUT_OF_BOUNDS)?;
|
||||
let c = encoded
|
||||
.chars()
|
||||
.nth(i)
|
||||
.ok_or(Exceptions::INDEX_OUT_OF_BOUNDS)?;
|
||||
if c == '+' || c == '$' || c == '%' || c == '/' {
|
||||
let next = encoded
|
||||
.chars()
|
||||
|
||||
@@ -234,7 +234,10 @@ impl Code93Reader {
|
||||
while i < length {
|
||||
// for i in 0..length {
|
||||
// for (int i = 0; i < length; i++) {
|
||||
let c = encoded.chars().nth(i).ok_or(Exceptions::INDEX_OUT_OF_BOUNDS)?;
|
||||
let c = encoded
|
||||
.chars()
|
||||
.nth(i)
|
||||
.ok_or(Exceptions::INDEX_OUT_OF_BOUNDS)?;
|
||||
if ('a'..='d').contains(&c) {
|
||||
if i >= length - 1 {
|
||||
return Err(Exceptions::FORMAT);
|
||||
@@ -334,7 +337,12 @@ impl Code93Reader {
|
||||
for i in (0..checkPosition).rev() {
|
||||
total += weight
|
||||
* Self::ALPHABET_STRING
|
||||
.find(result.chars().nth(i).ok_or(Exceptions::INDEX_OUT_OF_BOUNDS)?)
|
||||
.find(
|
||||
result
|
||||
.chars()
|
||||
.nth(i)
|
||||
.ok_or(Exceptions::INDEX_OUT_OF_BOUNDS)?,
|
||||
)
|
||||
.map_or_else(|| -1_i32, |v| v as i32);
|
||||
weight += 1;
|
||||
if weight > weightMax as i32 {
|
||||
|
||||
@@ -528,8 +528,8 @@ impl RSSExpandedReader {
|
||||
|
||||
// Not private for unit testing
|
||||
pub(crate) fn constructRXingResult(pairs: &[ExpandedPair]) -> Result<RXingResult> {
|
||||
let binary = bit_array_builder::buildBitArray(&pairs.to_vec())
|
||||
.ok_or(Exceptions::ILLEGAL_STATE)?;
|
||||
let binary =
|
||||
bit_array_builder::buildBitArray(&pairs.to_vec()).ok_or(Exceptions::ILLEGAL_STATE)?;
|
||||
|
||||
let mut decoder = abstract_expanded_decoder::createDecoder(&binary)?;
|
||||
let resultingString = decoder.parseInformation()?;
|
||||
@@ -692,7 +692,9 @@ impl RSSExpandedReader {
|
||||
} else if previousPairs.is_empty() {
|
||||
rowOffset = 0;
|
||||
} else {
|
||||
let lastPair = previousPairs.last().ok_or(Exceptions::INDEX_OUT_OF_BOUNDS)?;
|
||||
let lastPair = previousPairs
|
||||
.last()
|
||||
.ok_or(Exceptions::INDEX_OUT_OF_BOUNDS)?;
|
||||
rowOffset = lastPair
|
||||
.getFinderPattern()
|
||||
.as_ref()
|
||||
|
||||
@@ -66,9 +66,7 @@ impl UPCEANReader for UPCEReader {
|
||||
}
|
||||
|
||||
fn checkChecksum(&self, s: &str) -> Result<bool> {
|
||||
self.checkStandardUPCEANChecksum(
|
||||
&convertUPCEtoUPCA(s).ok_or(Exceptions::ILLEGAL_ARGUMENT)?,
|
||||
)
|
||||
self.checkStandardUPCEANChecksum(&convertUPCEtoUPCA(s).ok_or(Exceptions::ILLEGAL_ARGUMENT)?)
|
||||
}
|
||||
|
||||
fn decodeEnd(&self, row: &crate::common::BitArray, endStart: usize) -> Result<[usize; 2]> {
|
||||
|
||||
Reference in New Issue
Block a user