diff --git a/src/common/bit_array.rs b/src/common/bit_array.rs index a8bda06a..3379bf49 100644 --- a/src/common/bit_array.rs +++ b/src/common/bit_array.rs @@ -471,14 +471,11 @@ impl From<&BitArray> for Vec { } } -impl Into for Vec { - fn into(self) -> BitArray { - let mut new_array = BitArray::with_capacity(self.len()); - for (pos, byte) in self.into_iter().enumerate() { - match byte { - 0 => new_array.set(pos), - _ => {} - } +impl From> for BitArray { + fn from(val: Vec) -> Self { + let mut new_array = BitArray::with_capacity(val.len()); + for (pos, byte) in val.into_iter().enumerate() { + if byte == 0 { new_array.set(pos) } } new_array } diff --git a/src/datamatrix/encoder/error_correction.rs b/src/datamatrix/encoder/error_correction.rs index eb56a7c3..6fcda099 100644 --- a/src/datamatrix/encoder/error_correction.rs +++ b/src/datamatrix/encoder/error_correction.rs @@ -206,7 +206,7 @@ fn createECCBlock(codewords: &[u8], numECWords: usize) -> Result> { )) })?; - let poly = FACTORS[table as usize]; + let poly = FACTORS[table]; let mut ecc = vec![0u8; numECWords]; for codeword in codewords { let m = ecc[numECWords - 1] as usize ^ *codeword as usize;