diff --git a/src/oned/code_128_writer_test_tase.rs b/src/oned/code_128_writer_test_tase.rs index 057ea20..ee07238 100644 --- a/src/oned/code_128_writer_test_tase.rs +++ b/src/oned/code_128_writer_test_tase.rs @@ -337,8 +337,8 @@ fn testEncodeWithForcedCodeSetFailureCodeSetABadCharacter() { #[test] #[should_panic] fn testEncodeWithForcedCodeSetFailureCodeSetBBadCharacter() { - let toEncode = "ASdf\00123"; // \0 (ascii value 0) - // Characters with ASCII value below 32 should not be accepted when the code set is forced to B. + let toEncode = "ASdf\x000123"; // \0 (ascii value 0) + // Characters with ASCII value below 32 should not be accepted when the code set is forced to B. let mut hints = HashMap::new(); //new EnumMap<>(EncodeHintType.class); hints.insert( diff --git a/src/oned/telepen_writer.rs b/src/oned/telepen_writer.rs index 4912872..349669e 100644 --- a/src/oned/telepen_writer.rs +++ b/src/oned/telepen_writer.rs @@ -244,12 +244,10 @@ mod TelepenWriterTestCase { } fn doTest(input: &str, expected: &str, numeric: bool) { - let result: BitMatrix; - - if numeric { - result = encode_with_hints(input); + let result: BitMatrix = if numeric { + encode_with_hints(input) } else { - result = encode(input); + encode(input) }; assert_eq!(expected, bit_matrix_test_case::matrix_to_string(&result)); diff --git a/src/qrcode/cpp_port/detector.rs b/src/qrcode/cpp_port/detector.rs index fc632bc..61f7ea1 100644 --- a/src/qrcode/cpp_port/detector.rs +++ b/src/qrcode/cpp_port/detector.rs @@ -111,10 +111,10 @@ pub fn FindFinderPatterns(image: &BitMatrix, tryHarder: bool) -> FinderPatterns next.iter().sum::() as i32 * 3, ); // 3 for very skewed samples // Reduce(next) * 3); // 3 for very skewed samples - if pattern.is_some() { + if let Some(p) = pattern { // log(*pattern, 3); // assert!(image.get_point(pattern.as_ref().unwrap().p)); - res.push(pattern.unwrap()); + res.push(p); } } @@ -697,15 +697,7 @@ pub fn SampleQR(image: &BitMatrix, fp: &FinderPatternSet) -> Result