Skip to content

Commit

Permalink
Fix some clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
piderman314 committed Nov 3, 2021
1 parent 2db480a commit 0713c8a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/decode/qr/correct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ fn calculate_syndromes(block: &[u8], block_info: &BlockInfo) -> (bool, Vec<GF8>)

let mut all_fine = true;
for i in 0..block_info.ec_cap * 2 {
syndromes[i as usize] = syndrome(&block, EXP8[i as usize]);
syndromes[i as usize] = syndrome(block, EXP8[i as usize]);
if syndromes[i as usize] != GF8(0) {
all_fine = false;
}
Expand Down
3 changes: 2 additions & 1 deletion src/detect/linescan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ impl Detect<GrayImage> for LineScan {
// Step 2
// Run the refinement functions on the candidate location
for (refine_func, dx, dy, is_diagonal) in &refine_func {
let vert = refine_func(&self, prepared, &finder, module_size);
let vert = refine_func(self, prepared, &finder, module_size);

if vert.is_none() {
last_pixel = p.channels()[0];
Expand Down Expand Up @@ -449,6 +449,7 @@ fn dist(one: &Point, other: &Point) -> f64 {
}

#[inline]
#[allow(clippy::manual_map)]
fn find_qr(one: &Point, two: &Point, three: &Point, module_size: f64) -> Option<QRLocation> {
// Try all three combinations of points to see if any of them are a QR
if let Some(qr) = find_qr_internal(one, two, three, module_size) {
Expand Down
2 changes: 1 addition & 1 deletion src/util/chomp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ impl Chomp {
/// If requesting fewer than 8 bits, the result will be in the least significant bits of the u8
pub fn chomp(&mut self, nr_bits: u8) -> Option<u8> {
let bit_count = BitCount(nr_bits as usize);
if nr_bits < 1 || nr_bits > 8 || bit_count > self.bits_left {
if !(1..=8).contains(&nr_bits) || bit_count > self.bits_left {
return None;
}

Expand Down

0 comments on commit 0713c8a

Please sign in to comment.