chore: cleanup some clippy errors

This commit is contained in:
Henry Schimke
2024-01-04 12:26:47 -06:00
parent 718b737877
commit d068c19fb8
3 changed files with 8 additions and 18 deletions

View File

@@ -337,7 +337,7 @@ fn testEncodeWithForcedCodeSetFailureCodeSetABadCharacter() {
#[test]
#[should_panic]
fn testEncodeWithForcedCodeSetFailureCodeSetBBadCharacter() {
let toEncode = "ASdf\00123"; // \0 (ascii value 0)
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);

View File

@@ -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));

View File

@@ -111,10 +111,10 @@ pub fn FindFinderPatterns(image: &BitMatrix, tryHarder: bool) -> FinderPatterns
next.iter().sum::<u16>() 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<QRCodeDetect
let found = LocateAlignmentPattern(image, moduleSize, guessed);
// search again near that intersection and if the search fails, use the intersection
// if (!found.is_some()) {printf("location guessed at %dx%d\n", x, y)};
apP.set(
x,
y,
if found.is_some() {
found.unwrap()
} else {
guessed
},
);
apP.set(x, y, if let Some(f) = found { f } else { guessed });
}
}
}