clippy + fmt

This commit is contained in:
marin postma 2021-06-23 14:48:33 +02:00
parent b000ae7614
commit 834995b130
No known key found for this signature in database
GPG key ID: 6088B7721C3E39F9
13 changed files with 78 additions and 53 deletions

View file

@ -24,8 +24,8 @@ use uuid_resolver::{error::UuidResolverError, UuidResolverHandle};
use crate::index::{Checked, Document, SearchQuery, SearchResult, Settings};
use crate::option::Opt;
use error::Result;
use crate::Payload;
use error::Result;
use self::dump_actor::load_dump;
use self::error::IndexControllerError;

View file

@ -137,7 +137,10 @@ where
.open(&path)
.await?;
async fn write_to_file<D>(file: &mut fs::File, mut payload: mpsc::Receiver<PayloadData<D>>) -> Result<usize>
async fn write_to_file<D>(
file: &mut fs::File,
mut payload: mpsc::Receiver<PayloadData<D>>,
) -> Result<usize>
where
D: AsRef<[u8]> + Sized + 'static,
{
@ -160,7 +163,7 @@ where
}
Err(e) => {
fs::remove_file(&path).await?;
return Err(e)
return Err(e);
}
_ => {
fs::remove_file(&path).await?;

View file

@ -52,11 +52,9 @@ impl ErrorCode for UpdateActorError {
UpdateActorError::IndexActor(e) => e.error_code(),
UpdateActorError::FatalUpdateStoreError => Code::Internal,
UpdateActorError::InvalidPayload(_) => Code::BadRequest,
UpdateActorError::PayloadError(error) => {
match error {
actix_http::error::PayloadError::Overflow => Code::PayloadTooLarge,
_ => Code::Internal,
}
UpdateActorError::PayloadError(error) => match error {
actix_http::error::PayloadError::Overflow => Code::PayloadTooLarge,
_ => Code::Internal,
},
}
}

View file

@ -572,7 +572,10 @@ fn update_uuid_to_file_path(root: impl AsRef<Path>, uuid: Uuid) -> PathBuf {
#[cfg(test)]
mod test {
use super::*;
use crate::index_controller::{UpdateResult, index_actor::{MockIndexActorHandle, error::IndexActorError}};
use crate::index_controller::{
index_actor::{error::IndexActorError, MockIndexActorHandle},
UpdateResult,
};
use futures::future::ok;
@ -651,7 +654,9 @@ mod test {
if processing.id() == 0 {
Box::pin(ok(Ok(processing.process(UpdateResult::Other))))
} else {
Box::pin(ok(Err(processing.fail(IndexActorError::ExistingPrimaryKey.into()))))
Box::pin(ok(Err(
processing.fail(IndexActorError::ExistingPrimaryKey.into())
)))
}
});

View file

@ -3,7 +3,10 @@ use milli::update::{DocumentAdditionResult, IndexDocumentsMethod, UpdateFormat};
use serde::{Deserialize, Serialize};
use uuid::Uuid;
use crate::{error::ResponseError, index::{Settings, Unchecked}};
use crate::{
error::ResponseError,
index::{Settings, Unchecked},
};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum UpdateResult {