icu4x
icu4x copied to clipboard
FixedDecimal `*ed` methods should be infallible
This function is misleading:
pub fn concatenated_end(self, other: FixedDecimal) -> Result<Self, FixedDecimal>
In the error case, it returns other
, but it still throws away self
. It should probably return a tuple containing both FixedDecimals. It makes it tempting to write code such as mantissa.concatenated_end(fraction).unwrap_or_else(|fd| fd)
, which is wrong because it promotes fraction
when it should probably keep mantissa
and throw away fraction
.
I think we should delete this function since it is only sugar over concatenate_end
, which is harder to use incorrectly.