Skip to content

Commit 96540ce

Browse files
authored
Merge pull request #10 from akx/improvements
Small improvements
2 parents 8d68592 + e4ad28c commit 96540ce

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/encode_hints.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use rxing::{datamatrix::encoder::SymbolShapeHint, Dimension};
2-
use std::collections::{HashMap, HashSet};
2+
use std::collections::{HashMap};
33
use wasm_bindgen::prelude::*;
44

55
#[wasm_bindgen]

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ pub fn decode_barcode(
325325
/// Such an object could be obtained using the `getImageData`
326326
/// method of a `CanvasRenderingContext2D` object.
327327
pub fn convert_js_image_to_luma(data: &[u8]) -> Vec<u8> {
328-
let mut luma_data = Vec::new();
328+
let mut luma_data = Vec::with_capacity(data.len() / 4);
329329
for src_pixel in data.chunks_exact(4) {
330330
let [red, green, blue, alpha] = src_pixel else {
331331
continue;

0 commit comments

Comments
 (0)