issue-1224 Change to map_err instead of match
@@ -1230,8 +1230,7 @@ fn do_cformat_specifier(
}
Ok(format_spec.format_number(objint::get_value(&obj)))
}
- CFormatType::Float(_) => {
- let result = if objtype::isinstance(&obj, &vm.ctx.float_type()) {
+ CFormatType::Float(_) => if objtype::isinstance(&obj, &vm.ctx.float_type()) {
format_spec.format_float(objfloat::get_value(&obj))
} else if objtype::isinstance(&obj, &vm.ctx.int_type()) {
format_spec.format_float(objint::get_value(&obj).to_f64().unwrap())
@@ -1243,12 +1242,8 @@ fn do_cformat_specifier(
required_type_string,
obj.class()
)));
- };
- match result {
- Ok(transformed) => Ok(transformed),
- Err(error) => Err(vm.new_not_implemented_error(error)),
- }
}
+ .map_err(|e| vm.new_not_implemented_error(e)),
CFormatType::Character => {
let char_string = {
if objtype::isinstance(&obj, &vm.ctx.int_type()) {
