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

@@ -67,15 +67,13 @@ impl Writer for DataMatrixWriter {
if format != &BarcodeFormat::DATA_MATRIX {
return Err(Exceptions::IllegalArgumentException(Some(format!(
"Can only encode DATA_MATRIX, but got {:?}",
format
"Can only encode DATA_MATRIX, but got {format:?}"
))));
}
if width < 0 || height < 0 {
return Err(Exceptions::IllegalArgumentException(Some(format!(
"Requested dimensions can't be negative: {}x{}",
width, height
"Requested dimensions can't be negative: {width}x{height}"
))));
}

View File

@@ -218,7 +218,7 @@ fn decodeAsciiSegment(
result.append_char('0');
}
//result.append_char(char::from_u32(value).unwrap());
result.append_string(&format!("{}", value));
result.append_string(&format!("{value}"));
} else {
match oneByte {
230=> // Latch to C40 encodation

View File

@@ -74,8 +74,7 @@ impl Encoder for ASCIIEncoder {
_ => {
return Err(Exceptions::IllegalStateException(Some(format!(
"Illegal mode: {}",
newMode
"Illegal mode: {newMode}"
))));
}
}
@@ -106,8 +105,7 @@ impl ASCIIEncoder {
Ok((num + 130) as char)
} else {
Err(Exceptions::IllegalArgumentException(Some(format!(
"not digits: {}{}",
digit1, digit2
"not digits: {digit1}{digit2}"
))))
}
}

View File

@@ -66,8 +66,7 @@ impl Encoder for Base256Encoder {
buffer.insert(ci_pos, char::from_u32(dataCount as u32 % 250).unwrap());
} else {
return Err(Exceptions::IllegalStateException(Some(format!(
"Message length not in valid ranges: {}",
dataCount
"Message length not in valid ranges: {dataCount}"
))));
}
}

View File

@@ -275,7 +275,7 @@ mod test_placement {
let actual = placement.toBitFieldStringArray();
for i in 0..actual.len() {
// for (int i = 0; i < actual.length; i++) {
assert_eq!(expected[i], actual[i], "Row {}", i);
assert_eq!(expected[i], actual[i], "Row {i}");
}
}

View File

@@ -221,8 +221,7 @@ fn createECCBlock(codewords: &str, numECWords: usize) -> Result<String, Exceptio
}
if table < 0 {
return Err(Exceptions::IllegalArgumentException(Some(format!(
"Illegal number of error correction codewords specified: {}",
numECWords
"Illegal number of error correction codewords specified: {numECWords}"
))));
}
let poly = &FACTORS[table as usize];

View File

@@ -603,7 +603,6 @@ pub fn illegalCharacter(c: char) -> Result<(), Exceptions> {
// let hex = Integer.toHexString(c);
// hex = "0000".substring(0, 4 - hex.length()) + hex;
Err(Exceptions::IllegalArgumentException(Some(format!(
"Illegal character: {} (0x{})",
c, c
"Illegal character: {c} (0x{c})"
))))
}

View File

@@ -640,8 +640,7 @@ fn encodeMinimally(input: Rc<Input>) -> Result<RXingResult, Exceptions> {
if minimalJ < 0 {
return Err(Exceptions::IllegalStateException(Some(format!(
"Internal error: failed to encode \"{}\"",
input
"Internal error: failed to encode \"{input}\""
))));
}
RXingResult::new(edges[inputLength][minimalJ as usize].clone())

View File

@@ -346,8 +346,7 @@ impl<'a> SymbolInfoLookup<'a> {
}
if fail {
return Err(Exceptions::IllegalArgumentException(Some(format!(
"Can't find a symbol arrangement that matches the message. Data codewords: {}",
dataCodewords
"Can't find a symbol arrangement that matches the message. Data codewords: {dataCodewords}"
))));
}
Ok(None)