Update rust

This commit is contained in:
jude
2024-02-22 18:35:37 +00:00
parent 6c20bf2a0f
commit dd7e681285
8 changed files with 6 additions and 13 deletions
-4
View File
@@ -95,16 +95,12 @@ impl fmt::Display for Error {
trait OverflowOp: Sized {
fn mul(self, other: Self) -> Result<Self, Error>;
fn add(self, other: Self) -> Result<Self, Error>;
}
impl OverflowOp for u64 {
fn mul(self, other: Self) -> Result<Self, Error> {
self.checked_mul(other).ok_or(Error::NumberOverflow)
}
fn add(self, other: Self) -> Result<Self, Error> {
self.checked_add(other).ok_or(Error::NumberOverflow)
}
}
#[derive(Copy, Clone)]