diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 8020ead32..5a8403d6d 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -65,3 +65,17 @@ jobs: with: command: clippy args: --all-targets -- --deny warnings + + fmt: + name: Run Rustfmt + runs-on: ubuntu-18.04 + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: nightly + override: true + components: rustfmt + - name: Run cargo fmt + run: cargo fmt --all -- --check diff --git a/meilisearch-http/src/extractors/authentication/error.rs b/meilisearch-http/src/extractors/authentication/error.rs index 29578e373..902634045 100644 --- a/meilisearch-http/src/extractors/authentication/error.rs +++ b/meilisearch-http/src/extractors/authentication/error.rs @@ -23,4 +23,3 @@ impl ErrorCode for AuthenticationError { } } } - diff --git a/meilisearch-http/src/index_controller/update_actor/actor.rs b/meilisearch-http/src/index_controller/update_actor/actor.rs index 51e8cb28c..8ba96dad1 100644 --- a/meilisearch-http/src/index_controller/update_actor/actor.rs +++ b/meilisearch-http/src/index_controller/update_actor/actor.rs @@ -6,7 +6,7 @@ use std::sync::Arc; use async_stream::stream; use futures::StreamExt; -use log::{trace}; +use log::trace; use oxidized_json_checker::JsonChecker; use tokio::fs; use tokio::io::AsyncWriteExt; diff --git a/meilisearch-http/src/routes/document.rs b/meilisearch-http/src/routes/document.rs index 5f0d1d1fa..418c67462 100644 --- a/meilisearch-http/src/routes/document.rs +++ b/meilisearch-http/src/routes/document.rs @@ -33,16 +33,16 @@ guard_content_type!(guard_json, "application/json"); */ fn guard_json(head: &actix_web::dev::RequestHead) -> bool { - if let Some(content_type) = head.headers.get("Content-Type") { - content_type - .to_str() - .map(|v| v.contains("application/json")) - .unwrap_or(false) - } else { - // if no content-type is specified we still accept the data as json! - true - } - } + if let Some(content_type) = head.headers.get("Content-Type") { + content_type + .to_str() + .map(|v| v.contains("application/json")) + .unwrap_or(false) + } else { + // if no content-type is specified we still accept the data as json! + true + } +} #[derive(Deserialize)] struct DocumentParam { diff --git a/meilisearch-http/src/routes/dump.rs b/meilisearch-http/src/routes/dump.rs index e506755a1..1f987a588 100644 --- a/meilisearch-http/src/routes/dump.rs +++ b/meilisearch-http/src/routes/dump.rs @@ -1,5 +1,5 @@ -use log::debug; use actix_web::{web, HttpResponse}; +use log::debug; use serde::{Deserialize, Serialize}; use crate::error::ResponseError; diff --git a/meilisearch-http/src/routes/index.rs b/meilisearch-http/src/routes/index.rs index eb8da92ed..badbdcc10 100644 --- a/meilisearch-http/src/routes/index.rs +++ b/meilisearch-http/src/routes/index.rs @@ -21,12 +21,11 @@ pub fn services(cfg: &mut web::ServiceConfig) { .route(web::delete().to(delete_index)), ) .service( - web::resource("/indexes/{index_uid}/updates") - .route(web::get().to(get_all_updates_status)) + web::resource("/indexes/{index_uid}/updates").route(web::get().to(get_all_updates_status)), ) .service( web::resource("/indexes/{index_uid}/updates/{update_id}") - .route(web::get().to(get_update_status)) + .route(web::get().to(get_update_status)), ); } diff --git a/meilisearch-http/src/routes/search.rs b/meilisearch-http/src/routes/search.rs index 7307a5990..31a7dbd03 100644 --- a/meilisearch-http/src/routes/search.rs +++ b/meilisearch-http/src/routes/search.rs @@ -1,7 +1,7 @@ use std::collections::{BTreeSet, HashSet}; -use log::debug; use actix_web::{web, HttpResponse}; +use log::debug; use serde::Deserialize; use serde_json::Value; diff --git a/meilisearch-http/src/routes/settings.rs b/meilisearch-http/src/routes/settings.rs index 6a8d9cca5..812e37b58 100644 --- a/meilisearch-http/src/routes/settings.rs +++ b/meilisearch-http/src/routes/settings.rs @@ -1,5 +1,5 @@ -use log::debug; use actix_web::{web, HttpResponse}; +use log::debug; use crate::extractors::authentication::{policies::*, GuardedData}; use crate::index::Settings; diff --git a/meilisearch-http/src/routes/stats.rs b/meilisearch-http/src/routes/stats.rs index e440ce8ff..a0078d76a 100644 --- a/meilisearch-http/src/routes/stats.rs +++ b/meilisearch-http/src/routes/stats.rs @@ -1,5 +1,5 @@ -use log::debug; use actix_web::{web, HttpResponse}; +use log::debug; use serde::Serialize; use crate::error::ResponseError;