updated cargo fmt

This commit is contained in:
Henry Schimke
2023-10-28 11:04:14 -05:00
parent 4c9ec95d00
commit 5ea03cc066
24 changed files with 122 additions and 64 deletions

View File

@@ -181,11 +181,11 @@ impl DataMatrixReader {
*/
fn extractPureBits(&self, image: &BitMatrix) -> Result<BitMatrix> {
let Some(leftTopBlack) = image.getTopLeftOnBit() else {
return Err(Exceptions::NOT_FOUND)
};
let Some(rightBottomBlack) = image.getBottomRightOnBit()else {
return Err(Exceptions::NOT_FOUND)
};
return Err(Exceptions::NOT_FOUND);
};
let Some(rightBottomBlack) = image.getBottomRightOnBit() else {
return Err(Exceptions::NOT_FOUND);
};
let moduleSize = Self::moduleSize(leftTopBlack, image)?;

View File

@@ -119,9 +119,10 @@ impl Writer for DataMatrixWriter {
let hasEncodingHint = hints.contains_key(&EncodeHintType::CHARACTER_SET);
if hasEncodingHint {
let Some(EncodeHintValue::CharacterSet(char_set_name)) =
hints.get(&EncodeHintType::CHARACTER_SET) else {
return Err(Exceptions::illegal_argument_with("charset does not exist"))
};
hints.get(&EncodeHintType::CHARACTER_SET)
else {
return Err(Exceptions::illegal_argument_with("charset does not exist"));
};
charset = CharacterSet::get_character_set_by_name(char_set_name);
//encoding::label::encoding_from_whatwg_label(char_set_name);
// charset = Charset.forName(hints.get(EncodeHintType.CHARACTER_SET).toString());
@@ -154,9 +155,16 @@ impl Writer for DataMatrixWriter {
}
let symbol_lookup = SymbolInfoLookup::new();
let Some(symbolInfo) = symbol_lookup.lookup_with_codewords_shape_size_fail(encoded.chars().count() as u32, *shape, &minSize, &maxSize, true)? else {
return Err(Exceptions::not_found_with("symbol info is bad"))
};
let Some(symbolInfo) = symbol_lookup.lookup_with_codewords_shape_size_fail(
encoded.chars().count() as u32,
*shape,
&minSize,
&maxSize,
true,
)?
else {
return Err(Exceptions::not_found_with("symbol info is bad"));
};
//2. step: ECC generation
let codewords = error_correction::encodeECC200(&encoded, symbolInfo)?;

View File

@@ -1,10 +1,10 @@
mod cpp_new_detector;
use crate::common::cpp_essentials::bitmatrix_cursor_trait::*;
use crate::common::cpp_essentials::bitmatrix_cursor_trait::*;
use crate::common::cpp_essentials::dm_regression_line::*;
use crate::common::cpp_essentials::edge_tracer::*;
use crate::common::cpp_essentials::dm_regression_line::*;
use crate::common::cpp_essentials::edge_tracer::*;
use crate::common::cpp_essentials::util;
use crate::common::cpp_essentials::util;
pub use cpp_new_detector::detect;

View File

@@ -359,9 +359,7 @@ fn lookAheadTestIntern(msg: &str, startpos: u32, currentMode: u32) -> usize {
return C40_ENCODATION;
}
let Some(c) = msg
.chars()
.nth((startpos + charsProcessed) as usize) else {
let Some(c) = msg.chars().nth((startpos + charsProcessed) as usize) else {
break 0;
};
charsProcessed += 1;