From 4c9ec95d00df23e50ddb7a8b6e0137ef581e1deb Mon Sep 17 00:00:00 2001 From: Henry Schimke Date: Sat, 28 Oct 2023 10:57:42 -0500 Subject: [PATCH] basic clippy fixes --- crates/cli/src/main.rs | 2 +- src/client/result/EmailDoCoMoResultParser.rs | 2 +- src/datamatrix/detector/zxing_cpp_detector/mod.rs | 8 ++++---- src/maxicode/decoder/maxicode_decoder.rs | 2 +- .../expanded/rss_expanded_stacked_internal_test_case.rs | 4 ++-- src/pdf417/decoder/pdf_417_scanning_decoder.rs | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/crates/cli/src/main.rs b/crates/cli/src/main.rs index 5c84145..2776e52 100644 --- a/crates/cli/src/main.rs +++ b/crates/cli/src/main.rs @@ -617,7 +617,7 @@ fn encode_command( // println!("Encode: file_name: {}, barcode_type: {}, width: {:?}, height: {:?}, data: '{:?}', data_file: {:?}", file_name, barcode_type, width, height, data, data_file); - let writer = MultiFormatWriter::default(); + let writer = MultiFormatWriter; match writer.encode_with_hints( &input_data, barcode_type, diff --git a/src/client/result/EmailDoCoMoResultParser.rs b/src/client/result/EmailDoCoMoResultParser.rs index 335f02d..c7b87d5 100644 --- a/src/client/result/EmailDoCoMoResultParser.rs +++ b/src/client/result/EmailDoCoMoResultParser.rs @@ -67,7 +67,7 @@ pub fn parse(result: &RXingResult) -> Option { */ pub fn isBasicallyValidEmailAddress(email: &str, regex: &Regex) -> bool { let email_exists = !email.is_empty(); - let email_has_at = matches!(email.find('@'), Some(_)); + let email_has_at = email.find('@').is_some(); let email_alphamatcher = if let Some(mtch) = regex.find(email) { mtch.start() == 0 && mtch.end() == email.len() } else { diff --git a/src/datamatrix/detector/zxing_cpp_detector/mod.rs b/src/datamatrix/detector/zxing_cpp_detector/mod.rs index 5282907..e0e7683 100644 --- a/src/datamatrix/detector/zxing_cpp_detector/mod.rs +++ b/src/datamatrix/detector/zxing_cpp_detector/mod.rs @@ -1,10 +1,10 @@ mod cpp_new_detector; -pub(self) use crate::common::cpp_essentials::bitmatrix_cursor_trait::*; + use crate::common::cpp_essentials::bitmatrix_cursor_trait::*; -pub(self) use crate::common::cpp_essentials::dm_regression_line::*; -pub(self) use crate::common::cpp_essentials::edge_tracer::*; + use crate::common::cpp_essentials::dm_regression_line::*; + use crate::common::cpp_essentials::edge_tracer::*; -pub(self) use crate::common::cpp_essentials::util; + use crate::common::cpp_essentials::util; pub use cpp_new_detector::detect; diff --git a/src/maxicode/decoder/maxicode_decoder.rs b/src/maxicode/decoder/maxicode_decoder.rs index 587d9d2..5b5594a 100644 --- a/src/maxicode/decoder/maxicode_decoder.rs +++ b/src/maxicode/decoder/maxicode_decoder.rs @@ -60,7 +60,7 @@ pub fn decode_with_hints( let mode = codewords[0] & 0x0F; let mut datawords; match mode { - 2 | 3 | 4 => { + 2..=4 => { correctErrors(&mut codewords, 20, 84, 40, EVEN)?; correctErrors(&mut codewords, 20, 84, 40, ODD)?; datawords = vec![0u8; 94]; diff --git a/src/oned/rss/expanded/rss_expanded_stacked_internal_test_case.rs b/src/oned/rss/expanded/rss_expanded_stacked_internal_test_case.rs index 0a737dd..4b83bf5 100644 --- a/src/oned/rss/expanded/rss_expanded_stacked_internal_test_case.rs +++ b/src/oned/rss/expanded/rss_expanded_stacked_internal_test_case.rs @@ -44,10 +44,10 @@ fn testDecodingRowByRow() { // let tester = ; - assert!(|| -> Result> { + assert!({ rssExpandedReader.decodeRow2pairs(firstRowNumber as u32, &firstRow) // fail(NotFoundException.class.getName() + " expected"); - }() + } .is_err()); assert_eq!(1, rssExpandedReader.getRows().len()); diff --git a/src/pdf417/decoder/pdf_417_scanning_decoder.rs b/src/pdf417/decoder/pdf_417_scanning_decoder.rs index f6593b3..f00d518 100644 --- a/src/pdf417/decoder/pdf_417_scanning_decoder.rs +++ b/src/pdf417/decoder/pdf_417_scanning_decoder.rs @@ -452,7 +452,7 @@ fn createDecoderRXingResult( } } } - let ambiguousIndexValues = Vec::from_iter(ambiguousIndexValuesList.into_iter()); + let ambiguousIndexValues = Vec::from_iter(ambiguousIndexValuesList); // for value in ambiguousIndexValuesList { // ambiguousIndexValues.push(value); // }