cargo clippy --fix

This commit is contained in:
Henry Schimke
2023-01-27 15:24:24 -06:00
parent 58e6827e89
commit 42d40de755
86 changed files with 196 additions and 335 deletions

View File

@@ -37,8 +37,7 @@ impl BitMatrixParser {
let dimension = bit_matrix.getHeight();
if dimension < 21 || (dimension & 0x03) != 1 {
Err(Exceptions::FormatException(Some(format!(
"{} < 21 || ({} % 0x03) != 1",
dimension, dimension
"{dimension} < 21 || ({dimension} % 0x03) != 1"
))))
} else {
Ok(Self {

View File

@@ -231,8 +231,7 @@ impl TryFrom<u8> for DataMask {
6 => Ok(DataMask::DATA_MASK_110),
7 => Ok(DataMask::DATA_MASK_111),
_ => Err(Exceptions::IllegalArgumentException(Some(format!(
"{} is not between 0 and 7",
value
"{value} is not between 0 and 7"
)))),
}
}

View File

@@ -98,7 +98,7 @@ fn testMask(mask: DataMask, dimension: u32, condition: MaskCondition) {
// for (int i = 0; i < dimension; i++) {
for j in 0..dimension {
// for (int j = 0; j < dimension; j++) {
assert_eq!(condition(i, j), bits.get(j, i), "({},{})", i, j);
assert_eq!(condition(i, j), bits.get(j, i), "({i},{j})");
}
}
}

View File

@@ -96,8 +96,7 @@ pub fn decode(
currentCharacterSetECI = Some(CharacterSetECI::getCharacterSetECIByValue(value)?);
if currentCharacterSetECI.is_none() {
return Err(Exceptions::FormatException(Some(format!(
"Value of {} not valid",
value
"Value of {value} not valid"
))));
}
}

View File

@@ -48,8 +48,7 @@ impl ErrorCorrectionLevel {
2 => Ok(Self::H),
3 => Ok(Self::Q),
_ => Err(Exceptions::IllegalArgumentException(Some(format!(
"{} is not a valid bit selection",
bits
"{bits} is not a valid bit selection"
)))),
}
}
@@ -111,8 +110,7 @@ impl FromStr for ErrorCorrectionLevel {
}
return Err(Exceptions::IllegalArgumentException(Some(format!(
"could not parse {} into an ec level",
s
"could not parse {s} into an ec level"
))));
}
}

View File

@@ -69,8 +69,7 @@ impl Mode {
Ok(Self::HANZI)
}
_ => Err(Exceptions::IllegalArgumentException(Some(format!(
"{} is not valid",
bits
"{bits} is not valid"
)))),
}
}