Skip to content

Commit

Permalink
remove impls for borrowed types
Browse files Browse the repository at this point in the history
  • Loading branch information
rinde committed Mar 20, 2023
1 parent 5063aa1 commit 69ae433
Showing 1 changed file with 0 additions and 37 deletions.
37 changes: 0 additions & 37 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -683,12 +683,6 @@ impl TryFrom<Duration> for Time {
}
}

impl From<&Duration> for f64 {
fn from(num: &Duration) -> Self {
num.0 as f64
}
}

impl From<Duration> for f64 {
fn from(num: Duration) -> Self {
num.0 as f64
Expand Down Expand Up @@ -751,18 +745,6 @@ impl Sub<Time> for Time {
}
}

impl Sub<&Time> for Time {
type Output = Duration;

fn sub(self, rhs: &Time) -> Self::Output {
debug_assert!(
isize::try_from(self.0).is_ok() && isize::try_from(rhs.0).is_ok(),
"overflow detected: {self:?} - {rhs:?}"
);
Duration(self.0 as isize - rhs.0 as isize)
}
}

impl AddAssign<Duration> for Duration {
fn add_assign(&mut self, rhs: Duration) {
debug_assert!(
Expand Down Expand Up @@ -807,12 +789,6 @@ impl Sub<Duration> for Duration {
}
}

impl<'a> Sum<&'a Duration> for Duration {
fn sum<I: Iterator<Item = &'a Duration>>(iter: I) -> Self {
iter.copied().sum()
}
}

impl Mul<isize> for Duration {
type Output = Duration;

Expand Down Expand Up @@ -889,19 +865,6 @@ impl Div<Duration> for Duration {
}
}

impl Div<&Duration> for Duration {
type Output = f64;

fn div(self, rhs: &Duration) -> Self::Output {
debug_assert_ne!(
*rhs,
Duration::ZERO,
"Dividing by zero results in INF. This is probably not what you want."
);
self.0 as f64 / rhs.0 as f64
}
}

impl From<Duration> for std::time::Duration {
fn from(input: Duration) -> Self {
let secs = input.0 / 1000;
Expand Down

0 comments on commit 69ae433

Please sign in to comment.