mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-26 04:12:34 +00:00
chore: clippy cleanups
This commit is contained in:
@@ -1,8 +1,7 @@
|
|||||||
use crate::qrcode::{
|
use crate::qrcode::{
|
||||||
cpp_port::Type,
|
cpp_port::Type,
|
||||||
decoder::{
|
decoder::{
|
||||||
ErrorCorrectionLevel, FormatInformation, FORMAT_INFO_DECODE_LOOKUP,
|
ErrorCorrectionLevel, FormatInformation, FORMAT_INFO_MASK_MODEL2, FORMAT_INFO_MASK_QR,
|
||||||
FORMAT_INFO_MASK_MODEL2, FORMAT_INFO_MASK_QR,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ use crate::Exceptions;
|
|||||||
|
|
||||||
impl Version {
|
impl Version {
|
||||||
pub fn Model1(version_number: u32) -> Result<VersionRef> {
|
pub fn Model1(version_number: u32) -> Result<VersionRef> {
|
||||||
if version_number < 1 || version_number > 14 {
|
if !(1..=14).contains(&version_number) {
|
||||||
Err(Exceptions::ILLEGAL_ARGUMENT)
|
Err(Exceptions::ILLEGAL_ARGUMENT)
|
||||||
} else {
|
} else {
|
||||||
Ok(&MODEL1_VERSIONS[version_number as usize - 1])
|
Ok(&MODEL1_VERSIONS[version_number as usize - 1])
|
||||||
@@ -22,7 +22,7 @@ impl Version {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn Model2(version_number: u32) -> Result<VersionRef> {
|
pub fn Model2(version_number: u32) -> Result<VersionRef> {
|
||||||
if version_number < 1 || version_number > 40 {
|
if !(1..=40).contains(&version_number) {
|
||||||
Err(Exceptions::ILLEGAL_ARGUMENT)
|
Err(Exceptions::ILLEGAL_ARGUMENT)
|
||||||
} else {
|
} else {
|
||||||
Ok(&VERSIONS[version_number as usize - 1])
|
Ok(&VERSIONS[version_number as usize - 1])
|
||||||
@@ -30,7 +30,7 @@ impl Version {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn Micro(version_number: u32) -> Result<VersionRef> {
|
pub fn Micro(version_number: u32) -> Result<VersionRef> {
|
||||||
if version_number < 1 || version_number > 4 {
|
if !(1..=4).contains(&version_number) {
|
||||||
Err(Exceptions::ILLEGAL_ARGUMENT)
|
Err(Exceptions::ILLEGAL_ARGUMENT)
|
||||||
} else {
|
} else {
|
||||||
Ok(&MICRO_VERSIONS[version_number as usize - 1])
|
Ok(&MICRO_VERSIONS[version_number as usize - 1])
|
||||||
@@ -95,12 +95,12 @@ impl Version {
|
|||||||
|
|
||||||
pub fn HasMicroSize(bitMatrix: &BitMatrix) -> bool {
|
pub fn HasMicroSize(bitMatrix: &BitMatrix) -> bool {
|
||||||
let size = bitMatrix.height();
|
let size = bitMatrix.height();
|
||||||
size >= 11 && size <= 17 && (size % 2) == 1
|
(11..=17).contains(&size) && (size % 2) == 1
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn HasValidSize(bitMatrix: &BitMatrix) -> bool {
|
pub fn HasValidSize(bitMatrix: &BitMatrix) -> bool {
|
||||||
let size = bitMatrix.height();
|
let size = bitMatrix.height();
|
||||||
Self::HasMicroSize(bitMatrix) || (size >= 21 && size <= 177 && (size % 4) == 1)
|
Self::HasMicroSize(bitMatrix) || ((21..=177).contains(&size) && (size % 4) == 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn Number(bitMatrix: &BitMatrix) -> u32 {
|
pub fn Number(bitMatrix: &BitMatrix) -> u32 {
|
||||||
|
|||||||
@@ -17,8 +17,6 @@ use crate::qrcode::cpp_port::bitmatrix_parser::{
|
|||||||
use crate::qrcode::decoder::{DataBlock, ErrorCorrectionLevel, Mode, Version};
|
use crate::qrcode::decoder::{DataBlock, ErrorCorrectionLevel, Mode, Version};
|
||||||
use crate::Exceptions;
|
use crate::Exceptions;
|
||||||
|
|
||||||
use super::Type;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Given data and error-correction codewords received, possibly corrupted by errors, attempts to
|
* <p>Given data and error-correction codewords received, possibly corrupted by errors, attempts to
|
||||||
* correct the errors in-place using Reed-Solomon error correction.</p>
|
* correct the errors in-place using Reed-Solomon error correction.</p>
|
||||||
|
|||||||
Reference in New Issue
Block a user