Skip to content

Commit

Permalink
Simplify lifetime uses in data/literal binary operators (#495)
Browse files Browse the repository at this point in the history
  • Loading branch information
panarch authored Mar 12, 2022
1 parent 1f7ad67 commit 69211eb
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions core/src/data/literal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ impl<'a> Literal<'a> {
}
}

pub fn add<'b>(&self, other: &Literal<'a>) -> Result<Literal<'b>> {
pub fn add(&self, other: &Literal<'a>) -> Result<Literal<'static>> {
match (self, other) {
(Number(l), Number(r)) => Ok(Number(Cow::Owned(l.as_ref() + r.as_ref()))),
(Interval(l), Interval(r)) => l.add(r).map(Interval),
Expand All @@ -150,7 +150,7 @@ impl<'a> Literal<'a> {
}
}

pub fn subtract<'b>(&self, other: &Literal<'a>) -> Result<Literal<'b>> {
pub fn subtract(&self, other: &Literal<'a>) -> Result<Literal<'static>> {
match (self, other) {
(Number(l), Number(r)) => Ok(Number(Cow::Owned(l.as_ref() - r.as_ref()))),
(Interval(l), Interval(r)) => l.subtract(r).map(Interval),
Expand All @@ -167,7 +167,7 @@ impl<'a> Literal<'a> {
}
}

pub fn multiply<'b>(&self, other: &Literal<'a>) -> Result<Literal<'b>> {
pub fn multiply(&self, other: &Literal<'a>) -> Result<Literal<'static>> {
match (self, other) {
(Number(l), Number(r)) => Ok(Number(Cow::Owned(l.as_ref() * r.as_ref()))),
(Number(l), Interval(r)) | (Interval(r), Number(l)) => {
Expand All @@ -192,7 +192,7 @@ impl<'a> Literal<'a> {
}
}

pub fn divide<'b>(&self, other: &Literal<'a>) -> Result<Literal<'b>> {
pub fn divide(&self, other: &Literal<'a>) -> Result<Literal<'static>> {
match (self, other) {
(Number(l), Number(r)) => {
if *r.as_ref() == 0.into() {
Expand Down Expand Up @@ -224,7 +224,7 @@ impl<'a> Literal<'a> {
}
}

pub fn modulo<'b>(&self, other: &Literal<'a>) -> Result<Literal<'b>> {
pub fn modulo(&self, other: &Literal<'a>) -> Result<Literal<'static>> {
match (self, other) {
(Number(l), Number(r)) => {
if *r.as_ref() == 0.into() {
Expand Down

0 comments on commit 69211eb

Please sign in to comment.