mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-26 20:32:34 +00:00
clippy --fix
This commit is contained in:
@@ -30,21 +30,21 @@ use super::{GenericGF, GenericGFPoly};
|
|||||||
#[test]
|
#[test]
|
||||||
fn testPolynomialString() {
|
fn testPolynomialString() {
|
||||||
let FIELD = super::get_predefined_genericgf(super::PredefinedGenericGF::QrCodeField256);
|
let FIELD = super::get_predefined_genericgf(super::PredefinedGenericGF::QrCodeField256);
|
||||||
let fz = super::GenericGFPoly::new(FIELD, &vec![0; 1]).unwrap();
|
let fz = super::GenericGFPoly::new(FIELD, &[0; 1]).unwrap();
|
||||||
|
|
||||||
assert_eq!("0", fz.getZero().to_string());
|
assert_eq!("0", fz.getZero().to_string());
|
||||||
let n1mono = GenericGF::buildMonomial(FIELD, 0, -1);
|
let n1mono = GenericGF::buildMonomial(FIELD, 0, -1);
|
||||||
assert_eq!("-1", n1mono.to_string());
|
assert_eq!("-1", n1mono.to_string());
|
||||||
let p = GenericGFPoly::new(FIELD, &vec![3, 0, -2, 1, 1]).unwrap();
|
let p = GenericGFPoly::new(FIELD, &[3, 0, -2, 1, 1]).unwrap();
|
||||||
assert_eq!("a^25x^4 - ax^2 + x + 1", p.to_string());
|
assert_eq!("a^25x^4 - ax^2 + x + 1", p.to_string());
|
||||||
let p = GenericGFPoly::new(FIELD, &vec![3]).unwrap();
|
let p = GenericGFPoly::new(FIELD, &[3]).unwrap();
|
||||||
assert_eq!("a^25", p.to_string());
|
assert_eq!("a^25", p.to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn testZero() {
|
fn testZero() {
|
||||||
let FIELD = super::get_predefined_genericgf(super::PredefinedGenericGF::QrCodeField256);
|
let FIELD = super::get_predefined_genericgf(super::PredefinedGenericGF::QrCodeField256);
|
||||||
let fz = super::GenericGFPoly::new(FIELD, &vec![0; 1]).unwrap();
|
let fz = super::GenericGFPoly::new(FIELD, &[0; 1]).unwrap();
|
||||||
|
|
||||||
assert_eq!(fz.getZero(), GenericGF::buildMonomial(FIELD, 1, 0));
|
assert_eq!(fz.getZero(), GenericGF::buildMonomial(FIELD, 1, 0));
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ impl GenericGF {
|
|||||||
*/
|
*/
|
||||||
pub fn buildMonomial(source: GenericGFRef, degree: usize, coefficient: i32) -> GenericGFPoly {
|
pub fn buildMonomial(source: GenericGFRef, degree: usize, coefficient: i32) -> GenericGFPoly {
|
||||||
if coefficient == 0 {
|
if coefficient == 0 {
|
||||||
return GenericGFPoly::new(source, &vec![0]).unwrap();
|
return GenericGFPoly::new(source, &[0]).unwrap();
|
||||||
}
|
}
|
||||||
let mut coefficients = vec![0; degree + 1];
|
let mut coefficients = vec![0; degree + 1];
|
||||||
coefficients[0] = coefficient;
|
coefficients[0] = coefficient;
|
||||||
|
|||||||
@@ -222,11 +222,11 @@ impl GenericGFPoly {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn getZero(&self) -> Self {
|
pub fn getZero(&self) -> Self {
|
||||||
GenericGFPoly::new(self.field, &vec![0]).unwrap()
|
GenericGFPoly::new(self.field, &[0]).unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn getOne(&self) -> Self {
|
pub fn getOne(&self) -> Self {
|
||||||
GenericGFPoly::new(self.field, &vec![1]).unwrap()
|
GenericGFPoly::new(self.field, &[1]).unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn multiply_by_monomial(
|
pub fn multiply_by_monomial(
|
||||||
|
|||||||
@@ -54,10 +54,8 @@ impl ReedSolomonEncoder {
|
|||||||
.multiply(
|
.multiply(
|
||||||
&GenericGFPoly::new(
|
&GenericGFPoly::new(
|
||||||
self.field,
|
self.field,
|
||||||
&vec![
|
&[1,
|
||||||
1,
|
self.field.exp(d as i32 - 1 + self.field.getGeneratorBase())],
|
||||||
self.field.exp(d as i32 - 1 + self.field.getGeneratorBase()),
|
|
||||||
],
|
|
||||||
)
|
)
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -309,9 +309,7 @@ fn getBarcodeMetadata<T: DetectionRXingResultRowIndicatorColumn>(
|
|||||||
// return leftBarcodeMetadata;
|
// return leftBarcodeMetadata;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
if leftBarcodeMetadata.is_none() {
|
leftBarcodeMetadata?;
|
||||||
return None;
|
|
||||||
}
|
|
||||||
|
|
||||||
if leftBarcodeMetadata.as_ref().unwrap().getColumnCount()
|
if leftBarcodeMetadata.as_ref().unwrap().getColumnCount()
|
||||||
!= rightBarcodeMetadata.as_ref().unwrap().getColumnCount()
|
!= rightBarcodeMetadata.as_ref().unwrap().getColumnCount()
|
||||||
|
|||||||
Reference in New Issue
Block a user