mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-23 10:37:41 +08:00
📎 makes clippy happy
This commit is contained in:
parent
e6b806e0cf
commit
83e20027fd
@ -119,7 +119,7 @@ async fn get_tasks(
|
|||||||
// Then we complete the task filter with other potential status and types filters.
|
// Then we complete the task filter with other potential status and types filters.
|
||||||
let filters = if type_.is_some() || status.is_some() {
|
let filters = if type_.is_some() || status.is_some() {
|
||||||
let mut filters = indexes_filters.unwrap_or_default();
|
let mut filters = indexes_filters.unwrap_or_default();
|
||||||
filters.filter_fn(move |task| {
|
filters.filter_fn(Box::new(move |task| {
|
||||||
let matches_type = match &type_ {
|
let matches_type = match &type_ {
|
||||||
Some(types) => types
|
Some(types) => types
|
||||||
.iter()
|
.iter()
|
||||||
@ -135,7 +135,7 @@ async fn get_tasks(
|
|||||||
};
|
};
|
||||||
|
|
||||||
matches_type && matches_status
|
matches_type && matches_status
|
||||||
});
|
}));
|
||||||
Some(filters)
|
Some(filters)
|
||||||
} else {
|
} else {
|
||||||
indexes_filters
|
indexes_filters
|
||||||
|
@ -143,7 +143,7 @@ impl MetadataVersion {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, PartialEq, Clone)]
|
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Clone)]
|
||||||
#[serde(rename_all = "snake_case")]
|
#[serde(rename_all = "snake_case")]
|
||||||
pub enum DumpStatus {
|
pub enum DumpStatus {
|
||||||
Done,
|
Done,
|
||||||
|
@ -31,7 +31,7 @@ pub const DEFAULT_HIGHLIGHT_POST_TAG: fn() -> String = || "</em>".to_string();
|
|||||||
/// will be able to return in one search call.
|
/// will be able to return in one search call.
|
||||||
pub const DEFAULT_PAGINATION_MAX_TOTAL_HITS: usize = 1000;
|
pub const DEFAULT_PAGINATION_MAX_TOTAL_HITS: usize = 1000;
|
||||||
|
|
||||||
#[derive(Deserialize, Debug, Clone, PartialEq)]
|
#[derive(Deserialize, Debug, Clone, PartialEq, Eq)]
|
||||||
#[serde(rename_all = "camelCase", deny_unknown_fields)]
|
#[serde(rename_all = "camelCase", deny_unknown_fields)]
|
||||||
pub struct SearchQuery {
|
pub struct SearchQuery {
|
||||||
pub q: Option<String>,
|
pub q: Option<String>,
|
||||||
|
@ -31,10 +31,10 @@ where
|
|||||||
.serialize(s)
|
.serialize(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Default, Debug, Serialize, PartialEq)]
|
#[derive(Clone, Default, Debug, Serialize, PartialEq, Eq)]
|
||||||
pub struct Checked;
|
pub struct Checked;
|
||||||
|
|
||||||
#[derive(Clone, Default, Debug, Serialize, Deserialize, PartialEq)]
|
#[derive(Clone, Default, Debug, Serialize, Deserialize, PartialEq, Eq)]
|
||||||
pub struct Unchecked;
|
pub struct Unchecked;
|
||||||
|
|
||||||
#[cfg_attr(test, derive(proptest_derive::Arbitrary))]
|
#[cfg_attr(test, derive(proptest_derive::Arbitrary))]
|
||||||
|
@ -416,7 +416,7 @@ impl Scheduler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq, Eq)]
|
||||||
pub enum Processing {
|
pub enum Processing {
|
||||||
DocumentAdditions(Vec<TaskId>),
|
DocumentAdditions(Vec<TaskId>),
|
||||||
IndexUpdate(TaskId),
|
IndexUpdate(TaskId),
|
||||||
|
@ -128,7 +128,7 @@ impl Task {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
|
||||||
#[cfg_attr(test, derive(proptest_derive::Arbitrary))]
|
#[cfg_attr(test, derive(proptest_derive::Arbitrary))]
|
||||||
pub enum DocumentDeletion {
|
pub enum DocumentDeletion {
|
||||||
Clear,
|
Clear,
|
||||||
|
@ -22,11 +22,13 @@ pub use store::test::MockStore as Store;
|
|||||||
#[cfg(not(test))]
|
#[cfg(not(test))]
|
||||||
pub use store::Store;
|
pub use store::Store;
|
||||||
|
|
||||||
|
type FilterFn = Box<dyn Fn(&Task) -> bool + Sync + Send + 'static>;
|
||||||
|
|
||||||
/// Defines constraints to be applied when querying for Tasks from the store.
|
/// Defines constraints to be applied when querying for Tasks from the store.
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct TaskFilter {
|
pub struct TaskFilter {
|
||||||
indexes: Option<HashSet<String>>,
|
indexes: Option<HashSet<String>>,
|
||||||
filter_fn: Option<Box<dyn Fn(&Task) -> bool + Sync + Send + 'static>>,
|
filter_fn: Option<FilterFn>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl TaskFilter {
|
impl TaskFilter {
|
||||||
@ -51,8 +53,8 @@ impl TaskFilter {
|
|||||||
.insert(index);
|
.insert(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn filter_fn(&mut self, f: impl Fn(&Task) -> bool + Sync + Send + 'static) {
|
pub fn filter_fn(&mut self, f: FilterFn) {
|
||||||
self.filter_fn.replace(Box::new(f));
|
self.filter_fn.replace(f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -373,7 +373,7 @@ pub mod test {
|
|||||||
|
|
||||||
assert_eq!(tasks.len(), 1);
|
assert_eq!(tasks.len(), 1);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
&*tasks.first().as_ref().unwrap().index_uid().unwrap(),
|
tasks.first().as_ref().unwrap().index_uid().unwrap(),
|
||||||
"test"
|
"test"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ use std::str::FromStr;
|
|||||||
|
|
||||||
/// An index uid is composed of only ascii alphanumeric characters, - and _, between 1 and 400
|
/// An index uid is composed of only ascii alphanumeric characters, - and _, between 1 and 400
|
||||||
/// bytes long
|
/// bytes long
|
||||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
|
||||||
#[cfg_attr(feature = "test-traits", derive(proptest_derive::Arbitrary))]
|
#[cfg_attr(feature = "test-traits", derive(proptest_derive::Arbitrary))]
|
||||||
pub struct IndexUid(
|
pub struct IndexUid(
|
||||||
#[cfg_attr(feature = "test-traits", proptest(regex("[a-zA-Z0-9_-]{1,400}")))] String,
|
#[cfg_attr(feature = "test-traits", proptest(regex("[a-zA-Z0-9_-]{1,400}")))] String,
|
||||||
|
Loading…
Reference in New Issue
Block a user