diff --git a/src/encode_hints.rs b/src/encode_hints.rs index 84b8648..e9c11e2 100644 --- a/src/encode_hints.rs +++ b/src/encode_hints.rs @@ -1,5 +1,5 @@ use rxing::{datamatrix::encoder::SymbolShapeHint, Dimension}; -use std::collections::{HashMap, HashSet}; +use std::collections::{HashMap}; use wasm_bindgen::prelude::*; #[wasm_bindgen] diff --git a/src/lib.rs b/src/lib.rs index d750388..5907e44 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -325,7 +325,7 @@ pub fn decode_barcode( /// Such an object could be obtained using the `getImageData` /// method of a `CanvasRenderingContext2D` object. pub fn convert_js_image_to_luma(data: &[u8]) -> Vec { - let mut luma_data = Vec::new(); + let mut luma_data = Vec::with_capacity(data.len() / 4); for src_pixel in data.chunks_exact(4) { let [red, green, blue, alpha] = src_pixel else { continue;