mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-26 04:12:34 +00:00
cargo clippy --fix
This commit is contained in:
@@ -137,8 +137,8 @@ pub fn DecodeByteSegment(
|
||||
pub fn ToAlphaNumericChar(value: u32) -> Result<char> {
|
||||
let value = value as usize;
|
||||
/**
|
||||
* See ISO 18004:2006, 6.4.4 Table 5
|
||||
*/
|
||||
* See ISO 18004:2006, 6.4.4 Table 5
|
||||
*/
|
||||
const ALPHANUMERIC_CHARS: [char; 45] = [
|
||||
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
|
||||
'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
|
||||
@@ -301,15 +301,14 @@ pub fn DecodeBitStream(
|
||||
|
||||
let res = (|| {
|
||||
while !IsEndOfStream(&mut bits, version)? {
|
||||
let mode: Mode;
|
||||
if modeBitLength == 0 {
|
||||
mode = Mode::NUMERIC; // MicroQRCode version 1 is always NUMERIC and modeBitLength is 0
|
||||
let mode: Mode = if modeBitLength == 0 {
|
||||
Mode::NUMERIC // MicroQRCode version 1 is always NUMERIC and modeBitLength is 0
|
||||
} else {
|
||||
mode = Mode::CodecModeForBits(
|
||||
Mode::CodecModeForBits(
|
||||
bits.readBits(modeBitLength as usize)?,
|
||||
Some(version.isMicroQRCode()),
|
||||
)?;
|
||||
}
|
||||
)?
|
||||
};
|
||||
|
||||
match mode {
|
||||
Mode::FNC1_FIRST_POSITION => {
|
||||
|
||||
@@ -99,10 +99,9 @@ pub fn FindFinderPatterns(image: &BitMatrix, tryHarder: bool) -> FinderPatterns
|
||||
);
|
||||
|
||||
// make sure p is not 'inside' an already found pattern area
|
||||
if res
|
||||
if !res
|
||||
.iter()
|
||||
.find(|old| Point::distance(p, old.p) < (old.size as f32) / 2.0)
|
||||
.is_none()
|
||||
.any(|old| Point::distance(p, old.p) < (old.size as f32) / 2.0)
|
||||
{
|
||||
// if (FindIf(res, [p](const auto& old) { return distance(p, old) < old.size / 2; }) == res.end()) {
|
||||
let pattern = LocateConcentricPattern::<E2E, 5, 7>(
|
||||
@@ -149,8 +148,8 @@ pub fn GenerateFinderPatternSets(patterns: &mut FinderPatterns) -> FinderPattern
|
||||
* (((b).size as f64) / ((a).size as f64)).powi(2) //std::pow(double(b.size) / a.size, 2)
|
||||
};
|
||||
|
||||
let cosUpper: f64 = (45.0_f64 / 180.0 * 3.1415).cos(); // TODO: use c++20 std::numbers::pi_v
|
||||
let cosLower: f64 = (135.0_f64 / 180.0 * 3.1415).cos();
|
||||
let cosUpper: f64 = (45.0_f64 / 180.0 * std::f64::consts::PI).cos(); // TODO: use c++20 std::numbers::pi_v
|
||||
let cosLower: f64 = (135.0_f64 / 180.0 * std::f64::consts::PI).cos();
|
||||
|
||||
let nbPatterns = (patterns).len();
|
||||
|
||||
@@ -1014,12 +1013,13 @@ pub fn SampleMQR(image: &BitMatrix, fp: ConcentricPattern) -> Result<QRCodeDetec
|
||||
}
|
||||
|
||||
let mut formatInfoBits = 0;
|
||||
for i in 1..=15
|
||||
for info_coord in FORMAT_INFO_COORDS.iter().take(15 + 1).skip(1)
|
||||
// for i in 1..=15
|
||||
// for (int i = 1; i <= 15; ++i)
|
||||
{
|
||||
AppendBit(
|
||||
&mut formatInfoBits,
|
||||
image.get_point(mod2Pix.transform_point(Point::centered(FORMAT_INFO_COORDS[i]))),
|
||||
image.get_point(mod2Pix.transform_point(Point::centered(*info_coord))),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user