From d9dca158e3b7da222110ffadd127f8e835116eed Mon Sep 17 00:00:00 2001 From: Project Nayuki Date: Mon, 23 Oct 2017 04:11:32 +0000 Subject: [PATCH] Simplified some Rust code by removing explicit type parameter but adding types to integer constants. --- rust/src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rust/src/lib.rs b/rust/src/lib.rs index 8e48e3c..f2cc055 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -153,7 +153,7 @@ impl QrCode { } assert_eq!(bb.len() % 8, 0, "Assertion error"); - let mut bytes: Vec = vec![0; bb.len() / 8]; + let mut bytes = vec![0u8; bb.len() / 8]; for (i, bit) in bb.iter().enumerate() { bytes[i >> 3] |= (*bit as u8) << (7 - (i & 7)); } @@ -633,7 +633,7 @@ impl QrCode { } else { // C-C-C-Combo breaker! 26 }; - let mut result: Vec = vec![6]; + let mut result = vec![6i32]; let mut pos: i32 = (ver as i32) * 4 + 10; for _ in 0 .. numalign - 1 { result.insert(1, pos); @@ -796,7 +796,7 @@ impl ReedSolomonGenerator { // Computes and returns the Reed-Solomon error correction codewords for the given sequence of data codewords. fn get_remainder(&self, data: &[u8]) -> Vec { // Compute the remainder by performing polynomial division - let mut result: Vec = vec![0; self.coefficients.len()]; + let mut result = vec![0u8; self.coefficients.len()]; for b in data { let factor: u8 = b ^ result.remove(0); result.push(0);