Unrestrict static lifetime of Criterion names

This commit is contained in:
Clément Renault 2019-10-09 16:15:31 +02:00
parent 5a1c1aeb02
commit 8f63ec39da
No known key found for this signature in database
GPG Key ID: 92ADA4E935E71FA4
9 changed files with 11 additions and 11 deletions

View File

@ -10,7 +10,7 @@ impl Criterion for DocumentId {
lhs.id.cmp(&rhs.id)
}
fn name(&self) -> &'static str {
fn name(&self) -> &str {
"DocumentId"
}
}

View File

@ -37,7 +37,7 @@ impl Criterion for Exact {
lhs.cmp(&rhs).reverse()
}
fn name(&self) -> &'static str {
fn name(&self) -> &str {
"Exact"
}
}

View File

@ -24,7 +24,7 @@ pub use self::{
pub trait Criterion: Send + Sync {
fn evaluate(&self, lhs: &RawDocument, rhs: &RawDocument) -> Ordering;
fn name(&self) -> &'static str;
fn name(&self) -> &str;
#[inline]
fn eq(&self, lhs: &RawDocument, rhs: &RawDocument) -> bool {
@ -37,7 +37,7 @@ impl<'a, T: Criterion + ?Sized + Send + Sync> Criterion for &'a T {
(**self).evaluate(lhs, rhs)
}
fn name(&self) -> &'static str {
fn name(&self) -> &str {
(**self).name()
}
@ -51,7 +51,7 @@ impl<T: Criterion + ?Sized> Criterion for Box<T> {
(**self).evaluate(lhs, rhs)
}
fn name(&self) -> &'static str {
fn name(&self) -> &str {
(**self).name()
}

View File

@ -25,7 +25,7 @@ impl Criterion for NumberOfWords {
lhs.cmp(&rhs).reverse()
}
fn name(&self) -> &'static str {
fn name(&self) -> &str {
"NumberOfWords"
}
}

View File

@ -101,7 +101,7 @@ impl<'a> Criterion for SortByAttr<'a> {
}
}
fn name(&self) -> &'static str {
fn name(&self) -> &str {
"SortByAttr"
}
}

View File

@ -54,7 +54,7 @@ impl Criterion for SumOfTypos {
lhs.cmp(&rhs).reverse()
}
fn name(&self) -> &'static str {
fn name(&self) -> &str {
"SumOfTypos"
}
}

View File

@ -36,7 +36,7 @@ impl Criterion for SumOfWordsAttribute {
lhs.cmp(&rhs)
}
fn name(&self) -> &'static str {
fn name(&self) -> &str {
"SumOfWordsAttribute"
}
}

View File

@ -36,7 +36,7 @@ impl Criterion for SumOfWordsPosition {
lhs.cmp(&rhs)
}
fn name(&self) -> &'static str {
fn name(&self) -> &str {
"SumOfWordsPosition"
}
}

View File

@ -99,7 +99,7 @@ impl Criterion for WordsProximity {
lhs.cmp(&rhs)
}
fn name(&self) -> &'static str {
fn name(&self) -> &str {
"WordsProximity"
}
}