Remove unwrap logic

This commit is contained in:
Bruno Carvalhal
2024-11-17 16:36:13 +01:00
committed by Nicolás Hatcher Andrés
parent e130f784fd
commit be6819fec3

View File

@@ -372,16 +372,19 @@ impl Model {
} }
}; };
if s.len() == 0 { match s.chars().next() {
return CalcResult::Error { Some(c) => {
error: Error::VALUE, let unicode_number = c as u32;
origin: cell, return CalcResult::Number(unicode_number as f64);
message: "Empty cell".to_string(), }
}; None => {
return CalcResult::Error {
error: Error::VALUE,
origin: cell,
message: "Empty cell".to_string(),
};
}
} }
let unicode_number = s.chars().nth(0).unwrap() as u32;
return CalcResult::Number(unicode_number as f64);
} }
CalcResult::new_args_number_error(cell) CalcResult::new_args_number_error(cell)
} }