mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-26 20:15:07 +08:00
make clippy happy 2
This commit is contained in:
parent
21253a2bcb
commit
4f6a6b1359
@ -33,6 +33,7 @@ pub struct SortResult {
|
|||||||
pub exhaustive_facets_count: Option<bool>,
|
pub exhaustive_facets_count: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::too_many_arguments)]
|
||||||
pub fn bucket_sort<'c, FI>(
|
pub fn bucket_sort<'c, FI>(
|
||||||
reader: &heed::RoTxn<MainT>,
|
reader: &heed::RoTxn<MainT>,
|
||||||
query: &str,
|
query: &str,
|
||||||
@ -192,6 +193,7 @@ where
|
|||||||
Ok(result)
|
Ok(result)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::too_many_arguments)]
|
||||||
pub fn bucket_sort_with_distinct<'c, FI, FD>(
|
pub fn bucket_sort_with_distinct<'c, FI, FD>(
|
||||||
reader: &heed::RoTxn<MainT>,
|
reader: &heed::RoTxn<MainT>,
|
||||||
query: &str,
|
query: &str,
|
||||||
|
@ -92,6 +92,7 @@ impl<'a> CriteriaBuilder<'a> {
|
|||||||
self.inner.reserve(additional)
|
self.inner.reserve(additional)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::should_implement_trait)]
|
||||||
pub fn add<C: 'a>(mut self, criterion: C) -> CriteriaBuilder<'a>
|
pub fn add<C: 'a>(mut self, criterion: C) -> CriteriaBuilder<'a>
|
||||||
where
|
where
|
||||||
C: Criterion,
|
C: Criterion,
|
||||||
|
@ -22,6 +22,7 @@ impl Criterion for Typo {
|
|||||||
// It is safe to panic on input number higher than 3,
|
// It is safe to panic on input number higher than 3,
|
||||||
// the number of typos is never bigger than that.
|
// the number of typos is never bigger than that.
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[allow(clippy::approx_constant)]
|
||||||
fn custom_log10(n: u8) -> f32 {
|
fn custom_log10(n: u8) -> f32 {
|
||||||
match n {
|
match n {
|
||||||
0 => 0.0, // log(1)
|
0 => 0.0, // log(1)
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#![allow(clippy::type_complexity)]
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate assert_matches;
|
extern crate assert_matches;
|
||||||
|
@ -19,6 +19,7 @@ impl QueryWordsMapper {
|
|||||||
QueryWordsMapper { originals, mappings: HashMap::new() }
|
QueryWordsMapper { originals, mappings: HashMap::new() }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::len_zero)]
|
||||||
pub fn declare<I, A>(&mut self, range: Range<usize>, id: QueryId, replacement: I)
|
pub fn declare<I, A>(&mut self, range: Range<usize>, id: QueryId, replacement: I)
|
||||||
where I: IntoIterator<Item = A>,
|
where I: IntoIterator<Item = A>,
|
||||||
A: ToString,
|
A: ToString,
|
||||||
|
@ -109,6 +109,7 @@ pub fn push_documents_addition<D: serde::Serialize>(
|
|||||||
Ok(last_update_id)
|
Ok(last_update_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::too_many_arguments)]
|
||||||
fn index_document<A>(
|
fn index_document<A>(
|
||||||
writer: &mut heed::RwTxn<MainT>,
|
writer: &mut heed::RwTxn<MainT>,
|
||||||
documents_fields: DocumentsFields,
|
documents_fields: DocumentsFields,
|
||||||
|
@ -43,6 +43,7 @@ pub struct LoggingMiddleware<S> {
|
|||||||
service: Rc<RefCell<S>>,
|
service: Rc<RefCell<S>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::type_complexity)]
|
||||||
impl<S, B> Service for LoggingMiddleware<S>
|
impl<S, B> Service for LoggingMiddleware<S>
|
||||||
where
|
where
|
||||||
S: Service<Request = ServiceRequest, Response = ServiceResponse<B>, Error = actix_web::Error> + 'static,
|
S: Service<Request = ServiceRequest, Response = ServiceResponse<B>, Error = actix_web::Error> + 'static,
|
||||||
|
@ -161,7 +161,7 @@ fn load_private_key(filename: PathBuf) -> Result<rustls::PrivateKey, Box<dyn err
|
|||||||
fn load_ocsp(filename: &Option<PathBuf>) -> Result<Vec<u8>, Box<dyn error::Error>> {
|
fn load_ocsp(filename: &Option<PathBuf>) -> Result<Vec<u8>, Box<dyn error::Error>> {
|
||||||
let mut ret = Vec::new();
|
let mut ret = Vec::new();
|
||||||
|
|
||||||
if let &Some(ref name) = filename {
|
if let Some(ref name) = filename {
|
||||||
fs::File::open(name)
|
fs::File::open(name)
|
||||||
.map_err(|_| "cannot open ocsp file")?
|
.map_err(|_| "cannot open ocsp file")?
|
||||||
.read_to_end(&mut ret)
|
.read_to_end(&mut ret)
|
||||||
|
@ -188,14 +188,12 @@ impl SearchQuery {
|
|||||||
for attr in &restricted_attributes {
|
for attr in &restricted_attributes {
|
||||||
final_attributes.insert(attr.to_string());
|
final_attributes.insert(attr.to_string());
|
||||||
}
|
}
|
||||||
} else {
|
} else if available_attributes.contains(attribute) {
|
||||||
if available_attributes.contains(attribute) {
|
|
||||||
final_attributes.insert(attribute.to_string());
|
final_attributes.insert(attribute.to_string());
|
||||||
} else {
|
} else {
|
||||||
warn!("The attributes {:?} present in attributesToHighlight parameter doesn't exist", attribute);
|
warn!("The attributes {:?} present in attributesToHighlight parameter doesn't exist", attribute);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
search_builder.attributes_to_highlight(final_attributes);
|
search_builder.attributes_to_highlight(final_attributes);
|
||||||
}
|
}
|
||||||
@ -246,6 +244,6 @@ fn prepare_facet_list(facets: &str, schema: &Schema, facet_attrs: &[FieldId]) ->
|
|||||||
}
|
}
|
||||||
Ok(field_ids)
|
Ok(field_ids)
|
||||||
}
|
}
|
||||||
bad_val => return Err(FacetCountError::unexpected_token(bad_val, &["[String]"]))
|
bad_val => Err(FacetCountError::unexpected_token(bad_val, &["[String]"]))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user