mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
style: Use style::One for Integer to avoid implementing Mul.
Differential Revision: https://phabricator.services.mozilla.com/D76207
This commit is contained in:
parent
7022f451e1
commit
35546aea54
2 changed files with 6 additions and 10 deletions
|
@ -555,19 +555,15 @@ impl Zero for Integer {
|
|||
}
|
||||
}
|
||||
|
||||
impl num_traits::One for Integer {
|
||||
impl One for Integer {
|
||||
#[inline]
|
||||
fn one() -> Self {
|
||||
Self::new(1)
|
||||
}
|
||||
}
|
||||
|
||||
// This is not great, because it loses calc-ness, but it's necessary for One.
|
||||
impl ::std::ops::Mul<Integer> for Integer {
|
||||
type Output = Self;
|
||||
|
||||
fn mul(self, other: Self) -> Self {
|
||||
Self::new(self.value * other.value)
|
||||
#[inline]
|
||||
fn is_one(&self) -> bool {
|
||||
self.value() == 1
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue