mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-26 03:55:07 +08:00
run rustfmt one the whole project and add it to the CI
This commit is contained in:
parent
de9ea94f57
commit
29bf6a8d42
14
.github/workflows/rust.yml
vendored
14
.github/workflows/rust.yml
vendored
@ -65,3 +65,17 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
command: clippy
|
command: clippy
|
||||||
args: --all-targets -- --deny warnings
|
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
|
||||||
|
@ -23,4 +23,3 @@ impl ErrorCode for AuthenticationError {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ use std::sync::Arc;
|
|||||||
|
|
||||||
use async_stream::stream;
|
use async_stream::stream;
|
||||||
use futures::StreamExt;
|
use futures::StreamExt;
|
||||||
use log::{trace};
|
use log::trace;
|
||||||
use oxidized_json_checker::JsonChecker;
|
use oxidized_json_checker::JsonChecker;
|
||||||
use tokio::fs;
|
use tokio::fs;
|
||||||
use tokio::io::AsyncWriteExt;
|
use tokio::io::AsyncWriteExt;
|
||||||
|
@ -33,16 +33,16 @@ guard_content_type!(guard_json, "application/json");
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
fn guard_json(head: &actix_web::dev::RequestHead) -> bool {
|
fn guard_json(head: &actix_web::dev::RequestHead) -> bool {
|
||||||
if let Some(content_type) = head.headers.get("Content-Type") {
|
if let Some(content_type) = head.headers.get("Content-Type") {
|
||||||
content_type
|
content_type
|
||||||
.to_str()
|
.to_str()
|
||||||
.map(|v| v.contains("application/json"))
|
.map(|v| v.contains("application/json"))
|
||||||
.unwrap_or(false)
|
.unwrap_or(false)
|
||||||
} else {
|
} else {
|
||||||
// if no content-type is specified we still accept the data as json!
|
// if no content-type is specified we still accept the data as json!
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
struct DocumentParam {
|
struct DocumentParam {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use log::debug;
|
|
||||||
use actix_web::{web, HttpResponse};
|
use actix_web::{web, HttpResponse};
|
||||||
|
use log::debug;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use crate::error::ResponseError;
|
use crate::error::ResponseError;
|
||||||
|
@ -21,12 +21,11 @@ pub fn services(cfg: &mut web::ServiceConfig) {
|
|||||||
.route(web::delete().to(delete_index)),
|
.route(web::delete().to(delete_index)),
|
||||||
)
|
)
|
||||||
.service(
|
.service(
|
||||||
web::resource("/indexes/{index_uid}/updates")
|
web::resource("/indexes/{index_uid}/updates").route(web::get().to(get_all_updates_status)),
|
||||||
.route(web::get().to(get_all_updates_status))
|
|
||||||
)
|
)
|
||||||
.service(
|
.service(
|
||||||
web::resource("/indexes/{index_uid}/updates/{update_id}")
|
web::resource("/indexes/{index_uid}/updates/{update_id}")
|
||||||
.route(web::get().to(get_update_status))
|
.route(web::get().to(get_update_status)),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use std::collections::{BTreeSet, HashSet};
|
use std::collections::{BTreeSet, HashSet};
|
||||||
|
|
||||||
use log::debug;
|
|
||||||
use actix_web::{web, HttpResponse};
|
use actix_web::{web, HttpResponse};
|
||||||
|
use log::debug;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use log::debug;
|
|
||||||
use actix_web::{web, HttpResponse};
|
use actix_web::{web, HttpResponse};
|
||||||
|
use log::debug;
|
||||||
|
|
||||||
use crate::extractors::authentication::{policies::*, GuardedData};
|
use crate::extractors::authentication::{policies::*, GuardedData};
|
||||||
use crate::index::Settings;
|
use crate::index::Settings;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use log::debug;
|
|
||||||
use actix_web::{web, HttpResponse};
|
use actix_web::{web, HttpResponse};
|
||||||
|
use log::debug;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
|
|
||||||
use crate::error::ResponseError;
|
use crate::error::ResponseError;
|
||||||
|
Loading…
Reference in New Issue
Block a user