remove .to_owned() calls on &str in exceptions

This commit is contained in:
Vukašin Stepanović
2023-02-15 11:03:27 +00:00
parent 722ce78fd0
commit 528ddea41c
47 changed files with 107 additions and 167 deletions

View File

@@ -188,13 +188,13 @@ pub fn encode_bytes_with_charset(
stuffed_bits = stuffBits(&bits, word_size as usize)?;
if stuffed_bits.getSize() as u32 + ecc_bits > usable_bits_in_layers {
return Err(Exceptions::illegalArgument(
"Data to large for user specified layer".to_owned(),
"Data to large for user specified layer",
));
}
if compact && stuffed_bits.getSize() as u32 > word_size * 64 {
// Compact format only allows 64 data words, though C4 can hold more words than that
return Err(Exceptions::illegalArgument(
"Data to large for user specified layer".to_owned(),
"Data to large for user specified layer",
));
}
} else {
@@ -208,7 +208,7 @@ pub fn encode_bytes_with_charset(
// for (int i = 0; ; i++) {
if i > MAX_NB_BITS {
return Err(Exceptions::illegalArgument(
"Data too large for an Aztec code".to_owned(),
"Data too large for an Aztec code",
));
}
compact = i <= 3;

View File

@@ -248,9 +248,7 @@ impl HighLevelEncoder {
initial_state = initial_state.appendFLGn(CharacterSetECI::getValue(&eci))?;
}
} else {
return Err(Exceptions::illegalArgument(
"No ECI code for character set".to_owned(),
));
return Err(Exceptions::illegalArgument("No ECI code for character set"));
}
// if self.charset != null {
// CharacterSetECI eci = CharacterSetECI.getCharacterSetECI(charset);

View File

@@ -81,7 +81,7 @@ impl State {
} else */
if eci > 999999 {
return Err(Exceptions::illegalArgument(
"ECI code must be between 0 and 999999".to_owned(),
"ECI code must be between 0 and 999999",
));
// throw new IllegalArgumentException("ECI code must be between 0 and 999999");
} else {