fix clippy part1

This commit is contained in:
Irevoire 2022-10-26 15:14:46 +02:00 committed by Clément Renault
parent 2ba5e3b519
commit 8ec3681cf8
No known key found for this signature in database
GPG Key ID: 92ADA4E935E71FA4
6 changed files with 16 additions and 16 deletions

View File

@ -614,7 +614,7 @@ impl IndexScheduler {
fs::create_dir_all(&dst)?; fs::create_dir_all(&dst)?;
// TODO We can't use the open_auth_store_env function here but we should // TODO We can't use the open_auth_store_env function here but we should
let auth = milli::heed::EnvOpenOptions::new() let auth = milli::heed::EnvOpenOptions::new()
.map_size(1 * 1024 * 1024 * 1024) // 1 GiB .map_size(1024 * 1024 * 1024) // 1 GiB
.max_dbs(2) .max_dbs(2)
.open(&self.auth_path)?; .open(&self.auth_path)?;
auth.copy_to_path(dst.join("data.mdb"), CompactionOption::Enabled)?; auth.copy_to_path(dst.join("data.mdb"), CompactionOption::Enabled)?;

View File

@ -2643,7 +2643,7 @@ mod tests {
}}"#, }}"#,
i, i i, i
); );
let allow_index_creation = if i % 2 == 0 { false } else { true }; let allow_index_creation = i % 2 != 0;
let (uuid, mut file) = index_scheduler.create_update_file_with_uuid(i).unwrap(); let (uuid, mut file) = index_scheduler.create_update_file_with_uuid(i).unwrap();
let documents_count = meilisearch_types::document_formats::read_json( let documents_count = meilisearch_types::document_formats::read_json(
@ -2703,7 +2703,7 @@ mod tests {
}}"#, }}"#,
i, i i, i
); );
let allow_index_creation = if i % 2 == 0 { false } else { true }; let allow_index_creation = i % 2 != 0;
let (uuid, mut file) = index_scheduler.create_update_file_with_uuid(i).unwrap(); let (uuid, mut file) = index_scheduler.create_update_file_with_uuid(i).unwrap();
let documents_count = meilisearch_types::document_formats::read_json( let documents_count = meilisearch_types::document_formats::read_json(

View File

@ -40,20 +40,20 @@ pub async fn swap_indexes(
return Err(MeilisearchHttpError::SwapIndexPayloadWrongLength(indexes).into()); return Err(MeilisearchHttpError::SwapIndexPayloadWrongLength(indexes).into());
} }
}; };
if !search_rules.is_index_authorized(&lhs) { if !search_rules.is_index_authorized(lhs) {
unauthorized_indexes.insert(lhs.clone()); unauthorized_indexes.insert(lhs.clone());
} }
if !search_rules.is_index_authorized(&rhs) { if !search_rules.is_index_authorized(rhs) {
unauthorized_indexes.insert(rhs.clone()); unauthorized_indexes.insert(rhs.clone());
} }
match index_scheduler.index(&lhs) { match index_scheduler.index(lhs) {
Ok(_) => (), Ok(_) => (),
Err(index_scheduler::Error::IndexNotFound(_)) => { Err(index_scheduler::Error::IndexNotFound(_)) => {
unknown_indexes.insert(lhs.clone()); unknown_indexes.insert(lhs.clone());
} }
Err(e) => return Err(e.into()), Err(e) => return Err(e.into()),
} }
match index_scheduler.index(&rhs) { match index_scheduler.index(rhs) {
Ok(_) => (), Ok(_) => (),
Err(index_scheduler::Error::IndexNotFound(_)) => { Err(index_scheduler::Error::IndexNotFound(_)) => {
unknown_indexes.insert(rhs.clone()); unknown_indexes.insert(rhs.clone());

View File

@ -32,7 +32,7 @@ pub fn configure(cfg: &mut web::ServiceConfig) {
.service(web::resource("/{task_id}").route(web::get().to(SeqHandler(get_task)))); .service(web::resource("/{task_id}").route(web::get().to(SeqHandler(get_task))));
} }
#[derive(Debug, Clone, PartialEq, Serialize)] #[derive(Debug, Clone, PartialEq, Eq, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct TaskView { pub struct TaskView {
pub uid: TaskId, pub uid: TaskId,
@ -78,7 +78,7 @@ impl TaskView {
} }
} }
#[derive(Default, Debug, PartialEq, Clone, Serialize)] #[derive(Default, Debug, PartialEq, Eq, Clone, Serialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct DetailsView { pub struct DetailsView {
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]

View File

@ -34,7 +34,7 @@ pub struct Checked;
pub struct Unchecked; pub struct Unchecked;
#[cfg_attr(test, derive(proptest_derive::Arbitrary))] #[cfg_attr(test, derive(proptest_derive::Arbitrary))]
#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)] #[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq, Eq)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct MinWordSizeTyposSetting { pub struct MinWordSizeTyposSetting {
@ -47,7 +47,7 @@ pub struct MinWordSizeTyposSetting {
} }
#[cfg_attr(test, derive(proptest_derive::Arbitrary))] #[cfg_attr(test, derive(proptest_derive::Arbitrary))]
#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)] #[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq, Eq)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct TypoSettings { pub struct TypoSettings {
@ -66,7 +66,7 @@ pub struct TypoSettings {
} }
#[cfg_attr(test, derive(proptest_derive::Arbitrary))] #[cfg_attr(test, derive(proptest_derive::Arbitrary))]
#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)] #[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq, Eq)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct FacetingSettings { pub struct FacetingSettings {
@ -76,7 +76,7 @@ pub struct FacetingSettings {
} }
#[cfg_attr(test, derive(proptest_derive::Arbitrary))] #[cfg_attr(test, derive(proptest_derive::Arbitrary))]
#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)] #[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq, Eq)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct PaginationSettings { pub struct PaginationSettings {
@ -88,7 +88,7 @@ pub struct PaginationSettings {
/// Holds all the settings for an index. `T` can either be `Checked` if they represents settings /// Holds all the settings for an index. `T` can either be `Checked` if they represents settings
/// whose validity is guaranteed, or `Unchecked` if they need to be validated. In the later case, a /// whose validity is guaranteed, or `Unchecked` if they need to be validated. In the later case, a
/// call to `check` will return a `Settings<Checked>` from a `Settings<Unchecked>`. /// call to `check` will return a `Settings<Checked>` from a `Settings<Unchecked>`.
#[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq)] #[derive(Debug, Clone, Default, Serialize, Deserialize, PartialEq, Eq)]
#[serde(deny_unknown_fields)] #[serde(deny_unknown_fields)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
#[serde(bound(serialize = "T: Serialize", deserialize = "T: Deserialize<'static>"))] #[serde(bound(serialize = "T: Serialize", deserialize = "T: Deserialize<'static>"))]

View File

@ -134,7 +134,7 @@ pub enum KindWithContent {
SnapshotCreation, SnapshotCreation,
} }
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct IndexSwap { pub struct IndexSwap {
pub indexes: (String, String), pub indexes: (String, String),
@ -427,7 +427,7 @@ impl FromStr for Kind {
} }
} }
#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)] #[derive(Debug, PartialEq, Eq, Clone, Serialize, Deserialize)]
pub enum Details { pub enum Details {
DocumentAdditionOrUpdate { received_documents: u64, indexed_documents: Option<u64> }, DocumentAdditionOrUpdate { received_documents: u64, indexed_documents: Option<u64> },
SettingsUpdate { settings: Box<Settings<Unchecked>> }, SettingsUpdate { settings: Box<Settings<Unchecked>> },