How can I do overflow check in all steps of a
fn somemath() -> u32 {
let x: u32 = y * 3 + 2;
return x
}
something similar to
fn somemath() -> u32 {
let x: u32 = y.checked_mul(3).checked_add(2)
return x
}
Or what is the best practice, to avoid overflow in such cases? In the end I need x to be not producing overflow and be a valid result or produce error and can the function return u32 if successfull?