mirror of
https://github.com/starovoid/rxing.git
synced 2026-07-27 12:52:34 +00:00
remove more needless String conversions
This commit is contained in:
@@ -31,9 +31,9 @@ impl TokenType {
|
|||||||
match self {
|
match self {
|
||||||
TokenType::Simple(a) => a.appendTo(bit_array, text),
|
TokenType::Simple(a) => a.appendTo(bit_array, text),
|
||||||
TokenType::BinaryShift(a) => a.appendTo(bit_array, text),
|
TokenType::BinaryShift(a) => a.appendTo(bit_array, text),
|
||||||
TokenType::Empty => Err(Exceptions::illegalState(String::from(
|
TokenType::Empty => Err(Exceptions::illegalState(
|
||||||
"cannot appendTo on Empty final item",
|
"cannot appendTo on Empty final item",
|
||||||
))),
|
)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -300,9 +300,7 @@ pub fn urlDecode(encoded: &str) -> Result<String, Exceptions> {
|
|||||||
if let Ok(decoded) = decode(encoded) {
|
if let Ok(decoded) = decode(encoded) {
|
||||||
Ok(decoded.to_string())
|
Ok(decoded.to_string())
|
||||||
} else {
|
} else {
|
||||||
Err(Exceptions::illegalState(String::from(
|
Err(Exceptions::illegalState("UnsupportedEncodingException"))
|
||||||
"UnsupportedEncodingException",
|
|
||||||
)))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -124,9 +124,9 @@ fn model_year(c: char) -> Result<u32, Exceptions> {
|
|||||||
'V'..='Y' => Ok((c as u8 as u32 - b'V' as u32) + 1997),
|
'V'..='Y' => Ok((c as u8 as u32 - b'V' as u32) + 1997),
|
||||||
'1'..='9' => Ok((c as u8 as u32 - b'1' as u32) + 2001),
|
'1'..='9' => Ok((c as u8 as u32 - b'1' as u32) + 2001),
|
||||||
'A'..='D' => Ok((c as u8 as u32 - b'A' as u32) + 2010),
|
'A'..='D' => Ok((c as u8 as u32 - b'A' as u32) + 2010),
|
||||||
_ => Err(Exceptions::illegalArgument(String::from(
|
_ => Err(Exceptions::illegalArgument(
|
||||||
"model year argument out of range",
|
"model year argument out of range",
|
||||||
))),
|
)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -49,9 +49,7 @@ impl GenericGFPoly {
|
|||||||
*/
|
*/
|
||||||
pub fn new(field: GenericGFRef, coefficients: &[i32]) -> Result<Self, Exceptions> {
|
pub fn new(field: GenericGFRef, coefficients: &[i32]) -> Result<Self, Exceptions> {
|
||||||
if coefficients.is_empty() {
|
if coefficients.is_empty() {
|
||||||
return Err(Exceptions::illegalArgument(String::from(
|
return Err(Exceptions::illegalArgument("coefficients cannot be empty"));
|
||||||
"coefficients cannot be empty",
|
|
||||||
)));
|
|
||||||
}
|
}
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
field,
|
field,
|
||||||
|
|||||||
Reference in New Issue
Block a user