Skip to content

Commit

Permalink
chore: cleanup and clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
hschimke committed Jan 9, 2025
1 parent 10902e5 commit 53f06b9
Show file tree
Hide file tree
Showing 35 changed files with 48 additions and 68 deletions.
2 changes: 1 addition & 1 deletion src/aztec/encoder/aztec_encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use crate::{

use super::{AztecCode, HighLevelEncoder};

/**
/*
* Generates Aztec 2D barcodes.
*
* @author Rustam Abdullaev
Expand Down
1 change: 0 additions & 1 deletion src/binary_bitmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ use crate::{
*
* @author [email protected] (Daniel Switkin)
*/

pub struct BinaryBitmap<B: Binarizer> {
binarizer: B,
pub(crate) matrix: OnceCell<BitMatrix>,
Expand Down
3 changes: 0 additions & 3 deletions src/client/result/GeoResultParser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ const GEO_URL_PATTERN: &str = "geo:([\\-0-9.]+),([\\-0-9.]+)(?:,([\\-0-9.]+))?(?
*
* @author Sean Owen
*/
// pub struct GeoRXingResultParser {}

// impl RXingResultParser for GeoRXingResultParser {
pub fn parse(theRXingResult: &crate::RXingResult) -> Option<super::ParsedClientResult> {
let rawText = ResultParser::getMassagedText(theRXingResult);

Expand Down
6 changes: 0 additions & 6 deletions src/client/result/ISBNResultParser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,6 @@ use super::{ISBNParsedRXingResult, ParsedClientResult, ResultParser};
*
* @author [email protected] (Jeff Breidenbach)
*/
// pub struct ISBNRXingResultParser {}

// impl RXingResultParser for ISBNRXingResultParser {
/**
* See <a href="http://www.bisg.org/isbn-13/for.dummies.html">ISBN-13 For Dummies</a>
*/
pub fn parse(theRXingResult: &crate::RXingResult) -> Option<super::ParsedClientResult> {
let format = theRXingResult.getBarcodeFormat();
if *format != BarcodeFormat::EAN_13 {
Expand Down
2 changes: 1 addition & 1 deletion src/client/result/ResultParser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ use super::{
VEventResultParser, VINResultParser, WifiResultParser,
};

/**
/*
* <p>Abstract class representing the result of decoding a barcode, as more than
* a String -- as some type of structured data. This might be a subclass which represents
* a URL, or an e-mail address. {@link #parseRXingResult(RXingResult)} will turn a raw
Expand Down
4 changes: 0 additions & 4 deletions src/client/result/TelResultParser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ use super::{ParsedClientResult, ResultParser, TelParsedRXingResult};
*
* @author Sean Owen
*/
// pub struct TelRXingResultParser {}

// impl RXingResultParser for TelRXingResultParser {

pub fn parse(theRXingResult: &crate::RXingResult) -> Option<ParsedClientResult> {
let rawText = ResultParser::getMassagedText(theRXingResult);
if !rawText.starts_with("tel:") && !rawText.starts_with("TEL:") {
Expand Down
12 changes: 6 additions & 6 deletions src/common/grid_sampler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,13 @@ pub trait GridSampler {
// sufficient to check the endpoints
self.checkAndNudgePoints(image, &mut points)?;
// try {
for x in 0..points.len() {
if image
.try_get(points[x].x as u32, points[x].y as u32)
.ok_or(Exceptions::not_found_with(
for (x, point) in points.iter().enumerate() {
// for x in 0..points.len() {
if image.try_get(point.x as u32, point.y as u32).ok_or(
Exceptions::not_found_with(
"index out of bounds, see documentation in file for explanation",
))?
{
),
)? {
// Black(-ish) pixel
bits.set(x as u32, y);
}
Expand Down
1 change: 0 additions & 1 deletion src/common/hybrid_binarizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
// import com.google.zxing.NotFoundException;

use std::borrow::Cow;
use std::u8;

use once_cell::unsync::OnceCell;

Expand Down
2 changes: 1 addition & 1 deletion src/common/string_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use crate::DecodeHints;

use super::CharacterSet;

/**
/*
* Common string-related functions.
*
* @author Sean Owen
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use crate::{

use super::{DMRegressionLine, EdgeTracer};

/**
/*
* The following code is the 'new' one implemented by Axel Waggershauser and is working completely different.
* It is performing something like a (back) trace search along edges through the bit matrix, first looking for
* the 'L'-pattern, then tracing the black/white borders at the top/right. Advantages over the old code are:
Expand Down
2 changes: 1 addition & 1 deletion src/datamatrix/encoder/error_correction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use crate::Exceptions;

use super::SymbolInfo;

/**
/*
* Error Correction Code for ECC200.
*/

Expand Down
2 changes: 1 addition & 1 deletion src/datamatrix/encoder/high_level_encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ pub const LATCH_TO_TEXT: u8 = 239;
* mode latch to EDIFACT encodation mode
*/
pub const LATCH_TO_EDIFACT: u8 = 240;
/**
/*
* ECI character (Extended Channel Interpretation)
*/
//private static final char ECI = 241;
Expand Down
2 changes: 1 addition & 1 deletion src/maxicode/decoder/decoded_bit_stream_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use crate::{
};
use once_cell::sync::Lazy;

/**
/*
* <p>MaxiCodes can encode text or structured information as bits in one of several modes,
* with multiple character sets in one code. This class decodes the bits back into text.</p>
*
Expand Down
2 changes: 1 addition & 1 deletion src/maxicode/decoder/maxicode_decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use crate::{

use super::{decoded_bit_stream_parser, BitMatrixParser};

/**
/*
* <p>The main class which implements MaxiCode decoding -- as opposed to locating and extracting
* the MaxiCode from an image.</p>
*
Expand Down
4 changes: 2 additions & 2 deletions src/multi/multi_test_case.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ fn testMulti() {
let mut testBase = PathBuf::from("test_resources/blackbox/multi-1");

testBase.push("1.png");
let image = image::io::Reader::open(testBase)
let image = image::ImageReader::open(testBase)
.expect("image must open")
.decode()
.expect("must decode");
Expand Down Expand Up @@ -62,7 +62,7 @@ fn testMultiQR() {
let mut testBase = PathBuf::from("test_resources/blackbox/multi-qrcode-1");

testBase.push("1.png");
let image = image::io::Reader::open(testBase)
let image = image::ImageReader::open(testBase)
.expect("image must open")
.decode()
.expect("must decode");
Expand Down
2 changes: 1 addition & 1 deletion src/multi/qrcode/qr_code_multi_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ mod multi_qr_code_test_case {

testBase.push("1.png");

let image = image::io::Reader::open(testBase)
let image = image::ImageReader::open(testBase)
.expect("image must open")
.decode()
.expect("must decode");
Expand Down
2 changes: 1 addition & 1 deletion src/oned/ean_manufacturer_org_support.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

/**
/*
* Records EAN prefix to GS1 Member Organization, where the member organization
* correlates strongly with a country. This is an imperfect means of identifying
* a country of origin by EAN-13 barcode value. See
Expand Down
2 changes: 1 addition & 1 deletion src/oned/rss/expanded/bit_array_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use crate::{common::BitArray, oned::rss::DataCharacterTrait};

use super::ExpandedPair;

/**
/*
* @author Pablo Orduña, University of Deusto ([email protected])
* @author Eduardo Castillejo, University of Deusto ([email protected])
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

use crate::oned::rss::expanded::{binary_util, decoders::abstract_expanded_decoder::createDecoder};

/**
/*
* @author Pablo Orduña, University of Deusto ([email protected])
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ use super::{
AI01AndOtherAIs, AnyAIDecoder, GeneralAppIdDecoder,
};

/**
/*
* @author Pablo Orduña, University of Deusto ([email protected])
* @author Eduardo Castillejo, University of Deusto ([email protected])
*/
Expand Down
1 change: 0 additions & 1 deletion src/oned/rss/rss_14_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* limitations under the License.
*/


use crate::{
common::{BitArray, Result},
oned::{one_d_reader, OneDReader},
Expand Down
2 changes: 1 addition & 1 deletion src/oned/rss/rss_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

/** Adapted from listings in ISO/IEC 24724 Appendix B and Appendix G. */
/* Adapted from listings in ISO/IEC 24724 Appendix B and Appendix G. */

pub fn getRSSvalue<const S: usize>(widths: &[u32; S], maxWidth: u32, noNarrow: bool) -> u32 {
let elements = S as u32;
Expand Down
2 changes: 1 addition & 1 deletion src/pdf417/decoder/ec/error_correction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use once_cell::sync::Lazy;
// static ref PDF417_GF : Arc<&ModulusGF> = Arc::new(&ModulusGF::new(NUMBER_OF_CODEWORDS, 3));
static FLD_INTERIOR: Lazy<ModulusGF> = Lazy::new(|| ModulusGF::new(NUMBER_OF_CODEWORDS, 3));

/**
/*
* <p>PDF417 error correction implementation.</p>
*
* <p>This <a href="http://en.wikipedia.org/wiki/Reed%E2%80%93Solomon_error_correction#Example">example</a>
Expand Down
7 changes: 2 additions & 5 deletions src/pdf417/decoder/pdf_417_codeword_decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,12 @@

use crate::pdf417::pdf_417_common;

/**
/*
* @author Guenther Grau
* @author creatale GmbH ([email protected])
*/

// const RATIOS_TABLE :[[f32]] =
// [[0.0;pdf_417_common::SYMBOL_TABLE.len()];pdf_417_common::BARS_IN_MODULE];

const RATIOS_TABLE: [[f32; pdf_417_common::BARS_IN_MODULE as usize]; 2787] = {
static RATIOS_TABLE: [[f32; pdf_417_common::BARS_IN_MODULE as usize]; 2787] = {
let mut table =
[[0.0; pdf_417_common::BARS_IN_MODULE as usize]; pdf_417_common::SYMBOL_TABLE.len()];
// Pre-computes the symbol ratio table.
Expand Down
2 changes: 1 addition & 1 deletion src/pdf417/decoder/pdf_417_scanning_decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use super::{
DetectionRXingResultColumnTrait, DetectionRXingResultRowIndicatorColumn,
};

/**
/*
* @author Guenther Grau
*/

Expand Down
2 changes: 1 addition & 1 deletion src/pdf417/detector/pdf_417_detector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use std::borrow::Cow;

use super::PDF417DetectorRXingResult;

/**
/*
* <p>Encapsulates logic that can detect a PDF417 Code in an image, even if the
* PDF417 Code is rotated or skewed, or partially obscured.</p>
*
Expand Down
2 changes: 1 addition & 1 deletion src/pdf417/encoder/pdf_417_high_level_encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use crate::{

use super::Compaction;

/**
/*
* PDF417 high-level encoder following the algorithm described in ISO/IEC 15438:2001(E) in
* annex P.
*/
Expand Down
4 changes: 1 addition & 3 deletions src/pdf417/pdf_417_common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
*
* @author SITA Lab ([email protected])
* @author Guenther Grau
*/
Expand Down
2 changes: 1 addition & 1 deletion src/qrcode/QRCodeWriterTestCase.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ fn loadImage(fileName: &str) -> DynamicImage {
file.exists(),
"Please download and install test images, and run from the 'core' directory"
);
image::io::Reader::open(file)
image::ImageReader::open(file)
.expect("image should load")
.decode()
.expect("decode")
Expand Down
1 change: 0 additions & 1 deletion src/qrcode/cpp_port/data_mask.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ use crate::Exceptions;
* <p>Note that the diagram in section 6.8.1 is misleading since it indicates that i is column position
* and j is row position. In fact, as the text says, i is row position and j is column position.</p>
*/

pub fn GetDataMaskBit(maskIndex: u32, x: u32, y: u32, isMicro: Option<bool>) -> Result<bool> {
let isMicro = isMicro.unwrap_or(false);
let mut maskIndex = maskIndex;
Expand Down
2 changes: 1 addition & 1 deletion src/qrcode/decoder/decoded_bit_stream_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use crate::{DecodeHintType, DecodeHintValue};

use super::{ErrorCorrectionLevel, Mode, VersionRef};

/**
/*
* <p>QR Codes can encode text as bits in one of several modes, and can use multiple modes
* in one QR Code. This class decodes the bits back into text.</p>
*
Expand Down
2 changes: 1 addition & 1 deletion src/qrcode/encoder/mask_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use crate::Exceptions;

use super::ByteMatrix;

/**
/*
* @author Satoru Takabayashi
* @author Daniel Switkin
* @author Sean Owen
Expand Down
2 changes: 1 addition & 1 deletion src/qrcode/encoder/matrix_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use crate::{

use super::{mask_util, ByteMatrix, QRCode};

/**
/*
* @author [email protected] (Satoru Takabayashi) - creator
* @author [email protected] (Daniel Switkin) - ported from C++
*/
Expand Down
2 changes: 1 addition & 1 deletion tests/cropped_transposed_luma.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ fn test_binarizer_init_empty() {
assert!(rxing::helpers::detect_multiple_in_luma(DATA.to_vec(), 665, 286).is_ok())
}

const DATA: [u8; 190190] = [
static DATA: [u8; 190190] = [
220, 224, 216, 219, 221, 223, 221, 217, 216, 212, 203, 207, 213, 214, 208, 209, 218, 223, 221,
218, 212, 210, 202, 204, 209, 203, 211, 212, 216, 220, 223, 223, 221, 220, 219, 219, 219, 217,
214, 213, 215, 215, 213, 214, 214, 209, 203, 204, 212, 219, 221, 220, 225, 221, 208, 202, 205,
Expand Down
Loading

0 comments on commit 53f06b9

Please sign in to comment.