remove even more needless string conversions

This commit is contained in:
Vukašin Stepanović
2023-02-15 11:25:01 +00:00
parent df8828331d
commit bfcdb397ad
3 changed files with 6 additions and 6 deletions

View File

@@ -164,7 +164,7 @@ fn get_encoded_data(corrected_bits: &[bool]) -> Result<String, Exceptions> {
result.push_str(
&encdr
.decode(&decoded_bytes, encoding::DecoderTrap::Strict)
.map_err(|a| Exceptions::illegalState(a.to_string()))?,
.map_err(|a| Exceptions::illegalState(a))?,
);
decoded_bytes.clear();

View File

@@ -755,7 +755,7 @@ fn decodeBase256Segment(
result.append_string(
&encoding::all::ISO_8859_1
.decode(&bytes, encoding::DecoderTrap::Strict)
.map_err(|e| Exceptions::parse(e.to_string()))?,
.map_err(|e| Exceptions::parse(e))?,
);
byteSegments.push(bytes);

View File

@@ -103,7 +103,7 @@ pub fn decode(
// for (int i = 0; i < errorLocations.length; i++) {
let position = received.len() as isize - 1 - field.log(errorLocations[i])? as isize;
if position < 0 {
return Err(Exceptions::checksum(file!().to_string()));
return Err(Exceptions::checksum(file!()));
}
received[position as usize] =
field.subtract(received[position as usize], errorMagnitudes[i]);
@@ -140,7 +140,7 @@ fn runEuclideanAlgorithm(
// Divide rLastLast by rLast, with quotient in q and remainder in r
if rLast.isZero() {
// Oops, Euclidean algorithm already terminated?
return Err(Exceptions::checksum(file!().to_string()));
return Err(Exceptions::checksum(file!()));
}
r = rLastLast;
let mut q = ModulusPoly::getZero(field); //field.getZero();
@@ -162,7 +162,7 @@ fn runEuclideanAlgorithm(
let sigmaTildeAtZero = t.getCoefficient(0);
if sigmaTildeAtZero == 0 {
return Err(Exceptions::checksum(file!().to_string()));
return Err(Exceptions::checksum(file!()));
}
let inverse = field.inverse(sigmaTildeAtZero)?;
@@ -190,7 +190,7 @@ fn findErrorLocations(
i += 1;
}
if e != numErrors {
return Err(Exceptions::checksum(file!().to_string()));
return Err(Exceptions::checksum(file!()));
}
Ok(result)
}