From 8f63ec39dabf84930c020985512307c03c4ef268 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Wed, 9 Oct 2019 16:15:31 +0200 Subject: [PATCH] Unrestrict static lifetime of Criterion names --- meilidb-core/src/criterion/document_id.rs | 2 +- meilidb-core/src/criterion/exact.rs | 2 +- meilidb-core/src/criterion/mod.rs | 6 +++--- meilidb-core/src/criterion/number_of_words.rs | 2 +- meilidb-core/src/criterion/sort_by_attr.rs | 2 +- meilidb-core/src/criterion/sum_of_typos.rs | 2 +- meilidb-core/src/criterion/sum_of_words_attribute.rs | 2 +- meilidb-core/src/criterion/sum_of_words_position.rs | 2 +- meilidb-core/src/criterion/words_proximity.rs | 2 +- 9 files changed, 11 insertions(+), 11 deletions(-) diff --git a/meilidb-core/src/criterion/document_id.rs b/meilidb-core/src/criterion/document_id.rs index 34d0bd7f5..15549da24 100644 --- a/meilidb-core/src/criterion/document_id.rs +++ b/meilidb-core/src/criterion/document_id.rs @@ -10,7 +10,7 @@ impl Criterion for DocumentId { lhs.id.cmp(&rhs.id) } - fn name(&self) -> &'static str { + fn name(&self) -> &str { "DocumentId" } } diff --git a/meilidb-core/src/criterion/exact.rs b/meilidb-core/src/criterion/exact.rs index bde3ca733..820c35aa0 100644 --- a/meilidb-core/src/criterion/exact.rs +++ b/meilidb-core/src/criterion/exact.rs @@ -37,7 +37,7 @@ impl Criterion for Exact { lhs.cmp(&rhs).reverse() } - fn name(&self) -> &'static str { + fn name(&self) -> &str { "Exact" } } diff --git a/meilidb-core/src/criterion/mod.rs b/meilidb-core/src/criterion/mod.rs index 53a781e26..ad02d3023 100644 --- a/meilidb-core/src/criterion/mod.rs +++ b/meilidb-core/src/criterion/mod.rs @@ -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 Criterion for Box { (**self).evaluate(lhs, rhs) } - fn name(&self) -> &'static str { + fn name(&self) -> &str { (**self).name() } diff --git a/meilidb-core/src/criterion/number_of_words.rs b/meilidb-core/src/criterion/number_of_words.rs index 43095a066..641385fb1 100644 --- a/meilidb-core/src/criterion/number_of_words.rs +++ b/meilidb-core/src/criterion/number_of_words.rs @@ -25,7 +25,7 @@ impl Criterion for NumberOfWords { lhs.cmp(&rhs).reverse() } - fn name(&self) -> &'static str { + fn name(&self) -> &str { "NumberOfWords" } } diff --git a/meilidb-core/src/criterion/sort_by_attr.rs b/meilidb-core/src/criterion/sort_by_attr.rs index 68a5e5b69..c19062dd6 100644 --- a/meilidb-core/src/criterion/sort_by_attr.rs +++ b/meilidb-core/src/criterion/sort_by_attr.rs @@ -101,7 +101,7 @@ impl<'a> Criterion for SortByAttr<'a> { } } - fn name(&self) -> &'static str { + fn name(&self) -> &str { "SortByAttr" } } diff --git a/meilidb-core/src/criterion/sum_of_typos.rs b/meilidb-core/src/criterion/sum_of_typos.rs index 6736e6caa..9fbf0dab9 100644 --- a/meilidb-core/src/criterion/sum_of_typos.rs +++ b/meilidb-core/src/criterion/sum_of_typos.rs @@ -54,7 +54,7 @@ impl Criterion for SumOfTypos { lhs.cmp(&rhs).reverse() } - fn name(&self) -> &'static str { + fn name(&self) -> &str { "SumOfTypos" } } diff --git a/meilidb-core/src/criterion/sum_of_words_attribute.rs b/meilidb-core/src/criterion/sum_of_words_attribute.rs index d5787ef3a..2bf052159 100644 --- a/meilidb-core/src/criterion/sum_of_words_attribute.rs +++ b/meilidb-core/src/criterion/sum_of_words_attribute.rs @@ -36,7 +36,7 @@ impl Criterion for SumOfWordsAttribute { lhs.cmp(&rhs) } - fn name(&self) -> &'static str { + fn name(&self) -> &str { "SumOfWordsAttribute" } } diff --git a/meilidb-core/src/criterion/sum_of_words_position.rs b/meilidb-core/src/criterion/sum_of_words_position.rs index 13f26774c..d5dd10ab7 100644 --- a/meilidb-core/src/criterion/sum_of_words_position.rs +++ b/meilidb-core/src/criterion/sum_of_words_position.rs @@ -36,7 +36,7 @@ impl Criterion for SumOfWordsPosition { lhs.cmp(&rhs) } - fn name(&self) -> &'static str { + fn name(&self) -> &str { "SumOfWordsPosition" } } diff --git a/meilidb-core/src/criterion/words_proximity.rs b/meilidb-core/src/criterion/words_proximity.rs index 10f167bef..ed3775b50 100644 --- a/meilidb-core/src/criterion/words_proximity.rs +++ b/meilidb-core/src/criterion/words_proximity.rs @@ -99,7 +99,7 @@ impl Criterion for WordsProximity { lhs.cmp(&rhs) } - fn name(&self) -> &'static str { + fn name(&self) -> &str { "WordsProximity" } }