Unverified Commit 5571724f authored by honeywest's avatar honeywest Committed by GitHub
Browse files

Fix prelude0421 (#775)

* add arithmetic test

* optimize code
parent c2e43fc6
Pipeline #135536 passed with stages
in 28 minutes and 28 seconds
......@@ -218,6 +218,10 @@ mod tests {
u64::max_value(),
Saturating::saturating_mul(u64::max_value(), 2)
);
assert_eq!(
i64::max_value(),
Saturating::saturating_mul(i64::max_value(), 2)
);
assert_eq!(
i64::min_value(),
Saturating::saturating_mul(i64::min_value(), 2)
......
......@@ -202,7 +202,7 @@ impl Add<u64> for Key {
}
}
impl<'a> Add<u64> for &'a Key {
impl Add<u64> for &Key {
type Output = Key;
fn add(self, rhs: u64) -> Self::Output {
......@@ -210,19 +210,19 @@ impl<'a> Add<u64> for &'a Key {
}
}
impl<'a> Add<&'a u64> for Key {
impl Add<&u64> for Key {
type Output = Key;
fn add(self, rhs: &'a u64) -> Self::Output {
fn add(self, rhs: &u64) -> Self::Output {
<Key as Add<u64>>::add(self, *rhs)
}
}
impl<'a, 'b> Add<&'b u64> for &'a Key {
impl Add<&u64> for &Key {
type Output = Key;
fn add(self, rhs: &'b u64) -> Self::Output {
<&'a Key as Add<u64>>::add(self, *rhs)
fn add(self, rhs: &u64) -> Self::Output {
<&Key as Add<u64>>::add(self, *rhs)
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment